From b4c276263fe1073f14d42fe49980f3aaa5c762f5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 1 Apr 2019 11:03:04 -0700 Subject: [PATCH] weed filer: mysql/postgres use ReadCommitted transaction isolation level for atomic rename --- weed/filer2/abstract_sql/abstract_sql_store.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/weed/filer2/abstract_sql/abstract_sql_store.go b/weed/filer2/abstract_sql/abstract_sql_store.go index 9a3ee51c3..3e8554957 100644 --- a/weed/filer2/abstract_sql/abstract_sql_store.go +++ b/weed/filer2/abstract_sql/abstract_sql_store.go @@ -26,7 +26,10 @@ type TxOrDB interface { } func (store *AbstractSqlStore) BeginTransaction(ctx context.Context) (context.Context, error) { - tx, err := store.DB.BeginTx(ctx, nil) + tx, err := store.DB.BeginTx(ctx, &sql.TxOptions{ + Isolation: sql.LevelReadCommitted, + ReadOnly: false, + }) if err != nil { return ctx, err }