Skip to content

Commit 27e0449

Browse files
fix(restore_test): refresh permissions between table creation
TestRestoreFullChangingMethodIntegration behaved flaky recently. Even though a few initial restore table could succeed, it could fail on the last one on permissions' error. In this test, we drop and re-create the tables constantly. This also drops their permissions configuration. The test worked because the same user also re-created those tables and was granted all their permissions by default. It might be that such permissions are not instantly propagated to all other nodes and depending on which node the alter schema query is routed to, the test might fail. To fix that, we could either make an explicit raft read barrier on all nodes, or just re-apply the needed permissions, as explicit permissions changes also result in raft read barrier being performed underneath. I chose the second approach, because it requires only a single API call and is more explicit in terms of what permissions are expected from the restore user instead of relying on the default permissions granted on schema restore.
1 parent 664af2d commit 27e0449

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/service/restore/restore_method_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ func TestRestoreFullChangingMethodIntegration(t *testing.T) {
278278
},
279279
}
280280
grantRestoreSchemaPermissions(t, h.dstCluster.rootSession, h.dstUser)
281-
grantRestoreTablesPermissions(t, h.dstCluster.rootSession, ksFilter, h.dstUser)
282281

283282
type testIter struct {
284283
backupMethod backup.Method
@@ -305,6 +304,7 @@ func TestRestoreFullChangingMethodIntegration(t *testing.T) {
305304
h.runRestore(t, restoreProps)
306305

307306
t.Log("Restore tables: ", i)
307+
grantRestoreTablesPermissions(t, h.dstCluster.rootSession, ksFilter, h.dstUser)
308308
restoreProps = defaultTestProperties(loc, tag, true)
309309
h.runRestore(t, restoreProps)
310310

0 commit comments

Comments
 (0)