aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index 14ef2a15d..5cc4dad54 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -1794,7 +1794,9 @@ TEST_CASE("compactcas.restart")
Hashes.reserve(kChunkCount);
auto ValidateChunks = [&](CasContainerStrategy& Cas, std::span<const IoHash> Hashes, bool ShouldExist) {
- std::vector<bool> Exists(Hashes.size(), false);
+ // It's important to not use std::vector<bool> here as that is not safe to use from multiple threads
+ // due to its non-atomic updates using bit masking
+ std::vector<uint8_t> Exists(Hashes.size(), false);
Cas.IterateChunks(
Hashes,
[&](size_t Index, const IoBuffer& Buffer) -> bool {
@@ -1816,7 +1818,8 @@ TEST_CASE("compactcas.restart")
},
&ThreadPool,
1u * 1248u);
- CHECK_EQ(std::find(Exists.begin(), Exists.end(), !ShouldExist), Exists.end());
+
+ CHECK_EQ(std::find(Exists.begin(), Exists.end(), !ShouldExist ? 1 : 0), Exists.end());
};
{