-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQS cleanup (tables and apps) #13689
Conversation
…e sure the DB is cleared of any unused tables or rows.
…re similar to table save.
…ect Couch call functionality.
…on, making sure it cannot be missed.
const db = context.getAppDB() | ||
const tableId = table._id! | ||
// remove table search index | ||
if (!env.isTest() || env.COUCH_DB_URL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be checking if there sqs is enabled, instead of env.COUCH_DB_URL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason why this is excluded from tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly, I'm not sure - I didn't add this/change it, the indexes stuff is very old (and unrelated to SQS) that probably needs removed, I just moved it all to a central location for internal table cleanup, rather than it being splattered throughout the table controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 SQS!
Description
SQS automatically syncs data from CouchDB that comes via the changes stream, however when tables are deleted or when an app database is deleted it is not fully aware of this.
Keeping this information will not cause any search problems, but would use extra disk space that could be freed up. This solves the problem by making sure when a DB is removed that the on disk status is cleaned up, as well as making sure when a table is deleted it is removed from the SQLite design schema.
Sadly this is quite hard to test as SQS was already aware that rows/DB doesn't exist anymore, so won't respond to the search with them, the only way to confirm that this has worked as expected is by confirming the SQLite databases have been removed from the disk. I've checked/confirmed this and it does appear to be working as expected.
Addresses