Project

General

Profile

How to delete MUC room cleanly

Matthew M
Added over 4 years ago

It seems that when a room is deleted, a "parent" node of the room is delete in tig_nodes table, but all the "child" nodes, such as room member pairs are not deleted with this room, and still left in DB.

I am wondering if these orphan pairs are left intentionally other reasons? I ran into this issue when I am trying to write a customized query to find all rooms that a user is a member of (see https://projects.tigase.org/boards/4/topics/2755), where the room is deleted, but the "membership" pairs are still in DB.

Not sure if the issue is this method

private void deleteSubnode(DataRepository repo, long nid) throws SQLException {

    Statement stmt = null;

    ResultSet rs   = null;

    String query   = null;


    try {

        if (repo == null) {

            stmt = data_repo.createStatement(null);

        } else {

            stmt = repo.createStatement(null);

        }

        query = "delete from " + DEF_PAIRS_TBL + " where nid = " + nid;

        stmt.executeUpdate(query);

        query = "delete from " + DEF_NODES_TBL + " where nid = " + nid;

        stmt.executeUpdate(query);

    } finally {

        data_repo.release(stmt, rs);

    }

}

Where the query of

"delete from " + DEF_PAIRS_TBL + " where nid = " + nid;

does not really delete all the sub nodes...


Replies (1)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

I do not think this is intentional, I have created a ticket for the issue: #2149 and you are on the ticket watchers list so you will be notified about any update.

    (1-1/1)