You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These both make modifications to the database, each in its own separate transaction, but they can be called independently and the sequence number is often used by other concurrent processes giving rise to a huge opportunity for corrupting the database in a concurrent usage scenario:
returnfmt.Errorf("error during mkv update (%T): %w", seq, err)
}
idx.l.Lock()
deferidx.l.Unlock()
idx.curSeq=seq
returnnil
}
I seem to recall this Set() followed by SetSeq() pattern used in go-ssb as well. We should probably have a way to do this in a single call which either uses a mutex or opens a transaction, writes both, and commits it. Right now anyone using Set() within a SinkIndex callback is going to be subject to this problem. And it readily hands the user a footgun by not even providing a mechanism to do this properly and forcing them to use this pattern externally as well.
The text was updated successfully, but these errors were encountered:
Related to #30
These both make modifications to the database, each in its own separate transaction, but they can be called independently and the sequence number is often used by other concurrent processes giving rise to a huge opportunity for corrupting the database in a concurrent usage scenario:
margaret/indexes/mkv/index.go
Lines 96 to 131 in 22ed48a
margaret/indexes/mkv/index.go
Lines 153 to 173 in 22ed48a
I seem to recall this
Set()
followed bySetSeq()
pattern used ingo-ssb
as well. We should probably have a way to do this in a single call which either uses a mutex or opens a transaction, writes both, and commits it. Right now anyone usingSet()
within aSinkIndex
callback is going to be subject to this problem. And it readily hands the user a footgun by not even providing a mechanism to do this properly and forcing them to use this pattern externally as well.The text was updated successfully, but these errors were encountered: