提交 7e76aaba 编写于 作者: Z ZhaoMing

Fix DeleteFile multiple deletion bug

上级 e48435c4
#!/bin/bash
#
# WITH_TESTS=1 ./build_cmake.sh
#
BASE=$PWD
OUTPUT=output
mkdir -p $OUTPUT
if [ "$WITH_TESTS" == "1" ];then
WITH_TESTS=ON
else
WITH_TESTS=OFF
fi
echo "build $BUILD_TYPE, with_tests = $WITH_TESTS"
if test -n "$BUILD_BRANCH"; then
# this script is run in SCM auto build
git checkout "$BUILD_BRANCH"
sudo apt-get update
sudo apt-get install libaio-dev -y
else
echo you must ensure libaio-dev have been installed
fi
git submodule update --init --recursive
cd $BASE/$OUTPUT && cmake ../ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_TOOLS=ON -DWITH_TERARK_ZIP=ON
cd $BASE/$OUTPUT && cmake ../ -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=${WITH_TESTS} -DWITH_TOOLS=ON -DWITH_TERARK_ZIP=ON
cd $BASE/$OUTPUT && make -j $(nproc) && make install
......@@ -2979,6 +2979,7 @@ Status DBImpl::DeleteFile(std::string name) {
job_context.Clean(nullptr);
return Status::InvalidArgument("File in level 0, but not oldest");
}
metadata->being_compacted = true;
edit.SetColumnFamily(cfd->GetID());
edit.DeleteFile(level, number);
status = versions_->LogAndApply(cfd, *cfd->GetLatestMutableCFOptions(),
......@@ -2988,6 +2989,7 @@ Status DBImpl::DeleteFile(std::string name) {
cfd, &job_context.superversion_contexts[0],
*cfd->GetLatestMutableCFOptions(), FlushReason::kDeleteFiles);
}
metadata->being_compacted = false;
FindObsoleteFiles(&job_context, false);
} // lock released here
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册