frostfsid: Make migration idempotent #135
No reviewers
TrueCloudLab/storage-core-developers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-contract#135
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "achuprov/frostfs-contract:bugfix/frostfsid_migration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -652,0 +693,4 @@
updateContractFail(t, c1, e, c.Hash, args, "frostfsid contract contains duplicate keys")
invoker.Invoke(t, stackitem.Null{}, deleteSubjectMethod, subjBKeyAddr)
updateContract(t, c1, e, c.Hash, args)
updateContract(t, c1, e, c.Hash, args)
Сheck idempotency of the
update
@ -651,1 +652,4 @@
const frostfsidContractName = "frostfsid"
func TestFrostfsid_Migration(t *testing.T) {
This is one time test, I do not see it being useful.
Could you remove it?
@ -12,3 +12,3 @@
// any migration routines.
prevMajor = 0
prevMinor = 20
prevMinor = 21
21.0 is not deployed anywhere, we will definitely update on 21.1 in one step
d1b0bd3676
tocb5dc744a3
@ -116,2 +116,3 @@
if isUpdate {
it := storage.Find(ctx, subjectKeysPrefix, storage.ValuesOnly)
it := storage.Find(ctx, addressPrefix, storage.KeysOnly)
migrationCompleted := false
What do you need this flag for?
This flag means that contracts do not contain keys with
addressPrefix
. There are only two possible cases: either the contract does not contain subjects, or the migration wasn't executed. In both cases, theUpdate
operation is idempotentIn what situation can it be true?
The flag can be set to true if the
deploy
is run again after migrationIt runs only on update.
The not-run-twice logic is achived via Version variables.
cb5dc744a3
to871aa280b4
@ -102,18 +102,17 @@ const (
func _deploy(data any, isUpdate bool) {
ctx := storage.GetContext()
args := data.(struct {
This is unrelated to the commit.
871aa280b4
to776b36499d
776b36499d
to9544465be3
9544465be3
tobc31d591e8
bc31d591e8
to01597b5dde