titan icon indicating copy to clipboard operation
titan copied to clipboard

May remove blob storage too early

Open Connor1996 opened this issue 5 years ago • 0 comments

When calling DestroyColumnFamilyHandle we may remove related blob storage directly. But if there are multiples column family handles, Titan removes related blob storage on the first time to call DestroyColumnFamilyHandle, so using other non-destroyed column family handles to get will encounter blob-storage-not-found.

TitanDB::Open(db_options, dbname_, descs, &cf_handles_, &db_));

// ... put some data

std::vector<ColumnFamilyHandle*> cf_handles_tmp;
for (auto& handle : cf_handles_) {
    cf_handles_tmp.push_back(db_impl_->GetColumnFamilyHandleUnlocked(handle->GetID()));
 }

// ... get some data. Success!

for (auto& handle : cf_handles_tmp) {
    ASSERT_TRUE(handle);
    db_->DestroyColumnFamilyHandle(handle);
 }

// ... get some data. Fail!

But it's okay for normal usage, cause GetColumnFamilyHandleUnlocked can't be called exteriorly.

Connor1996 avatar Oct 12 '19 09:10 Connor1996