Skip to content

Commit

Permalink
update variable declaration location
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonwang371 committed May 3, 2021
1 parent 8d8d037 commit 5615421
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/mvcc/kvstore_txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ type storeTxnRead struct {
}

func (s *store) Read(mode ReadTxMode, trace *traceutil.Trace) TxnRead {
var tx backend.ReadTx
s.mu.RLock()
s.revMu.RLock()
// backend holds b.readTx.RLock() only when creating the concurrentReadTx. After
// ConcurrentReadTx is created, it will not block write transaction.
// For read-only workloads, we use shared buffer by copying transaction read buffer
// for higher concurrency with ongoing blocking writes.
// For write/write-read transactions, we use the shared buffer
// rather than duplicating transaction read buffer to avoid transaction overhead.
var tx backend.ReadTx
if mode == ConcurrentReadTxMode {
tx = s.b.ConcurrentReadTx()
} else {
Expand Down

0 comments on commit 5615421

Please sign in to comment.