From 9aa7d232d6decf1007efdf6bd210e36838caedbc Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 14 Aug 2024 22:46:54 +0200 Subject: [PATCH] test/raft/randomized_nemesis_test: clean up remaining index_t usage With implicit conversion of tagged integers to untagged ones going away, explicitly tag (or untag, as necessary) the operands of the following operations, in "test/raft/randomized_nemesis_test.cc": - addition of tagged and untagged (both should be tagged) - taking the minimum of an index difference and a container size (both should be untagged) Signed-off-by: Laszlo Ersek --- test/raft/randomized_nemesis_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/raft/randomized_nemesis_test.cc b/test/raft/randomized_nemesis_test.cc index 94d4823b84..4e903a4ec0 100644 --- a/test/raft/randomized_nemesis_test.cc +++ b/test/raft/randomized_nemesis_test.cc @@ -907,7 +907,7 @@ class persistence { if (b == _stored_entries.end() || (*b)->idx >= idx) { return b; } - return b + std::min(size_t(idx - (*b)->idx), _stored_entries.size()); + return b + std::min(size_t((idx - (*b)->idx).value()), _stored_entries.size()); } public: @@ -935,7 +935,7 @@ public: void store_snapshot(const raft::snapshot_descriptor& snap, State snap_data, size_t preserve_log_entries) { // The snapshot's index cannot be smaller than the index of the first stored entry minus one; // that would create a ``gap'' in the log. - SCYLLA_ASSERT(_stored_entries.empty() || snap.idx + 1 >= _stored_entries.front()->idx); + SCYLLA_ASSERT(_stored_entries.empty() || snap.idx + raft::index_t{1} >= _stored_entries.front()->idx); _stored_snapshot = {snap, std::move(snap_data)}; @@ -966,14 +966,14 @@ public: // The raft server is supposed to provide entries in strictly increasing order, // hence the following assertions. if (_stored_entries.empty()) { - SCYLLA_ASSERT(entries.front()->idx == _stored_snapshot.first.idx + 1); + SCYLLA_ASSERT(entries.front()->idx == _stored_snapshot.first.idx + raft::index_t{1}); } else { - SCYLLA_ASSERT(entries.front()->idx == _stored_entries.back()->idx + 1); + SCYLLA_ASSERT(entries.front()->idx == _stored_entries.back()->idx + raft::index_t{1}); } _stored_entries.push_back(entries[0]); for (size_t i = 1; i < entries.size(); ++i) { - SCYLLA_ASSERT(entries[i]->idx == entries[i-1]->idx + 1); + SCYLLA_ASSERT(entries[i]->idx == entries[i-1]->idx + raft::index_t{1}); _stored_entries.push_back(entries[i]); } }