From 5272305437a9aa91000cc690bd7966d8cf2435fa Mon Sep 17 00:00:00 2001 From: Derrick Pallas Date: Wed, 29 Apr 2020 13:06:27 -0700 Subject: [PATCH] Fix FilterBench when RTTI=0 (#6732) Summary: The dynamic_cast in the filter benchmark causes release mode to fail due to no-rtti. Replace with static_cast_with_check. Signed-off-by: Derrick Pallas Addition by peterd: Remove unnecessary 2nd template arg on all static_cast_with_check Pull Request resolved: https://github.com/facebook/rocksdb/pull/6732 Reviewed By: ltamasi Differential Revision: D21304260 Pulled By: pdillinger fbshipit-source-id: 6e8eb437c4ca5a16dbbfa4053d67c4ad55f1608c --- db/convenience.cc | 4 ++-- db/db_impl/db_impl.cc | 4 +--- db/db_impl/db_impl_compaction_flush.cc | 5 ++--- db/table_cache.cc | 3 +-- db/wal_manager.cc | 6 ++---- db/write_batch.cc | 2 +- env/mock_env.cc | 3 +-- monitoring/histogram.cc | 3 +-- monitoring/histogram_windowing.cc | 4 +--- options/cf_options.cc | 4 ++-- tools/db_bench_tool.cc | 7 +++---- tools/ldb_cmd.cc | 6 +++--- util/filter_bench.cc | 5 ++++- utilities/blob_db/blob_db_impl.cc | 2 +- .../transactions/optimistic_transaction.cc | 6 +++--- .../transactions/pessimistic_transaction.cc | 5 ++--- .../transactions/pessimistic_transaction_db.cc | 9 ++++----- .../transactions/pessimistic_transaction_db.h | 3 +-- utilities/transactions/transaction_base.cc | 2 +- utilities/transactions/transaction_lock_mgr.cc | 3 +-- utilities/transactions/write_prepared_txn.cc | 3 +-- utilities/transactions/write_prepared_txn_db.cc | 17 +++++++---------- utilities/transactions/write_prepared_txn_db.h | 7 +++---- utilities/transactions/write_unprepared_txn.cc | 6 ++---- .../transactions/write_unprepared_txn_db.cc | 8 +++----- .../write_batch_with_index.cc | 12 +++++------- 26 files changed, 58 insertions(+), 81 deletions(-) diff --git a/db/convenience.cc b/db/convenience.cc index 206f1f875..52592682e 100644 --- a/db/convenience.cc +++ b/db/convenience.cc @@ -14,7 +14,7 @@ namespace ROCKSDB_NAMESPACE { void CancelAllBackgroundWork(DB* db, bool wait) { - (static_cast_with_check(db->GetRootDB())) + (static_cast_with_check(db->GetRootDB())) ->CancelAllBackgroundWork(wait); } @@ -28,7 +28,7 @@ Status DeleteFilesInRange(DB* db, ColumnFamilyHandle* column_family, Status DeleteFilesInRanges(DB* db, ColumnFamilyHandle* column_family, const RangePtr* ranges, size_t n, bool include_end) { - return (static_cast_with_check(db->GetRootDB())) + return (static_cast_with_check(db->GetRootDB())) ->DeleteFilesInRanges(column_family, ranges, n, include_end); } diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 4e770c21c..a3fd0df45 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -870,9 +870,7 @@ void DBImpl::DumpStats() { Status DBImpl::TablesRangeTombstoneSummary(ColumnFamilyHandle* column_family, int max_entries_to_print, std::string* out_str) { - auto* cfh = - static_cast_with_check( - column_family); + auto* cfh = static_cast_with_check(column_family); ColumnFamilyData* cfd = cfh->cfd(); SuperVersion* super_version = cfd->GetReferencedSuperVersion(this); diff --git a/db/db_impl/db_impl_compaction_flush.cc b/db/db_impl/db_impl_compaction_flush.cc index b772a97ce..b01143f45 100644 --- a/db/db_impl/db_impl_compaction_flush.cc +++ b/db/db_impl/db_impl_compaction_flush.cc @@ -2143,8 +2143,7 @@ void DBImpl::BGWorkFlush(void* arg) { IOSTATS_SET_THREAD_POOL_ID(fta.thread_pri_); TEST_SYNC_POINT("DBImpl::BGWorkFlush"); - static_cast_with_check(fta.db_)->BackgroundCallFlush( - fta.thread_pri_); + static_cast_with_check(fta.db_)->BackgroundCallFlush(fta.thread_pri_); TEST_SYNC_POINT("DBImpl::BGWorkFlush:done"); } @@ -2155,7 +2154,7 @@ void DBImpl::BGWorkCompaction(void* arg) { TEST_SYNC_POINT("DBImpl::BGWorkCompaction"); auto prepicked_compaction = static_cast(ca.prepicked_compaction); - static_cast_with_check(ca.db)->BackgroundCallCompaction( + static_cast_with_check(ca.db)->BackgroundCallCompaction( prepicked_compaction, Env::Priority::LOW); delete prepicked_compaction; } diff --git a/db/table_cache.cc b/db/table_cache.cc index 1c37f74ab..d4dd73171 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -314,8 +314,7 @@ void TableCache::CreateRowCacheKeyPrefix(const ReadOptions& options, // Maybe we can include the whole file ifsnapshot == fd.largest_seqno. if (options.snapshot != nullptr && (get_context->has_callback() || - static_cast_with_check( - options.snapshot) + static_cast_with_check(options.snapshot) ->GetSequenceNumber() <= fd.largest_seqno)) { // We should consider to use options.snapshot->GetSequenceNumber() // instead of GetInternalKeySeqno(k), which will make the code diff --git a/db/wal_manager.cc b/db/wal_manager.cc index 5b699274c..7d2cd2b6a 100644 --- a/db/wal_manager.cc +++ b/db/wal_manager.cc @@ -334,10 +334,8 @@ Status WalManager::GetSortedWalsOfType(const std::string& path, std::sort( log_files.begin(), log_files.end(), [](const std::unique_ptr& a, const std::unique_ptr& b) { - LogFileImpl* a_impl = - static_cast_with_check(a.get()); - LogFileImpl* b_impl = - static_cast_with_check(b.get()); + LogFileImpl* a_impl = static_cast_with_check(a.get()); + LogFileImpl* b_impl = static_cast_with_check(b.get()); return *a_impl < *b_impl; }); return status; diff --git a/db/write_batch.cc b/db/write_batch.cc index 563c33de2..725602467 100644 --- a/db/write_batch.cc +++ b/db/write_batch.cc @@ -1281,7 +1281,7 @@ class MemTableInserter : public WriteBatch::Handler { ignore_missing_column_families_(ignore_missing_column_families), recovering_log_number_(recovering_log_number), log_number_ref_(0), - db_(static_cast_with_check(db)), + db_(static_cast_with_check(db)), concurrent_memtable_writes_(concurrent_memtable_writes), post_info_created_(false), has_valid_writes_(has_valid_writes), diff --git a/env/mock_env.cc b/env/mock_env.cc index ea63cd16a..16e427949 100644 --- a/env/mock_env.cc +++ b/env/mock_env.cc @@ -701,8 +701,7 @@ Status MockEnv::LockFile(const std::string& fname, FileLock** flock) { } Status MockEnv::UnlockFile(FileLock* flock) { - std::string fn = - static_cast_with_check(flock)->FileName(); + std::string fn = static_cast_with_check(flock)->FileName(); { MutexLock lock(&mutex_); if (file_map_.find(fn) != file_map_.end()) { diff --git a/monitoring/histogram.cc b/monitoring/histogram.cc index 55339f888..03268b4a4 100644 --- a/monitoring/histogram.cc +++ b/monitoring/histogram.cc @@ -251,8 +251,7 @@ void HistogramImpl::Add(uint64_t value) { void HistogramImpl::Merge(const Histogram& other) { if (strcmp(Name(), other.Name()) == 0) { - Merge( - *static_cast_with_check(&other)); + Merge(*static_cast_with_check(&other)); } } diff --git a/monitoring/histogram_windowing.cc b/monitoring/histogram_windowing.cc index 253512778..e114a6686 100644 --- a/monitoring/histogram_windowing.cc +++ b/monitoring/histogram_windowing.cc @@ -65,9 +65,7 @@ void HistogramWindowingImpl::Add(uint64_t value){ void HistogramWindowingImpl::Merge(const Histogram& other) { if (strcmp(Name(), other.Name()) == 0) { - Merge( - *static_cast_with_check( - &other)); + Merge(*static_cast_with_check(&other)); } } diff --git a/options/cf_options.cc b/options/cf_options.cc index 84b52e0d1..74c13aba4 100644 --- a/options/cf_options.cc +++ b/options/cf_options.cc @@ -413,7 +413,7 @@ std::unordered_map reinterpret_cast*>(addr); BlockBasedTableOptions table_opts, base_opts; BlockBasedTableFactory* block_based_table_factory = - static_cast_with_check( + static_cast_with_check( old_table_factory->get()); if (block_based_table_factory != nullptr) { base_opts = block_based_table_factory->table_options(); @@ -437,7 +437,7 @@ std::unordered_map reinterpret_cast*>(addr); PlainTableOptions table_opts, base_opts; PlainTableFactory* plain_table_factory = - static_cast_with_check( + static_cast_with_check( old_table_factory->get()); if (plain_table_factory != nullptr) { base_opts = plain_table_factory->table_options(); diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 8a1d09b35..52b907b09 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -3287,10 +3287,9 @@ class Benchmark { fprintf(stdout, "STATISTICS:\n%s\n", dbstats->ToString().c_str()); } if (FLAGS_simcache_size >= 0) { - fprintf(stdout, "SIMULATOR CACHE STATISTICS:\n%s\n", - static_cast_with_check(cache_.get()) - ->ToString() - .c_str()); + fprintf( + stdout, "SIMULATOR CACHE STATISTICS:\n%s\n", + static_cast_with_check(cache_.get())->ToString().c_str()); } #ifndef ROCKSDB_LITE diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index 56d52a340..661fc0fc6 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -1748,7 +1748,7 @@ void DBDumperCommand::DoDumpCommand() { if (max_keys == 0) break; if (is_db_ttl_) { - TtlIterator* it_ttl = static_cast_with_check(iter); + TtlIterator* it_ttl = static_cast_with_check(iter); rawtime = it_ttl->ttl_timestamp(); if (rawtime < ttl_start || rawtime >= ttl_end) { continue; @@ -2575,7 +2575,7 @@ void ScanCommand::DoCommand() { it->Valid() && (!end_key_specified_ || it->key().ToString() < end_key_); it->Next()) { if (is_db_ttl_) { - TtlIterator* it_ttl = static_cast_with_check(it); + TtlIterator* it_ttl = static_cast_with_check(it); int rawtime = it_ttl->ttl_timestamp(); if (rawtime < ttl_start || rawtime >= ttl_end) { continue; @@ -3416,7 +3416,7 @@ void ListFileRangeDeletesCommand::DoCommand() { return; } - DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); + DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); std::string out_str; diff --git a/util/filter_bench.cc b/util/filter_bench.cc index b474eee48..518e3e15f 100644 --- a/util/filter_bench.cc +++ b/util/filter_bench.cc @@ -23,6 +23,7 @@ int main() { #include "table/block_based/full_filter_block.h" #include "table/block_based/mock_block_based_table.h" #include "table/plain/plain_table_bloom.h" +#include "util/cast_util.h" #include "util/gflags_compat.h" #include "util/hash.h" #include "util/random.h" @@ -131,6 +132,7 @@ using ROCKSDB_NAMESPACE::ParsedFullFilterBlock; using ROCKSDB_NAMESPACE::PlainTableBloomV1; using ROCKSDB_NAMESPACE::Random32; using ROCKSDB_NAMESPACE::Slice; +using ROCKSDB_NAMESPACE::static_cast_with_check; using ROCKSDB_NAMESPACE::StderrLogger; using ROCKSDB_NAMESPACE::mock::MockBlockBasedTableTester; @@ -378,7 +380,8 @@ void FilterBench::Go() { info.filter_ = info.plain_table_bloom_->GetRawData(); } else { if (!builder) { - builder.reset(&dynamic_cast(*GetBuilder())); + builder.reset( + static_cast_with_check(GetBuilder())); } for (uint32_t i = 0; i < keys_to_add; ++i) { builder->AddKey(kms_[0].Get(filter_id, i)); diff --git a/utilities/blob_db/blob_db_impl.cc b/utilities/blob_db/blob_db_impl.cc index 0647d831d..70c2f4197 100644 --- a/utilities/blob_db/blob_db_impl.cc +++ b/utilities/blob_db/blob_db_impl.cc @@ -209,7 +209,7 @@ Status BlobDBImpl::Open(std::vector* handles) { if (!s.ok()) { return s; } - db_impl_ = static_cast_with_check(db_->GetRootDB()); + db_impl_ = static_cast_with_check(db_->GetRootDB()); // Initialize SST file <-> oldest blob file mapping if garbage collection // is enabled. diff --git a/utilities/transactions/optimistic_transaction.cc b/utilities/transactions/optimistic_transaction.cc index b01102bb2..f9fb8adfa 100644 --- a/utilities/transactions/optimistic_transaction.cc +++ b/utilities/transactions/optimistic_transaction.cc @@ -76,7 +76,7 @@ Status OptimisticTransaction::CommitWithSerialValidate() { // check whether this transaction is safe to be committed. OptimisticTransactionCallback callback(this); - DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); + DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); Status s = db_impl->WriteWithCallback( write_options_, GetWriteBatch()->GetWriteBatch(), &callback); @@ -92,7 +92,7 @@ Status OptimisticTransaction::CommitWithParallelValidate() { auto txn_db_impl = static_cast_with_check(txn_db_); assert(txn_db_impl); - DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); + DBImpl* db_impl = static_cast_with_check(db_->GetRootDB()); assert(db_impl); const size_t space = txn_db_impl->GetLockBucketsSize(); std::set lk_idxes; @@ -168,7 +168,7 @@ Status OptimisticTransaction::TryLock(ColumnFamilyHandle* column_family, Status OptimisticTransaction::CheckTransactionForConflicts(DB* db) { Status result; - auto db_impl = static_cast_with_check(db); + auto db_impl = static_cast_with_check(db); // Since we are on the write thread and do not want to block other writers, // we will do a cache-only conflict check. This can result in TryAgain diff --git a/utilities/transactions/pessimistic_transaction.cc b/utilities/transactions/pessimistic_transaction.cc index b9ca2bb7b..722e6321d 100644 --- a/utilities/transactions/pessimistic_transaction.cc +++ b/utilities/transactions/pessimistic_transaction.cc @@ -48,9 +48,8 @@ PessimisticTransaction::PessimisticTransaction( deadlock_detect_(false), deadlock_detect_depth_(0), skip_concurrency_control_(false) { - txn_db_impl_ = - static_cast_with_check(txn_db); - db_impl_ = static_cast_with_check(db_); + txn_db_impl_ = static_cast_with_check(txn_db); + db_impl_ = static_cast_with_check(db_); if (init) { Initialize(txn_options); } diff --git a/utilities/transactions/pessimistic_transaction_db.cc b/utilities/transactions/pessimistic_transaction_db.cc index 30d5b79f6..f68ec94ad 100644 --- a/utilities/transactions/pessimistic_transaction_db.cc +++ b/utilities/transactions/pessimistic_transaction_db.cc @@ -29,7 +29,7 @@ namespace ROCKSDB_NAMESPACE { PessimisticTransactionDB::PessimisticTransactionDB( DB* db, const TransactionDBOptions& txn_db_options) : TransactionDB(db), - db_impl_(static_cast_with_check(db)), + db_impl_(static_cast_with_check(db)), txn_db_options_(txn_db_options), lock_mgr_(this, txn_db_options_.num_stripes, txn_db_options.max_num_locks, txn_db_options_.max_num_deadlocks, @@ -60,7 +60,7 @@ PessimisticTransactionDB::PessimisticTransactionDB( PessimisticTransactionDB::PessimisticTransactionDB( StackableDB* db, const TransactionDBOptions& txn_db_options) : TransactionDB(db), - db_impl_(static_cast_with_check(db->GetRootDB())), + db_impl_(static_cast_with_check(db->GetRootDB())), txn_db_options_(txn_db_options), lock_mgr_(this, txn_db_options_.num_stripes, txn_db_options.max_num_locks, txn_db_options_.max_num_deadlocks, @@ -113,7 +113,7 @@ Status PessimisticTransactionDB::Initialize( Status s = EnableAutoCompaction(compaction_enabled_cf_handles); // create 'real' transactions from recovered shell transactions - auto dbimpl = static_cast_with_check(GetRootDB()); + auto dbimpl = static_cast_with_check(GetRootDB()); assert(dbimpl != nullptr); auto rtrxs = dbimpl->recovered_transactions(); @@ -569,8 +569,7 @@ bool PessimisticTransactionDB::TryStealingExpiredTransactionLocks( void PessimisticTransactionDB::ReinitializeTransaction( Transaction* txn, const WriteOptions& write_options, const TransactionOptions& txn_options) { - auto txn_impl = - static_cast_with_check(txn); + auto txn_impl = static_cast_with_check(txn); txn_impl->Reinitialize(this, write_options, txn_options); } diff --git a/utilities/transactions/pessimistic_transaction_db.h b/utilities/transactions/pessimistic_transaction_db.h index 39346dddd..144458b53 100644 --- a/utilities/transactions/pessimistic_transaction_db.h +++ b/utilities/transactions/pessimistic_transaction_db.h @@ -75,8 +75,7 @@ class PessimisticTransactionDB : public TransactionDB { Transaction* txn = BeginInternalTransaction(opts); txn->DisableIndexing(); - auto txn_impl = - static_cast_with_check(txn); + auto txn_impl = static_cast_with_check(txn); // Since commitBatch sorts the keys before locking, concurrent Write() // operations will not cause a deadlock. diff --git a/utilities/transactions/transaction_base.cc b/utilities/transactions/transaction_base.cc index 805d4ab36..32fb714aa 100644 --- a/utilities/transactions/transaction_base.cc +++ b/utilities/transactions/transaction_base.cc @@ -22,7 +22,7 @@ namespace ROCKSDB_NAMESPACE { TransactionBaseImpl::TransactionBaseImpl(DB* db, const WriteOptions& write_options) : db_(db), - dbimpl_(static_cast_with_check(db)), + dbimpl_(static_cast_with_check(db)), write_options_(write_options), cmp_(GetColumnFamilyUserComparator(db->DefaultColumnFamily())), start_time_(db_->GetEnv()->NowMicros()), diff --git a/utilities/transactions/transaction_lock_mgr.cc b/utilities/transactions/transaction_lock_mgr.cc index 2302edb88..64fe00aba 100644 --- a/utilities/transactions/transaction_lock_mgr.cc +++ b/utilities/transactions/transaction_lock_mgr.cc @@ -166,8 +166,7 @@ TransactionLockMgr::TransactionLockMgr( dlock_buffer_(max_num_deadlocks), mutex_factory_(mutex_factory) { assert(txn_db); - txn_db_impl_ = - static_cast_with_check(txn_db); + txn_db_impl_ = static_cast_with_check(txn_db); } TransactionLockMgr::~TransactionLockMgr() {} diff --git a/utilities/transactions/write_prepared_txn.cc b/utilities/transactions/write_prepared_txn.cc index 216d83555..de9b4f91c 100644 --- a/utilities/transactions/write_prepared_txn.cc +++ b/utilities/transactions/write_prepared_txn.cc @@ -430,8 +430,7 @@ Status WritePreparedTxn::ValidateSnapshot(ColumnFamilyHandle* column_family, assert(snapshot_); SequenceNumber min_uncommitted = - static_cast_with_check( - snapshot_.get()) + static_cast_with_check(snapshot_.get()) ->min_uncommitted_; SequenceNumber snap_seq = snapshot_->GetSequenceNumber(); // tracked_at_seq is either max or the last snapshot with which this key was diff --git a/utilities/transactions/write_prepared_txn_db.cc b/utilities/transactions/write_prepared_txn_db.cc index 051fae554..76341d58b 100644 --- a/utilities/transactions/write_prepared_txn_db.cc +++ b/utilities/transactions/write_prepared_txn_db.cc @@ -30,7 +30,7 @@ namespace ROCKSDB_NAMESPACE { Status WritePreparedTxnDB::Initialize( const std::vector& compaction_enabled_cf_indices, const std::vector& handles) { - auto dbimpl = static_cast_with_check(GetRootDB()); + auto dbimpl = static_cast_with_check(GetRootDB()); assert(dbimpl != nullptr); auto rtxns = dbimpl->recovered_transactions(); std::map ordered_seq_cnt; @@ -328,8 +328,7 @@ Iterator* WritePreparedTxnDB::NewIterator(const ReadOptions& options, if (options.snapshot != nullptr) { snapshot_seq = options.snapshot->GetSequenceNumber(); min_uncommitted = - static_cast_with_check( - options.snapshot) + static_cast_with_check(options.snapshot) ->min_uncommitted_; } else { auto* snapshot = GetSnapshot(); @@ -337,8 +336,7 @@ Iterator* WritePreparedTxnDB::NewIterator(const ReadOptions& options, // are not deleted. snapshot_seq = snapshot->GetSequenceNumber(); min_uncommitted = - static_cast_with_check(snapshot) - ->min_uncommitted_; + static_cast_with_check(snapshot)->min_uncommitted_; own_snapshot = std::make_shared(db_impl_, snapshot); } assert(snapshot_seq != kMaxSequenceNumber); @@ -363,9 +361,9 @@ Status WritePreparedTxnDB::NewIterators( SequenceNumber min_uncommitted = 0; if (options.snapshot != nullptr) { snapshot_seq = options.snapshot->GetSequenceNumber(); - min_uncommitted = static_cast_with_check( - options.snapshot) - ->min_uncommitted_; + min_uncommitted = + static_cast_with_check(options.snapshot) + ->min_uncommitted_; } else { auto* snapshot = GetSnapshot(); // We take a snapshot to make sure that the related data in the commit map @@ -373,8 +371,7 @@ Status WritePreparedTxnDB::NewIterators( snapshot_seq = snapshot->GetSequenceNumber(); own_snapshot = std::make_shared(db_impl_, snapshot); min_uncommitted = - static_cast_with_check(snapshot) - ->min_uncommitted_; + static_cast_with_check(snapshot)->min_uncommitted_; } iterators->clear(); iterators->reserve(column_families.size()); diff --git a/utilities/transactions/write_prepared_txn_db.h b/utilities/transactions/write_prepared_txn_db.h index 812c50b9a..7245330ea 100644 --- a/utilities/transactions/write_prepared_txn_db.h +++ b/utilities/transactions/write_prepared_txn_db.h @@ -1078,10 +1078,9 @@ SnapshotBackup WritePreparedTxnDB::AssignMinMaxSeqs(const Snapshot* snapshot, SequenceNumber* min, SequenceNumber* max) { if (snapshot != nullptr) { - *min = static_cast_with_check(snapshot) - ->min_uncommitted_; - *max = static_cast_with_check(snapshot) - ->number_; + *min = + static_cast_with_check(snapshot)->min_uncommitted_; + *max = static_cast_with_check(snapshot)->number_; return kBackedByDBSnapshot; } else { *min = SmallestUnCommittedSeq(); diff --git a/utilities/transactions/write_unprepared_txn.cc b/utilities/transactions/write_unprepared_txn.cc index 6f28c2fce..0f9993dca 100644 --- a/utilities/transactions/write_unprepared_txn.cc +++ b/utilities/transactions/write_unprepared_txn.cc @@ -847,8 +847,7 @@ Status WriteUnpreparedTxn::RollbackToSavePointInternal() { ReadOptions roptions; roptions.snapshot = top.snapshot_->snapshot(); SequenceNumber min_uncommitted = - static_cast_with_check( - roptions.snapshot) + static_cast_with_check(roptions.snapshot) ->min_uncommitted_; SequenceNumber snap_seq = roptions.snapshot->GetSequenceNumber(); WriteUnpreparedTxnReadCallback callback(wupt_db_, snap_seq, min_uncommitted, @@ -976,8 +975,7 @@ Status WriteUnpreparedTxn::ValidateSnapshot(ColumnFamilyHandle* column_family, assert(snapshot_); SequenceNumber min_uncommitted = - static_cast_with_check( - snapshot_.get()) + static_cast_with_check(snapshot_.get()) ->min_uncommitted_; SequenceNumber snap_seq = snapshot_->GetSequenceNumber(); // tracked_at_seq is either max or the last snapshot with which this key was diff --git a/utilities/transactions/write_unprepared_txn_db.cc b/utilities/transactions/write_unprepared_txn_db.cc index ca365d044..ee3db6a00 100644 --- a/utilities/transactions/write_unprepared_txn_db.cc +++ b/utilities/transactions/write_unprepared_txn_db.cc @@ -193,7 +193,7 @@ Status WriteUnpreparedTxnDB::Initialize( const std::vector& compaction_enabled_cf_indices, const std::vector& handles) { // TODO(lth): Reduce code duplication in this function. - auto dbimpl = static_cast_with_check(GetRootDB()); + auto dbimpl = static_cast_with_check(GetRootDB()); assert(dbimpl != nullptr); db_impl_->SetSnapshotChecker(new WritePreparedSnapshotChecker(this)); @@ -268,8 +268,7 @@ Status WriteUnpreparedTxnDB::Initialize( Transaction* real_trx = BeginTransaction(w_options, t_options, nullptr); assert(real_trx); - auto wupt = - static_cast_with_check(real_trx); + auto wupt = static_cast_with_check(real_trx); wupt->recovered_txn_ = true; real_trx->SetLogNumber(first_log_number); @@ -451,8 +450,7 @@ Iterator* WriteUnpreparedTxnDB::NewIterator(const ReadOptions& options, return nullptr; } min_uncommitted = - static_cast_with_check(snapshot) - ->min_uncommitted_; + static_cast_with_check(snapshot)->min_uncommitted_; auto* cfd = reinterpret_cast(column_family)->cfd(); auto* state = diff --git a/utilities/write_batch_with_index/write_batch_with_index.cc b/utilities/write_batch_with_index/write_batch_with_index.cc index 675e9752d..b64c470af 100644 --- a/utilities/write_batch_with_index/write_batch_with_index.cc +++ b/utilities/write_batch_with_index/write_batch_with_index.cc @@ -846,8 +846,7 @@ Status WriteBatchWithIndex::GetFromBatchAndDB( Status s; MergeContext merge_context; const ImmutableDBOptions& immuable_db_options = - static_cast_with_check(db->GetRootDB()) - ->immutable_db_options(); + static_cast_with_check(db->GetRootDB())->immutable_db_options(); // Since the lifetime of the WriteBatch is the same as that of the transaction // we cannot pin it as otherwise the returned value will not be available @@ -887,7 +886,7 @@ Status WriteBatchWithIndex::GetFromBatchAndDB( get_impl_options.column_family = column_family; get_impl_options.value = pinnable_val; get_impl_options.callback = callback; - s = static_cast_with_check(db->GetRootDB()) + s = static_cast_with_check(db->GetRootDB()) ->GetImpl(read_options, key, get_impl_options); } @@ -938,8 +937,7 @@ void WriteBatchWithIndex::MultiGetFromBatchAndDB( const size_t num_keys, const Slice* keys, PinnableSlice* values, Status* statuses, bool sorted_input, ReadCallback* callback) { const ImmutableDBOptions& immuable_db_options = - static_cast_with_check(db->GetRootDB()) - ->immutable_db_options(); + static_cast_with_check(db->GetRootDB())->immutable_db_options(); autovector key_context; autovector sorted_keys; @@ -992,9 +990,9 @@ void WriteBatchWithIndex::MultiGetFromBatchAndDB( } // Did not find key in batch OR could not resolve Merges. Try DB. - static_cast_with_check(db->GetRootDB()) + static_cast_with_check(db->GetRootDB()) ->PrepareMultiGetKeys(key_context.size(), sorted_input, &sorted_keys); - static_cast_with_check(db->GetRootDB()) + static_cast_with_check(db->GetRootDB()) ->MultiGetWithCallback(read_options, column_family, callback, &sorted_keys);