Suppress clang analyzer error (#4299)
Summary: Suppress multiple clang-analyzer error. All of them are clang false-positive. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4299 Differential Revision: D9430740 Pulled By: yiwu-arbug fbshipit-source-id: fbdd575bdc214d124826d61d35a117995c509279
This commit is contained in:
parent
c9a0419413
commit
4f12d49daf
@ -408,6 +408,7 @@ bool HashCuckooRep::QuickInsert(const char* internal_key, const Slice& user_key,
|
||||
const auto bucket_user_key = UserKey(stored_key);
|
||||
if (bucket_user_key.compare(user_key) == 0) {
|
||||
cuckoo_bucket_id = bucket_ids[hid];
|
||||
assert(cuckoo_bucket_id != -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -469,16 +469,12 @@ void ThreadPoolImpl::SubmitJob(std::function<void()>&& job) {
|
||||
|
||||
void ThreadPoolImpl::Schedule(void(*function)(void* arg1), void* arg,
|
||||
void* tag, void(*unschedFunction)(void* arg)) {
|
||||
|
||||
std::function<void()> fn = [arg, function] { function(arg); };
|
||||
|
||||
std::function<void()> unfn;
|
||||
if (unschedFunction != nullptr) {
|
||||
auto uf = [arg, unschedFunction] { unschedFunction(arg); };
|
||||
unfn = std::move(uf);
|
||||
if (unschedFunction == nullptr) {
|
||||
impl_->Submit(std::bind(function, arg), std::function<void()>(), tag);
|
||||
} else {
|
||||
impl_->Submit(std::bind(function, arg), std::bind(unschedFunction, arg),
|
||||
tag);
|
||||
}
|
||||
|
||||
impl_->Submit(std::move(fn), std::move(unfn), tag);
|
||||
}
|
||||
|
||||
int ThreadPoolImpl::UnSchedule(void* arg) {
|
||||
|
@ -75,8 +75,10 @@ TEST_F(DocumentDBTest, SimpleQueryTest) {
|
||||
ASSERT_OK(DocumentDB::Open(options, dbname_, {}, &db_));
|
||||
CreateIndexes({index});
|
||||
delete db_;
|
||||
db_ = nullptr;
|
||||
// now there is index present
|
||||
ASSERT_OK(DocumentDB::Open(options, dbname_, {index}, &db_));
|
||||
assert(db_ != nullptr);
|
||||
delete index.description;
|
||||
|
||||
std::vector<std::string> json_objects = {
|
||||
|
@ -796,6 +796,7 @@ TEST_P(TransactionTest, LogMarkLeakTest) {
|
||||
WriteOptions write_options;
|
||||
options.write_buffer_size = 1024;
|
||||
ASSERT_OK(ReOpenNoDelete());
|
||||
assert(db != nullptr);
|
||||
Random rnd(47);
|
||||
std::vector<Transaction*> txns;
|
||||
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB());
|
||||
@ -1254,6 +1255,7 @@ TEST_P(TransactionTest, PersistentTwoPhaseTransactionTest) {
|
||||
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash();
|
||||
s = ReOpenNoDelete();
|
||||
ASSERT_OK(s);
|
||||
assert(db != nullptr);
|
||||
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB());
|
||||
|
||||
// find trans in list of prepared transactions
|
||||
|
@ -100,6 +100,7 @@ class TransactionTestBase : public ::testing::Test {
|
||||
} else {
|
||||
s = OpenWithStackableDB();
|
||||
}
|
||||
assert(!s.ok() || db != nullptr);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -121,6 +122,7 @@ class TransactionTestBase : public ::testing::Test {
|
||||
} else {
|
||||
s = OpenWithStackableDB(cfs, handles);
|
||||
}
|
||||
assert(db != nullptr);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -134,6 +136,7 @@ class TransactionTestBase : public ::testing::Test {
|
||||
} else {
|
||||
s = OpenWithStackableDB();
|
||||
}
|
||||
assert(db != nullptr);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -184,15 +187,17 @@ class TransactionTestBase : public ::testing::Test {
|
||||
txn_db_options.write_policy == WRITE_PREPARED;
|
||||
Status s = DBImpl::Open(options_copy, dbname, column_families, &handles,
|
||||
&root_db, use_seq_per_batch, use_batch_per_txn);
|
||||
StackableDB* stackable_db = new StackableDB(root_db);
|
||||
if (s.ok()) {
|
||||
assert(root_db != nullptr);
|
||||
assert(handles.size() == 1);
|
||||
s = TransactionDB::WrapStackableDB(stackable_db, txn_db_options,
|
||||
compaction_enabled_cf_indices, handles,
|
||||
&db);
|
||||
delete handles[0];
|
||||
if (!s.ok()) {
|
||||
delete root_db;
|
||||
return s;
|
||||
}
|
||||
StackableDB* stackable_db = new StackableDB(root_db);
|
||||
assert(root_db != nullptr);
|
||||
assert(handles.size() == 1);
|
||||
s = TransactionDB::WrapStackableDB(stackable_db, txn_db_options,
|
||||
compaction_enabled_cf_indices, handles,
|
||||
&db);
|
||||
delete handles[0];
|
||||
if (!s.ok()) {
|
||||
delete stackable_db;
|
||||
// just in case it was not deleted (and not set to nullptr).
|
||||
|
@ -1015,6 +1015,7 @@ TEST_P(WritePreparedTransactionTest, AdvanceMaxEvictedSeqWithDuplicatesTest) {
|
||||
wp_db->db_impl_->FlushWAL(true);
|
||||
wp_db->TEST_Crash();
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
wp_db = dynamic_cast<WritePreparedTxnDB*>(db);
|
||||
wp_db->AdvanceMaxEvictedSeq(0, new_max);
|
||||
s = db->Get(ropt, db->DefaultColumnFamily(), "key", &pinnable_val);
|
||||
@ -1146,6 +1147,7 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrentTest) {
|
||||
// Check if recovery preserves the last sequence number
|
||||
db_impl->FlushWAL(true);
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB());
|
||||
seq = db_impl->TEST_GetLastVisibleSequence();
|
||||
ASSERT_EQ(exp_seq, seq);
|
||||
@ -1158,6 +1160,7 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrentTest) {
|
||||
// Check if recovery after flush preserves the last sequence number
|
||||
db_impl->FlushWAL(true);
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB());
|
||||
seq = db_impl->GetLatestSequenceNumber();
|
||||
ASSERT_EQ(exp_seq, seq);
|
||||
@ -1212,6 +1215,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
|
||||
wp_db->db_impl_->FlushWAL(true);
|
||||
wp_db->TEST_Crash();
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
wp_db = dynamic_cast<WritePreparedTxnDB*>(db);
|
||||
// After recovery, all the uncommitted txns (0 and 1) should be inserted into
|
||||
// delayed_prepared_
|
||||
@ -1256,6 +1260,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
|
||||
wp_db->db_impl_->FlushWAL(true);
|
||||
wp_db->TEST_Crash();
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
wp_db = dynamic_cast<WritePreparedTxnDB*>(db);
|
||||
ASSERT_TRUE(wp_db->prepared_txns_.empty());
|
||||
ASSERT_FALSE(wp_db->delayed_prepared_empty_);
|
||||
@ -1290,6 +1295,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) {
|
||||
delete txn2;
|
||||
wp_db->db_impl_->FlushWAL(true);
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
wp_db = dynamic_cast<WritePreparedTxnDB*>(db);
|
||||
ASSERT_TRUE(wp_db->prepared_txns_.empty());
|
||||
ASSERT_TRUE(wp_db->delayed_prepared_empty_);
|
||||
@ -1590,6 +1596,7 @@ TEST_P(WritePreparedTransactionTest, RollbackTest) {
|
||||
db_impl->FlushWAL(true);
|
||||
dynamic_cast<WritePreparedTxnDB*>(db)->TEST_Crash();
|
||||
ReOpenNoDelete();
|
||||
assert(db != nullptr);
|
||||
wp_db = dynamic_cast<WritePreparedTxnDB*>(db);
|
||||
txn = db->GetTransactionByName("xid0");
|
||||
ASSERT_FALSE(wp_db->delayed_prepared_empty_);
|
||||
|
@ -250,7 +250,7 @@ TEST_P(WriteUnpreparedTransactionTest, RecoveryTest) {
|
||||
wup_db->db_impl_->FlushWAL(true);
|
||||
wup_db->TEST_Crash();
|
||||
ReOpenNoDelete();
|
||||
wup_db = dynamic_cast<WriteUnpreparedTxnDB*>(db);
|
||||
assert(db != nullptr);
|
||||
|
||||
db->GetAllPreparedTransactions(&prepared_trans);
|
||||
ASSERT_EQ(prepared_trans.size(), a == UNPREPARED ? 0 : 1);
|
||||
|
Loading…
Reference in New Issue
Block a user