Skip to content
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

Allow deleting tables before updating #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seiferteric
Copy link

@seiferteric seiferteric commented May 26, 2023

What is this
There is a use-case when you want to update a table, but delete all entries in that table beforehand, then update in a single transaction. A use-case is where we collect stats on all processes and docker containers periodically. In this case, process and containers may come and go, and so you would want to delete all the old entries and add back the new ones to the table each time instead of figuring out which processes had gone and which have stayed each time. In order to maintain data consistency, we would like this in a single transaction so every time this data is retrieved it has the latest information.

The issue with the current implementation is that since you must pass the table name as "None" to delete, but then I must also pass the table data, but I can't do that because it's the same table. So my data would have to be this for example {"PROC_STATS": None, "PROC_STATS": {...actual data...}} which is invalid because of the duplicate key. The solution here is the pass a list of table names to delete before doing the update, but as part of the same transaction.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 26, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: seiferteric / name: Eric Seifert (0f3e70d)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 30, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Add table_delete to mod_config in the ConfigDBPipeConnector to allow table cleanup as part of transaction

Add unittest for ConfigDBConnector
@seiferteric
Copy link
Author

@qiluo-msft can you review? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant