mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
filer/store_test: roll back a transaction an assertion abandons
A failed assertion between BeginTransaction and the commit left the transaction open with its locks, and the cleanup's DROP SCHEMA then waited on them until the go test timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0b4954eb76
commit
dfee72ea31
1 file changed
+9
-5
@@ -137,18 +137,22 @@ func TestFilerStoreConformance(t *testing.T, store filer.FilerStore) {
|
||||
})
|
||||
|
||||
t.Run("transaction", func(t *testing.T) {
|
||||
txCtx, err := store.BeginTransaction(ctx)
|
||||
require.NoError(t, err)
|
||||
begin := func() context.Context {
|
||||
txCtx, err := store.BeginTransaction(ctx)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { store.RollbackTransaction(txCtx) })
|
||||
return txCtx
|
||||
}
|
||||
txCtx := begin()
|
||||
require.NoError(t, store.InsertEntry(txCtx, file("/buckets/bkt1/rolledback", 1)))
|
||||
require.NoError(t, store.RollbackTransaction(txCtx))
|
||||
notFound(t, "/buckets/bkt1/rolledback")
|
||||
|
||||
txCtx, err = store.BeginTransaction(ctx)
|
||||
require.NoError(t, err)
|
||||
txCtx = begin()
|
||||
require.NoError(t, store.InsertEntry(txCtx, file("/buckets/bkt1/committed", 1)))
|
||||
require.NoError(t, store.KvPut(txCtx, []byte("tx-key"), []byte("tx-value")))
|
||||
require.NoError(t, store.CommitTransaction(txCtx))
|
||||
_, err = store.FindEntry(ctx, "/buckets/bkt1/committed")
|
||||
_, err := store.FindEntry(ctx, "/buckets/bkt1/committed")
|
||||
require.NoError(t, err)
|
||||
v, err := store.KvGet(ctx, []byte("tx-key"))
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in new issue
Block a user