-
Notifications
You must be signed in to change notification settings - Fork 147
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
ROX-12578: Migration for groups table #5142
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
pkg/migrations/internal/seq_num.go
Outdated
@@ -4,7 +4,7 @@ var ( | |||
// CurrentDBVersionSeqNum is the current DB version number. | |||
// This must be incremented every time we write a migration. | |||
// It is a shared constant between central and the migrator binary. | |||
CurrentDBVersionSeqNum = 172 | |||
CurrentDBVersionSeqNum = 173 |
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.
first comment is I just pushed a change with migration 173, so sadly you will need to adjust that and your naming.
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.
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.
be warned @rhybrillou has a couple of migrations in flight too.
I think we need to re-upsert the records to populate the new columns. right? |
Images are ready for the commit at 4a38fa9. To use with deploy scripts, first |
ef27ea5
to
8b4a87e
Compare
45a4ecf
to
3de9bac
Compare
Added this. |
/test gke-postgres-upgrade-tests |
/retest |
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.
LGTM
8b4a87e
to
3889a1e
Compare
9264729
to
8842eab
Compare
/retest |
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.
Good job. Please fix the frozen schema in the updated store, then things should be good to go.
return err | ||
} | ||
if len(groupsToDelete) > 0 { | ||
return previousStore.DeleteMany(ctx, groupsToDelete) |
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.
Could the error be wrapped like in the walk function for consistency ?
(also applies to re-upserts).
}, | ||
{ | ||
Props: &storage.GroupProperties{ | ||
Id: "group-id-3", |
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.
Is there any guaranty which if group 3 and group 4 will survive the pruning ?
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.
Strictly speaking there isn't, so I rewrote the tests to account for that.
ops "github.com/stackrox/rox/pkg/metrics" | ||
"github.com/stackrox/rox/pkg/postgres" | ||
"github.com/stackrox/rox/pkg/postgres/pgutils" | ||
pkgSchema "github.com/stackrox/rox/pkg/postgres/schema" |
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.
References to the moving pkg/postgres/schema
are forbidden in migrations. You should reference the new frozen schema here.
Description
This PR is a follow-up of pull/5099, for additional context see the parent PR's changes and description.
The PR adds a migration for the groups table.
Essentially, the following will be done:
Checklist
If any of these don't apply, please comment below.
Testing Performed