From 7a4626c69f02b14654c4a7c1156f8dc79c2b6758 Mon Sep 17 00:00:00 2001 From: Vincent Lohse Date: Tue, 5 Nov 2024 10:58:42 +0000 Subject: [PATCH 1/4] Added test for parallel SET commands of large values --- pink/rondis/tests/get_set.sh | 45 ++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/pink/rondis/tests/get_set.sh b/pink/rondis/tests/get_set.sh index d5586c4c..2dbfa208 100755 --- a/pink/rondis/tests/get_set.sh +++ b/pink/rondis/tests/get_set.sh @@ -6,11 +6,10 @@ set -e KEY_SUFFIX=${1:-0} KEY="test_key_$KEY_SUFFIX" -# Function to set a value and retrieve it, then verify if it matches -function set_and_get() { +function check_set() { local key="$1" local value="$2" - + # SET the value in Redis if [[ -f "$value" ]]; then set_output=$(redis-cli --pipe <&2 exit 1 fi +} + +# Function to set a value and retrieve it, then verify if it matches +function set_and_get() { + local key="$1" + local value="$2" + check_set "$key" "$value" + # GET the value local result=$(redis-cli GET "$key") @@ -37,9 +44,9 @@ EOF if [[ "$expected_hash" == "$actual_hash" ]]; then echo "PASS: $key with value length ${#value}" else - echo "FAIL: $key with value length ${#value}; got length ${#result}" - echo "Expected hash: $expected_hash" - echo "Received hash: $actual_hash" + echo "FAIL: $key with value length ${#value}; got length ${#result}" >&2 + echo "Expected hash: $expected_hash" >&2 + echo "Received hash: $actual_hash" >&2 exit 1 fi echo @@ -101,4 +108,28 @@ done # edge_value=$(head -c 100000 < /dev/zero | tr '\0' 'b') # set_and_get "$KEY:edge_large" "$edge_value" +# Create multi-value rows in parallel +run_client() { + local client="$1" + local key="$2" + NUM_ITERATIONS=10 + for ((i=1; i<=$NUM_ITERATIONS; i++)); do + # Generate a unique key for each client and iteration + local test_value=$(generate_random_chars 32000) + check_set "$key" "$test_value" > /dev/null + echo "PASS ($i/$NUM_ITERATIONS): client $client with key $key" + done +} + +echo "Testing multi-value rows in parallel..." +for ((client=1; client<=5; client++)); do + run_client $client "${KEY}:parallel_key" & + pids[$client]=$! +done + +for pid in ${pids[*]}; do + wait $pid +done +echo "PASS: All parallel clients completed." + echo "All tests completed." From 0454cb058986f5bad8d394c552d5136f6909871a Mon Sep 17 00:00:00 2001 From: Vincent Lohse Date: Tue, 5 Nov 2024 11:12:08 +0000 Subject: [PATCH 2/4] Show Rondis logs *at the end* --- .github/workflows/build_test_push.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test_push.yaml b/.github/workflows/build_test_push.yaml index 76a250a5..fd343198 100644 --- a/.github/workflows/build_test_push.yaml +++ b/.github/workflows/build_test_push.yaml @@ -102,9 +102,9 @@ jobs: echo "Success in run $i" done + - name: Run Redis benchmark + run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set -c 2" + - name: Show Rondis logs if: always() run: cat $LOCAL_RONDIS_LOG - - - name: Run Redis benchmark - run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set -c 2" From 6f16526f6f438ce2a204954e8e2c9b79d1885f2f Mon Sep 17 00:00:00 2001 From: Vincent Lohse Date: Tue, 5 Nov 2024 11:20:49 +0000 Subject: [PATCH 3/4] Run less tests and vary key-space more --- .github/workflows/build_test_push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_push.yaml b/.github/workflows/build_test_push.yaml index fd343198..57f1409a 100644 --- a/.github/workflows/build_test_push.yaml +++ b/.github/workflows/build_test_push.yaml @@ -96,9 +96,9 @@ jobs: # Running this multiple times to check for memory leaks and that overwrites/updates/deletes work - name: Run tests multiple times run: | - for i in {1..100}; do + for i in {1..50}; do docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \ - "pink/rondis/tests/get_set.sh $((i % 2))" + "pink/rondis/tests/get_set.sh $((i % 3))" echo "Success in run $i" done From 1f3c932301bdd27de695736efdadcc40f119ee83 Mon Sep 17 00:00:00 2001 From: Vincent Lohse Date: Tue, 5 Nov 2024 11:21:48 +0000 Subject: [PATCH 4/4] Run less iterations for parallel clients --- pink/rondis/tests/get_set.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pink/rondis/tests/get_set.sh b/pink/rondis/tests/get_set.sh index 2dbfa208..f61edeca 100755 --- a/pink/rondis/tests/get_set.sh +++ b/pink/rondis/tests/get_set.sh @@ -112,7 +112,7 @@ done run_client() { local client="$1" local key="$2" - NUM_ITERATIONS=10 + NUM_ITERATIONS=5 for ((i=1; i<=$NUM_ITERATIONS; i++)); do # Generate a unique key for each client and iteration local test_value=$(generate_random_chars 32000)