Skip to content

Commit 545c0ee

Browse files
committed
Unrelated stability issue fix
1 parent b91aeb1 commit 545c0ee

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

bftengine/src/bftengine/DbCheckpointManager.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,15 @@ Status DbCheckpointManager::createDbCheckpoint(const CheckpointId& checkPointId,
5454
}
5555
auto end_ckpnt = Clock::now();
5656
auto duration_chpnt_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_ckpnt - start);
57-
LOG_INFO(getLogger(), "just checkpoint duation: " << KVLOG(duration_chpnt_ms.count()));
57+
LOG_INFO(getLogger(), "just checkpoint duration: " << KVLOG(duration_chpnt_ms.count()));
5858
prepareCheckpointCb_(lastBlockId, dbClient_->getPathForCheckpoint(checkPointId));
5959
auto end = Clock::now();
6060

6161
auto duration_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
62-
LOG_INFO(getLogger(), "checkpoint with cb duation: " << KVLOG(duration_ms.count()));
62+
LOG_INFO(getLogger(), "checkpoint with cb duration: " << KVLOG(duration_ms.count()));
6363
lastDbCheckpointBlockId_.Get().Set(lastBlockId);
64-
numOfDbCheckpointsCreated_++;
6564
auto maxSoFar = maxDbCheckpointCreationTimeMsec_.Get().Get();
6665
maxDbCheckpointCreationTimeMsec_.Get().Set(std::max(maxSoFar, static_cast<uint64_t>(duration_ms.count())));
67-
auto count = numOfDbCheckpointsCreated_.Get().Get();
68-
(void)count;
69-
metrics_.UpdateAggregator();
7066
LOG_INFO(getLogger(), "rocksdb checkpoint created: " << KVLOG(checkPointId, duration_ms.count(), seqNum));
7167
lastCheckpointSeqNum_ = seqNum;
7268
{
@@ -84,6 +80,8 @@ Status DbCheckpointManager::createDbCheckpoint(const CheckpointId& checkPointId,
8480
if (cb) cb(seqNum);
8581
}
8682
checkpointInProcessCb_(false, lastBlockId);
83+
numOfDbCheckpointsCreated_++;
84+
metrics_.UpdateAggregator();
8785
}
8886
updateMetrics();
8987
return Status::OK();

tests/apollo/test_skvbc_dbsnapshot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,14 +993,14 @@ async def verify_db_size_on_disk(self, bft_network):
993993
for checkPtId,db_size in res[0].response.mapCheckpointIdDbSize:
994994
db_dir = os.path.join(
995995
bft_network.testdir, DB_FILE_PREFIX + str(replica_id))
996-
if checkPtId != 0 :
996+
if checkPtId != 0:
997997
db_dir = os.path.join(
998998
bft_network.testdir, DB_SNAPSHOT_PREFIX + str(replica_id) + "/" + str(checkPtId))
999999
size = 0
10001000
for element in os.scandir(db_dir):
10011001
if element.is_file():
10021002
size += os.path.getsize(element)
1003-
assert size == db_size
1003+
assert size == db_size, f"replica: {replica_id}, expected_size:{db_size}, actual_size: {size}"
10041004

10051005
async def validate_epoch_number(self, bft_network, epoch_number, replicas):
10061006
with trio.fail_after(seconds=70):

tests/apollo/test_skvbc_view_change.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from util.test_base import ApolloTest
2121
from util import bft_network_partitioning as net
2222
from util import skvbc as kvbc
23-
from util.bft import with_trio, with_bft_network, KEY_FILE_PREFIX, skip_for_tls
23+
from util.bft import with_trio, with_bft_network, KEY_FILE_PREFIX, skip_for_tls, ConsensusPathType
2424
from util.skvbc_history_tracker import verify_linearizability
2525
from util import eliot_logging as log
2626

@@ -442,6 +442,8 @@ async def test_multiple_vc_slow_path(self, bft_network, tracker):
442442
c = bft_network.config.c
443443
current_primary = 0
444444
view = 0
445+
messages_to_send = 5
446+
accumulated_slow_paths = 0
445447
for _ in range(2):
446448
self.assertEqual(len(bft_network.procs), n,
447449
"Make sure all replicas are up initially.")
@@ -465,10 +467,11 @@ async def test_multiple_vc_slow_path(self, bft_network, tracker):
465467
await bft_network.wait_for_view_with_threshold(view)
466468
current_primary = view
467469

468-
# Main key publications on startup might have been executed in fast path
469-
await bft_network.assert_slow_path_prevalent(
470-
nb_fast_paths_to_ignore=n, nb_slow_paths_to_ignore=0,
471-
replica_id=random.choice(bft_network.all_replicas(without=crashed_replicas)))
470+
accumulated_slow_paths += messages_to_send
471+
await bft_network.wait_for_consensus_path(path_type=ConsensusPathType.SLOW,
472+
replica_id=current_primary,
473+
run_ops=lambda: skvbc.send_n_kvs_sequentially(messages_to_send),
474+
threshold=accumulated_slow_paths)
472475

473476
for i in crashed_replicas:
474477
bft_network.start_replica(i)

0 commit comments

Comments
 (0)