Skip to content

Commit

Permalink
8.0.2 (#214)
Browse files Browse the repository at this point in the history
* fix: high concurrency replica failover
* fix: potential mocks race condition
  • Loading branch information
aembke authored Feb 12, 2024
1 parent 93d96e0 commit 74b5721
Show file tree
Hide file tree
Showing 18 changed files with 594 additions and 87 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.0.2

* Fix cluster replica failover at high concurrency.
* Fix potential race condition initializing the mocking layer.

## 8.0.1

* Add a shorthand `init` interface.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fred"
version = "8.0.1"
version = "8.0.2"
authors = ["Alec Embke <[email protected]>"]
edition = "2021"
description = "An async Redis client built on Tokio."
Expand Down
25 changes: 25 additions & 0 deletions bin/replica_consistency/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "replica_consistency"
version = "0.1.0"
authors = ["Alec Embke <[email protected]>"]
edition = "2018"

[profile.release]
debug = true

[dependencies]
clap = { version = "2.33", features = ["yaml"] }
log = "0.4"
pretty_env_logger = "0.5"
tokio = { version = "1", features = ["full"] }
futures = "0.3"
rand = "0.8"

[dependencies.fred]
#path = "../.."
path = "/fred"
default-features = false
features = ["network-logs", "debug-ids", "replicas", "custom-reconnect-errors"]

[features]
default = []
26 changes: 26 additions & 0 deletions bin/replica_consistency/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```
Run a script that tests cluster consistency.
USAGE:
replica_consistency [FLAGS] [OPTIONS]
FLAGS:
--help Prints help information
-V, --version Prints version information
--wait Whether to send `WAIT 1 10` after each `SET` operation
OPTIONS:
-a, --auth <STRING> An optional authentication key or password. [default: ]
-c, --concurrency <NUMBER> The number of concurrent set-get commands to set each `interval`. [default: 500]
-h, --host <STRING> The hostname of the redis server. [default: 127.0.0.1]
-i, --interval <NUMBER> The time to wait between commands in milliseconds. [default: 500]
-P, --pool <NUMBER> The number of clients in the redis connection pool. [default: 1]
-p, --port <NUMBER> The port for the redis server. [default: 6379]
```

```
cd path/to/fred
source ./tests/environ
cd bin/replica_consistency
RUST_LOG=replica_consistency=info,fred=debug ./run.sh -a bar -h redis-cluster-1 -p 30001 -P 6 -i 500 -c 500
```
51 changes: 51 additions & 0 deletions bin/replica_consistency/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: replica_consistency
version: "1.0"
author: Alec Embke
about: Run a script that tests cluster consistency.
args:
- wait:
long: wait
help: Whether to send `WAIT 1 10` after each `SET` operation
takes_value: false
- host:
short: h
long: host
value_name: "STRING"
help: The hostname of the redis server.
takes_value: true
default_value: "127.0.0.1"
- auth:
short: a
long: auth
value_name: "STRING"
help: An optional authentication key or password.
takes_value: true
default_value: ""
- port:
short: p
long: port
value_name: "NUMBER"
help: The port for the redis server.
takes_value: true
default_value: "6379"
- pool:
short: P
long: pool
value_name: "NUMBER"
help: The number of clients in the redis connection pool.
takes_value: true
default_value: "1"
- interval:
short: i
long: interval
value_name: "NUMBER"
help: The time to wait between commands in milliseconds.
takes_value: true
default_value: "500"
- concurrency:
short: c
long: concurrency
value_name: "NUMBER"
help: The number of concurrent set-get commands to set each `interval`.
takes_value: true
default_value: "500"
24 changes: 24 additions & 0 deletions bin/replica_consistency/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '2'

services:
replica_consistency:
depends_on:
- redis-main
- redis-cluster-6
container_name: "replica_consistency"
build:
context: ../../../
dockerfile: tests/docker/runners/images/base.dockerfile
args:
REDIS_VERSION: "${REDIS_VERSION}"
networks:
- fred-tests
entrypoint: "cargo run --release -- ${TEST_ARGV}"
environment:
RUST_LOG: "${RUST_LOG}"
REDIS_VERSION: "${REDIS_VERSION}"
RUST_BACKTRACE: "full"
volumes:
- "../../../bin/replica_consistency:/project"
- "../../..:/fred"
- "~/.cargo/registry:/usr/local/cargo/registry"
7 changes: 7 additions & 0 deletions bin/replica_consistency/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

TEST_ARGV="$@" docker-compose \
-f ../../tests/docker/compose/cluster.yml \
-f ../../tests/docker/compose/centralized.yml \
-f ./docker-compose.yml \
run -u $(id -u ${USER}):$(id -g ${USER}) --rm replica_consistency
52 changes: 52 additions & 0 deletions bin/replica_consistency/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
edition = "2021"
binop_separator = "Front"
blank_lines_upper_bound = 1
brace_style = "SameLineWhere"
combine_control_expr = true
comment_width = 125
condense_wildcard_suffixes = false
control_brace_style = "AlwaysSameLine"
empty_item_single_line = true
error_on_line_overflow = false
enum_discrim_align_threshold = 0
error_on_unformatted = false
fn_params_layout = "Tall"
fn_single_line = false
force_explicit_abi = true
force_multiline_blocks = false
format_code_in_doc_comments = true
format_macro_matchers = true
format_macro_bodies = true
format_strings = true
hard_tabs = false
hide_parse_errors = false
imports_indent = "Block"
imports_layout = "HorizontalVertical"
indent_style = "Block"
inline_attribute_width = 0
match_arm_blocks = true
match_block_trailing_comma = true
max_width = 118
merge_derives = true
imports_granularity="Crate"
newline_style = "Auto"
normalize_comments = true
normalize_doc_attributes = true
overflow_delimited_expr = true
remove_nested_parens = true
reorder_impl_items = true
reorder_imports = true
reorder_modules = true
space_after_colon = true
space_before_colon = false
spaces_around_ranges = true
struct_field_align_threshold = 50
struct_lit_single_line = true
tab_spaces = 2
trailing_semicolon = true
type_punctuation_density = "Wide"
use_field_init_shorthand = true
use_small_heuristics = "Default"
use_try_shorthand = true
where_single_line = false
wrap_comments = true
Loading

0 comments on commit 74b5721

Please sign in to comment.