diff --git a/erigon-lib/kv/kv_interface.go b/erigon-lib/kv/kv_interface.go index f8832cbbb02..8b7f8879137 100644 --- a/erigon-lib/kv/kv_interface.go +++ b/erigon-lib/kv/kv_interface.go @@ -240,19 +240,7 @@ type RoDB interface { ReadOnly() bool View(ctx context.Context, f func(tx Tx) error) error - // BeginRo - creates transaction - // tx may be discarded by .Rollback() method - // - // A transaction and its cursors must only be used by a single - // thread (not goroutine), and a thread may only have a single transaction at a time. - // It happen automatically by - because this method calls runtime.LockOSThread() inside (Rollback/Commit releases it) - // By this reason application code can't call runtime.UnlockOSThread() - it leads to undefined behavior. - // - // If this `parent` is non-NULL, the new transaction - // will be a nested transaction, with the transaction indicated by parent - // as its parent. Transactions may be nested to any level. A parent - // transaction and its cursors may not issue any other operations than - // Commit and Rollback while it has active child transactions. + // BeginRo - creates transaction, must not be moved between gorotines BeginRo(ctx context.Context) (Tx, error) AllTables() TableCfg PageSize() datasize.ByteSize @@ -291,6 +279,19 @@ type RwDB interface { Update(ctx context.Context, f func(tx RwTx) error) error UpdateNosync(ctx context.Context, f func(tx RwTx) error) error + // BeginRw - creates transaction + // tx may be discarded by .Rollback() method + // + // A transaction and its cursors must only be used by a single + // thread (not goroutine), and a thread may only have a single transaction at a time. + // It happen automatically by - because this method calls runtime.LockOSThread() inside (Rollback/Commit releases it) + // By this reason application code can't call runtime.UnlockOSThread() - it leads to undefined behavior. + // + // If this `parent` is non-NULL, the new transaction + // will be a nested transaction, with the transaction indicated by parent + // as its parent. Transactions may be nested to any level. A parent + // transaction and its cursors may not issue any other operations than + // Commit and Rollback while it has active child transactions. BeginRw(ctx context.Context) (RwTx, error) BeginRwNosync(ctx context.Context) (RwTx, error) }