-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: high concurrency replica failover * fix: potential mocks race condition
- Loading branch information
Showing
18 changed files
with
594 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.