is HasBGError() strong enough when some error happened in LogAndApply #182
Labels
component/titan
Component: Titan engine
status/help-wanted
Status: Help wanted. Contributions are very welcome!
type/bug
Type: Issue - Confirmed a bug
we can see that a
bg_error_
will be set whendb_->blob_file_set_->LogAndApply(edit)
return some error at db_impl.cpp:87. and the correspondinghas_bg_error_
will be set to true as well to indicate that some bg error happend.The lightweight flag
has_bg_error_
is used to indicate whether some bg error happend and turn the whole db into read only mode and forbid subsequence read/write.However, in
HasBGError()
do not hold themutex_
, but return thehas_bg_error_
directly. I think there is a chance that some error has been happedn in LogAndApply andbg_error_
has been set to an error code, buthas_bg_error_
is still false. In this scenario, the put/write from user is still allowed sinceHasBGError()
return false at this point, then some unpredictable behavior will be happend, such as subsequent version edit will be apply to the manifest file and the manifest info on the disk and the manifest info in the memory (BlobFileSet) is not the same.Could this be a bug in the titan?
HasBGError()
should hold themutex_
as well?The text was updated successfully, but these errors were encountered: