Skip to content

Commit

Permalink
Revert "ENG-4577: Log Replay Count Bugfix and Test #782"
Browse files Browse the repository at this point in the history
This reverts commit d563e504ee2769851e3f52f20ff803181fec47ce.
  • Loading branch information
harshithdepa committed Mar 5, 2019
1 parent a9ed639 commit efa5ff7
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 69 deletions.
41 changes: 0 additions & 41 deletions src/yb/client/ql-stress-test.cc
Expand Up @@ -39,7 +39,6 @@
DECLARE_double(respond_write_failed_probability);
DECLARE_bool(detect_duplicates_for_retryable_requests);
DECLARE_int32(raft_heartbeat_interval_ms);
DECLARE_bool(flush_rocksdb_on_shutdown);

using namespace std::literals;

Expand Down Expand Up @@ -482,45 +481,5 @@ TEST_F_EX(QLStressTest, FlushCompact, QLStressTestSingleTablet) {
ASSERT_GE(num_iter, 5);
}

TEST_F_EX(QLStressTest, LogReplayAfterCompaction, QLStressTestSingleTablet) {
SetAtomicFlag(false, &FLAGS_flush_rocksdb_on_shutdown);
auto session = NewSession();
int num_writes = 1000;
for (int j = 0; j < num_writes; ++j) {
ASSERT_OK(WriteRow(session, j, "value" + std::to_string(j)));
}
vector<OpId> op_ids;
ASSERT_OK(cluster_->FlushTablets(tablet::FlushMode::kSync));
ASSERT_NO_FATALS(VerifyFlushedFrontiers());
for (const auto& mini_tserver : cluster_->mini_tablet_servers()) {
auto peers = mini_tserver->server()->tablet_manager()->GetTabletPeers();
for (const auto &peer : peers) {
rocksdb::DB *db = peer->tablet()->TEST_db();
OpId op_id;
ASSERT_NO_FATALS(VerifyFlushedFrontier(db->GetFlushedFrontier(), &op_id));
op_ids.push_back(op_id);
}
}
ASSERT_OK(cluster_->CompactTablets());
int num_unflushed_writes = 2000;
for (int j = 100; j < 100+num_unflushed_writes; ++j) {
ASSERT_OK(WriteRow(session, j, "value" + std::to_string(j)));
}
ASSERT_OK(cluster_->RestartSync());
int i = 0;
for (const auto& mini_tserver : cluster_->mini_tablet_servers()) {
auto peers = mini_tserver->server()->tablet_manager()->GetTabletPeers();
for (const auto &peer : peers) {
rocksdb::DB *db = peer->tablet()->TEST_db();
OpId op_id;
ASSERT_NO_FATALS(VerifyFlushedFrontier(db->GetFlushedFrontier(), &op_id));
ASSERT_EQ(op_id, op_ids[i]);
i++;
}
ASSERT_WITHIN_INCLUSIVE(num_unflushed_writes - 5, num_unflushed_writes + 5,
mini_tserver->server()->tablet_manager()->num_replayed());
}
}

} // namespace client
} // namespace yb
3 changes: 0 additions & 3 deletions src/yb/consensus/consensus.h
Expand Up @@ -109,9 +109,6 @@ struct ConsensusBootstrapInfo {
// These are owned by the ConsensusBootstrapInfo instance.
ReplicateMsgs orphaned_replicates;

// The number of of WAL log records that tablet bootstrap replayed.
int64_t num_log_records_replayed;

private:
DISALLOW_COPY_AND_ASSIGN(ConsensusBootstrapInfo);
};
Expand Down
4 changes: 0 additions & 4 deletions src/yb/tablet/tablet.h
Expand Up @@ -463,10 +463,6 @@ class Tablet : public AbstractTablet, public TransactionIntentApplier {
return *ql_storage_;
}

bool HasIntentsDB() {
return intents_db_ != nullptr;
}

// Used from tests
const std::shared_ptr<rocksdb::Statistics>& rocksdb_statistics() const {
return rocksdb_statistics_;
Expand Down
10 changes: 2 additions & 8 deletions src/yb/tablet/tablet_bootstrap.cc
Expand Up @@ -603,13 +603,8 @@ Status TabletBootstrap::HandleReplicateMessage(
// Append the replicate message to the log as is
RETURN_NOT_OK(log_->Append(replicate_entry_ptr->get(), entry_time));

int64_t min_index;
if (tablet_->HasIntentsDB()) {
min_index = std::min(
state->regular_stored_op_id.index(), state->intents_stored_op_id.index());
} else {
min_index = state->regular_stored_op_id.index();
}
auto min_index = std::min(
state->regular_stored_op_id.index(), state->intents_stored_op_id.index());
if (op_id.index() <= min_index) {
// Do not update the bootstrap in-memory state for log records that have already been applied to
// RocksDB, or were overwritten by a later entry with a higher term that has already been
Expand Down Expand Up @@ -884,7 +879,6 @@ Status TabletBootstrap::PlaySegments(ConsensusBootstrapInfo* consensus_info) {
tablet_->mvcc_manager()->SetLastReplicated(state.max_committed_hybrid_time);
consensus_info->last_id = state.prev_op_id;
consensus_info->last_committed_id = state.committed_op_id;
consensus_info->num_log_records_replayed = state.num_entries_applied_to_rocksdb;

if (data_.retryable_requests) {
data_.retryable_requests->Clock().Adjust(last_entry_time);
Expand Down
2 changes: 0 additions & 2 deletions src/yb/tserver/ts_tablet_manager.cc
Expand Up @@ -1001,8 +1001,6 @@ void TSTabletManager::OpenTablet(const scoped_refptr<TabletMetadata>& meta,
tablet_peer->RegisterMaintenanceOps(server_->maintenance_manager());
}

num_log_records_replayed_during_bootstrap = bootstrap_info.num_log_records_replayed;

int elapsed_ms = MonoTime::Now().GetDeltaSince(start).ToMilliseconds();
if (elapsed_ms > FLAGS_tablet_start_warn_threshold_ms) {
LOG(WARNING) << kLogPrefix << "Tablet startup took " << elapsed_ms << "ms";
Expand Down
5 changes: 0 additions & 5 deletions src/yb/tserver/ts_tablet_manager.h
Expand Up @@ -154,8 +154,6 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
ThreadPool* read_pool() const { return read_pool_.get(); }
ThreadPool* append_pool() const { return append_pool_.get(); }

int64_t num_replayed() const { return num_log_records_replayed_during_bootstrap; }

// Create a new tablet and register it with the tablet manager. The new tablet
// is persisted on disk and opened before this method returns.
//
Expand Down Expand Up @@ -437,9 +435,6 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
// Next tablet report seqno.
int32_t next_report_seq_;

// Number of log recors replayed during tablet bootstrap
int64_t num_log_records_replayed_during_bootstrap = 0;

MetricRegistry* metric_registry_;

TSTabletManagerStatePB state_;
Expand Down
6 changes: 0 additions & 6 deletions src/yb/util/test_macros.h
Expand Up @@ -63,12 +63,6 @@
} \
} while (0)

#define ASSERT_WITHIN_INCLUSIVE(lower, upper, val) \
do { \
ASSERT_GE(val, lower); \
ASSERT_LE(val, upper); \
} while (0)

#define ASSERT_NOK(s) ASSERT_FALSE((s).ok())

#define ASSERT_OK_PREPEND(status, msg) do { \
Expand Down

0 comments on commit efa5ff7

Please sign in to comment.