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
So, overall, the Badger indexes seem to be the best guarded against race conditions of any I've seen. However, there's one spot where I can see a possibility for data corruption.
returnfmt.Errorf("error during setSeq update: %w", err)
}
returnnil
})
iferr!=nil {
returnerr
}
idx.curSeq=seq
returnnil
}
Since Set() keeps an in-memory state for the things it puts in the queue, which gets used first in Get() before attempting to read from Badger, it's unlikely this would cause a race condition. But if the program is terminated after a SetSeq() and before the batch is flushed, due to crash for example, the index could contain a sequence number which surpasses the actual data in the index.
And we would likely never see this in testing because of "nasty testing hack" #33 bypassing the write queue for the test suite. It would probably only show up downstream in actual use. So we should probably be doing some more testing with the nasty testing hack disabled.
The text was updated successfully, but these errors were encountered:
So, overall, the Badger indexes seem to be the best guarded against race conditions of any I've seen. However, there's one spot where I can see a possibility for data corruption.
Set()
uses a batch queue for writes:margaret/indexes/badger/index.go
Lines 278 to 320 in 22ed48a
While
SetSeq()
does not:margaret/indexes/badger/index.go
Lines 351 to 373 in 22ed48a
Since
Set()
keeps an in-memory state for the things it puts in the queue, which gets used first inGet()
before attempting to read from Badger, it's unlikely this would cause a race condition. But if the program is terminated after aSetSeq()
and before the batch is flushed, due to crash for example, the index could contain a sequence number which surpasses the actual data in the index.And we would likely never see this in testing because of "nasty testing hack" #33 bypassing the write queue for the test suite. It would probably only show up downstream in actual use. So we should probably be doing some more testing with the nasty testing hack disabled.
The text was updated successfully, but these errors were encountered: