From e8d9dfedad0b019055322091d211a8305ba6ffa5 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Sun, 16 Jun 2024 20:40:31 +0200 Subject: [PATCH] test/librados_test_stub: unbreak selfmanaged_snap_rollback() After the rollback assert in TestGroup.add_snapshot{,PP} was made meaningful in the previous commit, it fails in mock tests which means that rollback has never been exercised properly... While I confess to not following file->snap_id == CEPH_NOSNAP branch especially given how file variable is shadowed, it's pretty clear that get_snap_read() doesn't belong here -- the snapshot selected for reads has nothing to do with rollback. Replacing it with the rollback snap ID makes sense of the other branches and makes the tests in question pass. Signed-off-by: Ilya Dryomov (cherry picked from commit 91a06323549c3c68aa56e79fec21d6a7dcb62cc9) --- src/test/librados_test_stub/TestMemIoCtxImpl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc index 77ea14366cd09..248fd5b8febcc 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc @@ -479,7 +479,7 @@ int TestMemIoCtxImpl::selfmanaged_snap_rollback(const std::string& oid, for (TestMemCluster::FileSnapshots::reverse_iterator it = snaps.rbegin(); it != snaps.rend(); ++it) { TestMemCluster::SharedFile file = *it; - if (file->snap_id < get_snap_read()) { + if (file->snap_id < snapid) { if (versions == 0) { // already at the snapshot version return 0; -- 2.39.5