Skip to content

Commit b3a8deb

Browse files
committed
Fixes flaky persistant storage lock test
The persistant storage test was deemed flaky because of occasional `XAmzContentSHA256Mismatch` errors. This was beause of a faulty multiprocessing sharing of an s3 library. So we reconstruct the `Library` object in each process. Also upgrades the aws-sdk-cpp (a red herring lead to upgrading the sdk but didn't fix the issue). Still it's a good change so keeping it.
1 parent a097b2c commit b3a8deb

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

cpp/vcpkg

Submodule vcpkg updated 1686 files

cpp/vcpkg.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
},
4040
{
4141
"name": "aws-crt-cpp",
42-
"version>=": "0.28.3"
42+
"version>=": "0.29.7"
43+
},
44+
{
45+
"name": "aws-c-mqtt",
46+
"version>=": "0.11.0"
4347
},
4448
{
4549
"name": "aws-c-s3",
@@ -104,7 +108,7 @@
104108
],
105109
"overrides": [
106110
{ "name": "openssl", "version-string": "3.3.0" },
107-
{ "name": "aws-sdk-cpp", "version": "1.11.405" },
111+
{ "name": "aws-sdk-cpp", "version": "1.11.474" },
108112
{ "name": "azure-core-cpp", "version": "1.12.0" },
109113
{ "name": "benchmark", "version": "1.9.0" },
110114
{ "name": "bitmagic", "version": "7.12.3" },

python/tests/integration/arcticdb/test_storage_lock.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55

66
from arcticdb_ext.tools import ReliableStorageLock, ReliableStorageLockManager
7-
from tests.util.mark import PERSISTENT_STORAGE_TESTS_ENABLED, REAL_S3_TESTS_MARK
7+
from tests.util.mark import REAL_S3_TESTS_MARK
88

99
import time
1010

@@ -15,7 +15,13 @@
1515
one_sec = 1_000_000_000
1616

1717

18-
def slow_increment_task(lib, symbol, sleep_time, lock_manager, lock):
18+
def slow_increment_task(real_s3_storage_factory, lib_name, symbol, sleep_time):
19+
# We need to explicitly build the library object in each process, otherwise the s3 library doesn't get copied
20+
# properly between processes, and we get spurious `XAmzContentSHA256Mismatch` errors.
21+
fixture = real_s3_storage_factory.create_fixture()
22+
lib = fixture.create_arctic()[lib_name]
23+
lock = ReliableStorageLock("test_lock", lib._nvs._library, 10 * one_sec)
24+
lock_manager = ReliableStorageLockManager()
1925
lock_manager.take_lock_guard(lock)
2026
df = lib.read(symbol).data
2127
df["col"][0] = df["col"][0] + 1
@@ -24,20 +30,18 @@ def slow_increment_task(lib, symbol, sleep_time, lock_manager, lock):
2430
lock_manager.free_lock_guard()
2531

2632

27-
@pytest.mark.skip(reason="This test is flaky, skip it temporarily")
2833
@pytest.mark.parametrize("num_processes,max_sleep", [(100, 1), (5, 20)])
2934
@REAL_S3_TESTS_MARK
30-
def test_many_increments(real_s3_version_store, num_processes, max_sleep):
31-
lib = real_s3_version_store
35+
def test_many_increments(real_s3_storage_factory, lib_name, num_processes, max_sleep):
36+
fixture = real_s3_storage_factory.create_fixture()
37+
lib = fixture.create_arctic().create_library(lib_name)
3238
init_df = pd.DataFrame({"col": [0]})
3339
symbol = "counter"
34-
lib.version_store.force_delete_symbol(symbol)
40+
lib._nvs.version_store.force_delete_symbol(symbol)
3541
lib.write(symbol, init_df)
36-
lock = ReliableStorageLock("test_lock", lib._library, 10 * one_sec)
37-
lock_manager = ReliableStorageLockManager()
3842

3943
processes = [
40-
Process(target=slow_increment_task, args=(lib, symbol, 0 if i % 2 == 0 else max_sleep, lock_manager, lock))
44+
Process(target=slow_increment_task, args=(real_s3_storage_factory, lib_name, symbol, 0 if i % 2 == 0 else max_sleep))
4145
for i in range(num_processes)
4246
]
4347
for p in processes:

0 commit comments

Comments
 (0)