kcplantdb.h | kcplantdb.h | |||
---|---|---|---|---|
skipping to change at line 2005 | skipping to change at line 2005 | |||
* @param step the number of steps. If it is not more than 0, the whole region is defraged. | * @param step the number of steps. If it is not more than 0, the whole region is defraged. | |||
* @return true on success, or false on failure. | * @return true on success, or false on failure. | |||
*/ | */ | |||
bool defrag(int64_t step = 0) { | bool defrag(int64_t step = 0) { | |||
_assert_(true); | _assert_(true); | |||
ScopedSpinRWLock lock(&mlock_, false); | ScopedSpinRWLock lock(&mlock_, false); | |||
if (omode_ == 0) { | if (omode_ == 0) { | |||
set_error(_KCCODELINE_, Error::INVALID, "not opened"); | set_error(_KCCODELINE_, Error::INVALID, "not opened"); | |||
return false; | return false; | |||
} | } | |||
return db_.defrag(step); | bool err = false; | |||
if (step < 1 && writer_) { | ||||
if (!clean_leaf_cache()) err = true; | ||||
if (!clean_inner_cache()) err = true; | ||||
} | ||||
if (!db_.defrag(step)) err = true; | ||||
return !err; | ||||
} | } | |||
/** | /** | |||
* Get the status flags. | * Get the status flags. | |||
* @return the status flags, or 0 on failure. | * @return the status flags, or 0 on failure. | |||
*/ | */ | |||
uint8_t flags() { | uint8_t flags() { | |||
_assert_(true); | _assert_(true); | |||
ScopedSpinRWLock lock(&mlock_, false); | ScopedSpinRWLock lock(&mlock_, false); | |||
if (omode_ == 0) { | if (omode_ == 0) { | |||
set_error(_KCCODELINE_, Error::INVALID, "not opened"); | set_error(_KCCODELINE_, Error::INVALID, "not opened"); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||