Allow deleting tables before updating#140
Open
seiferteric wants to merge 1 commit intosonic-net:masterfrom
Open
Allow deleting tables before updating#140seiferteric wants to merge 1 commit intosonic-net:masterfrom
seiferteric wants to merge 1 commit intosonic-net:masterfrom
Conversation
|
|
f896e63 to
0f3e70d
Compare
621f9ab to
c3dc796
Compare
Add table_delete to mod_config in the ConfigDBPipeConnector to allow table cleanup as part of transaction Add unittest for ConfigDBConnector
c3dc796 to
b2b16ab
Compare
Author
|
@qiluo-msft can you review? Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.