Skip to content

Commit

Permalink
fix(embedded/sql): fix data-race when mapping keys
Browse files Browse the repository at this point in the history
Signed-off-by: Jeronimo Irazabal <[email protected]>
  • Loading branch information
jeroiraz committed Nov 3, 2023
1 parent 033662e commit 4ac392d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions embedded/store/ongoing_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ func (tx *OngoingTx) set(key []byte, md *KVMetadata, value []byte, hashValue [sh
var indexedValue [lszSize + offsetSize + sha256.Size + sszSize + sszSize]byte

tx.st.indexersMux.RLock()
defer tx.st.indexersMux.RUnlock()
indexers := tx.st.indexers
tx.st.indexersMux.RUnlock()

for _, indexer := range tx.st.indexers {
for _, indexer := range indexers {
if isTransient && !hasPrefix(key, indexer.TargetPrefix()) {
continue
}
Expand Down

0 comments on commit 4ac392d

Please sign in to comment.