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
Fix(cleanup): Avoid truncating in value.Open on error (#1465)
* Fix(cleanup): Avoid truncating in value.Open on error
The vlog.Open() function can return an error denoting that the open was
unsuccessful but we have `db.cleanup` which will be called to stop all
the running go routines in case badger couldn't start. The db.cleanup
function calls vlog.Close() which will truncate the maxFid vlog file
based on the vlog.writableLogOffset. The vlog.writableLogOffset was not
being updated in case open failed. As a result of this, we will end up
truncating the vlog file to lenght 0 if open fails.
This PR fixes this by using vlog.stopDiscardStatFlush() instead of vlog.close.
0 commit comments