Giter VIP home page Giter VIP logo

synapse-find-unreferenced-state-groups's Introduction

Find unreferenced state groups

Due to "reasons" synapse will sometimes persist state groups that don't later then get referenced by events (or other state groups that are referenced by events). This tool scans the table (optionally limiting to a room) and finds such unreferenced groups.

CAUTION: While synapse is running and processing events there is a delay between the state groups and the events being persisted. As such this tool may pick up recent state groups that will in future get referenced by events that are still getting processed.

Do not blindly delete all the state groups that are returned by this tool.

Usage

$ rust-synapse-find-unreferenced-state-groups --help
rust-synapse-find-unreferenced-state-groups 0.1.0
Erik Johnston


USAGE:
    rust-synapse-find-unreferenced-state-groups [OPTIONS] -p <URL>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -o <FILE>           File to output unreferenced groups to
    -p <URL>            The url for connecting to the postgres database
    -r <ROOM_ID>        The room to process

For example:

rust-synapse-find-unreferenced-state-groups -p postgres://user:pass@localhost/synapse -r '!cURbafjkfsMDVwdRDQ:matrix.org' -o /tmp/sgs.txt

To delete the unreferenced state groups, use something like this in postgres:

CREATE TEMPORARY TABLE unreffed(id BIGINT PRIMARY KEY);
COPY unreffed FROM '/tmp/sgs.txt' WITH (FORMAT 'csv');
DELETE FROM state_groups_state WHERE state_group IN (SELECT id FROM unreffed);
DELETE FROM state_group_edges WHERE state_group IN (SELECT id FROM unreffed);
DELETE FROM state_groups WHERE id IN (SELECT id FROM unreffed);

synapse-find-unreferenced-state-groups's People

Contributors

erikjohnston avatar richvdh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.