-
Notifications
You must be signed in to change notification settings - Fork 59
refactor: extract KeyValueStore to common #3621
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
Conversation
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
apps/common/src/main/scala/org/lfdecentralizedtrust/splice/store/KeyValueStore.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
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.
I'm thinking now that maybe this should just be added as another store in DbAppStore instead of having this class (and a similar one in Scan very soon). Thoughts?
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.
I don't understand the suggestion, you want to add a generic def keyValues: KeyValueStore to trait AppStore?
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.
Something like that. Mostly noticed that all other instantiations of StoreDescriptor are all in one place (e.g. for scan, it's in DbScanStore), so was wondering whether we want to add it somewhere that each app just needs to define the StoreDescriptor for it. But that whole setup with AcsStores, TxLogStores, etc is so complex as it is, that I'm no longer thinking this is a great idea...
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
nicu-da
left a comment
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.
Nice, thanks! This makes me wonder how do we treat such releases that make rollbacks not possible without a restore from backup though 🤔 Should we add a note to the release notes?
| val jsonValue: Json = value.asJson | ||
|
|
||
| val action = sql"""INSERT INTO validator_internal_config (config_key, config_value, store_id) | ||
| val action = sql"""INSERT INTO key_value_store (key, value, store_id) |
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.
changing the table name, what about existing data? (does this matter for the validator store version?)
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.
We're only renaming a table and some columns/constraints, that shouldn't affect existing data, no?
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.
The table itself is also renamed accordingly in flyway, so data would be preserved
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.
thanks missed that (flyway)
ray-roestenburg-da
left a comment
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.
Thanks
rautenrieth-da
left a comment
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.
Thanks!
| val jsonValue: Json = value.asJson | ||
|
|
||
| val action = sql"""INSERT INTO validator_internal_config (config_key, config_value, store_id) | ||
| val action = sql"""INSERT INTO key_value_store (key, value, store_id) |
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.
We're only renaming a table and some columns/constraints, that shouldn't affect existing data, no?
| val otherKey = "key2" | ||
| val otherValue = "jsonPayload2" | ||
|
|
||
| "set and get a payload successfully" in { |
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.
Suggestion for one more test: create two stores with different descriptors, check that they don't affect each others data.
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.
👍
(note that these tests are not new, it's just refactoring of the existing ones, separating the generic key-store ones from the ones specific for validator data, but I'll add a test nevertheless)
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.
I don't understand the suggestion, you want to add a generic def keyValues: KeyValueStore to trait AppStore?
Doesn't that apply to any change that adds a new flyway migration? We have 50 migrations already and haven't called them out in the release notes before. Shouldn't we just make it the default expectation that you can't downgrade to a previous release without restoring from backup? |
Additions are not an issue for rollbacks, and i suspect most of our migrations are additions and not mutations/deletions. We have occasionally rolled back at least on our own nodes so I think we should start giving more awareness to these forward only changes. |
Hm, this line says we explicitly configure flyway to complain if the database contains future migrations (those that are applied but not yet known to the running application). Is that not preventing application startup? If not then mentioning database schema changes in release notes could be useful. Maybe a general compatibility table with columns like |
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
So we basically never allowed downgrade between versions that contain any flyway migration? |
It does look like it. Not ideal |
This factors out of the validator, to common, the key-value storage functionality from ValidatorInternalStore, and also applies some renaming to make it a more generic key-value and not specifically for "configurations".
Motivation:
Add a key-value store to Scan (specifically, in the near-term, to store progress of the bulk-storage dumps)
Pull Request Checklist
Cluster Testing
/cluster_teston this PR to request it, and ping someone with access to the DA-internal system to approve it./hdm_teston this PR to request it, and ping someone with access to the DA-internal system to approve it.PR Guidelines
Fixes #n, and mention issues worked on using#nMerge Guidelines