Skip to content

Commit 128f741

Browse files
committed
Merge remote-tracking branch 'upstream/main' into easier_access_to_shard_awareness_api
Conflicts: scylla/src/transport/session.rs
2 parents a651fed + 4efc84d commit 128f741

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2587
-767
lines changed

.github/workflows/authenticate_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ jobs:
2222
- 9042:9042
2323
options: --health-cmd "cqlsh --username cassandra --password cassandra --debug" --health-interval 5s --health-retries 30
2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626
- name: Run tests
2727
run: cargo test --verbose authenticate_superuser -- custom_authentication --ignored

.github/workflows/book.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- 9042:9042
2323
options: --health-cmd "cqlsh --debug" --health-interval 5s --health-retries 10
2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626
- name: Install mdbook
2727
run: cargo install mdbook --no-default-features
2828
- name: Build the project

.github/workflows/cassandra.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 60
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
- name: Setup 3-node Cassandra cluster
2121
run: |
22-
docker-compose -f test/cluster/cassandra/docker-compose.yml up -d
22+
docker compose -f test/cluster/cassandra/docker-compose.yml up -d --wait
2323
# A separate step for building to separate measuring time of compilation and testing
2424
- name: Build the project
2525
run: cargo build --verbose --tests
@@ -28,9 +28,9 @@ jobs:
2828
CDC='disabled' SCYLLA_URI=172.42.0.2:9042 SCYLLA_URI2=172.42.0.3:9042 SCYLLA_URI3=172.42.0.4:9042 cargo test --verbose -- --skip test_views_in_schema_info
2929
- name: Stop the cluster
3030
if: ${{ always() }}
31-
run: docker-compose -f test/cluster/cassandra/docker-compose.yml stop
31+
run: docker compose -f test/cluster/cassandra/docker-compose.yml stop
3232
- name: Print the cluster logs
3333
if: ${{ always() }}
34-
run: docker-compose -f test/cluster/cassandra/docker-compose.yml logs
34+
run: docker compose -f test/cluster/cassandra/docker-compose.yml logs
3535
- name: Remove cluster
36-
run: docker-compose -f test/cluster/cassandra/docker-compose.yml down
36+
run: docker compose -f test/cluster/cassandra/docker-compose.yml down

.github/workflows/rust.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
timeout-minutes: 60
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Setup 3-node Scylla cluster
2222
run: |
2323
sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"
24-
docker-compose -f test/cluster/docker-compose.yml up -d
24+
docker compose -f test/cluster/docker-compose.yml up -d --wait
2525
- name: Format check
2626
run: cargo fmt --verbose --all -- --check
2727
- name: Clippy check
@@ -38,23 +38,22 @@ jobs:
3838
run: SCYLLA_URI=172.42.0.2:9042 SCYLLA_URI2=172.42.0.3:9042 SCYLLA_URI3=172.42.0.4:9042 cargo test --verbose
3939
- name: Stop the cluster
4040
if: ${{ always() }}
41-
run: docker-compose -f test/cluster/docker-compose.yml stop
41+
run: docker compose -f test/cluster/docker-compose.yml stop
4242
- name: Print the cluster logs
4343
if: ${{ always() }}
44-
run: docker-compose -f test/cluster/docker-compose.yml logs
44+
run: docker compose -f test/cluster/docker-compose.yml logs
4545
- name: Remove cluster
46-
run: docker-compose -f test/cluster/docker-compose.yml down
46+
run: docker compose -f test/cluster/docker-compose.yml down
4747

4848
# Tests that our current minimum supported rust version compiles everything sucessfully
4949
min_rust:
5050
runs-on: ubuntu-latest
5151
steps:
52-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v3
5353
- name: Install Rust ${{ env.rust_min }}
54-
uses: actions-rs/toolchain@v1
55-
with:
56-
toolchain: ${{ env.rust_min }}
57-
override: true
54+
run: |
55+
rustup install ${{ env.rust_min }}
56+
rustup override set ${{ env.rust_min }}
5857
- name: Print Rust version
5958
run: rustc --version
6059
- name: MSRV cargo check with features
@@ -68,6 +67,6 @@ jobs:
6867
cargo_docs:
6968
runs-on: ubuntu-latest
7069
steps:
71-
- uses: actions/checkout@v2
70+
- uses: actions/checkout@v3
7271
- name: Compile docs
7372
run: RUSTDOCFLAGS=-Dwarnings cargo doc

.github/workflows/serverless.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-20.04
1818
timeout-minutes: 60
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Install scylla-ccm
2222
run: pip3 install https://github.com/scylladb/scylla-ccm/archive/master.zip
2323

.github/workflows/tls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
working-directory: ./scylla
2929
steps:
30-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
3131
- name: Check
3232
run: cargo check --verbose --features "ssl"
3333
working-directory: ${{env.working-directory}}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Currently, we require new PRs to compile without warnings, pass `cargo fmt` and
3131
## Testing
3232

3333
A 3-node ScyllaDB cluster is required to run the tests.
34-
The simplest way to set it up locally is to use a `docker-compose`.
35-
Fortunately there is no need to invoke `docker-compose` manually, everything can be handled by our `Makefile`.
34+
The simplest way to set it up locally is to use a `docker compose`.
35+
Fortunately there is no need to invoke `docker compose` manually, everything can be handled by our `Makefile`.
3636

37-
To run a cargo test suite, use the command below (note that you must have docker and docker-compose installed):
37+
To run a cargo test suite, use the command below (note that you must have Docker and Docker Compose V2 installed):
3838
```bash
3939
make test
4040
```

Makefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
COMPOSE := docker-compose -f test/cluster/docker-compose.yml
1+
COMPOSE := docker compose -f test/cluster/docker-compose.yml
22

33
.PHONY: all
44
all: test
@@ -30,14 +30,14 @@ clippy:
3030
RUSTFLAGS=-Dwarnings cargo clippy --examples --tests -- -Aclippy::uninlined_format_args
3131

3232
.PHONY: test
33-
test: up wait-for-cluster
33+
test: up
3434
SCYLLA_URI=172.42.0.2:9042 \
3535
SCYLLA_URI2=172.42.0.3:9042 \
3636
SCYLLA_URI3=172.42.0.4:9042 \
3737
cargo test
3838

3939
.PHONY: dockerized-test
40-
dockerized-test: up wait-for-cluster
40+
dockerized-test: up
4141
test/dockerized/run.sh
4242

4343
.PHONY: build
@@ -50,7 +50,7 @@ docs:
5050

5151
.PHONY: up
5252
up:
53-
$(COMPOSE) up -d
53+
$(COMPOSE) up -d --wait
5454
@echo
5555
@echo "ScyllaDB cluster is running in the background. Use 'make down' to stop it."
5656
@echo
@@ -75,7 +75,3 @@ shell:
7575
clean: down
7676
cargo clean
7777
rm -rf docs/book
78-
79-
.PHONY: wait-for-cluster
80-
wait-for-cluster:
81-
@test/cluster/wait.sh

docs/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "sphinx-docs"
33
description = "ScyllaDB Documentation"
4-
version = "0.8.2"
4+
version = "0.9.0"
55
authors = ["ScyllaDB Documentation Contributors"]
66

77
[tool.poetry.dependencies]

docs/source/load-balancing/default-policy.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ for queries with non-local consistency mode is also supported.
1010
`builder()` method of `DefaultPolicy` returns a new instance of
1111
`DefaultPolicyBuilder` with the following default values:
1212

13-
- `preferred_datacenter`: `None`
14-
- `preferred_rack`: `None`
13+
- `preferences`: no particular datacenter/rack preference
1514
- `is_token_aware`: `true`
1615
- `permit_dc_failover`: `false`
1716
- `latency_awareness`: `None`
@@ -25,8 +24,7 @@ You can use the builder methods to configure the desired settings and create a
2524
use scylla::load_balancing::DefaultPolicy;
2625

2726
let default_policy = DefaultPolicy::builder()
28-
.prefer_datacenter("dc1".to_string())
29-
.prefer_rack("rack1".to_string())
27+
.prefer_datacenter_and_rack("dc1".to_string(), "rack1".to_string())
3028
.token_aware(true)
3129
.permit_dc_failover(true)
3230
.build();
@@ -35,36 +33,40 @@ let default_policy = DefaultPolicy::builder()
3533

3634
### Semantics of `DefaultPolicy`
3735

38-
#### Preferred Datacenter
36+
#### Preferences
37+
38+
The `preferences` field in `DefaultPolicy` allows the load balancing
39+
policy to prioritize nodes based on their location. It has three modes:
40+
41+
- no preference
42+
- preferred datacenter
43+
- preferred datacenter and rack
3944

40-
The `preferred_datacenter` field in `DefaultPolicy` allows the load balancing
41-
policy to prioritize nodes based on their location. When a preferred datacenter
42-
is set, the policy will treat nodes in that datacenter as "local" nodes, and
43-
nodes in other datacenters as "remote" nodes. This affects the order in which
44-
nodes are returned by the policy when selecting replicas for read or write
45-
operations. If no preferred datacenter is specified, the policy will treat all
46-
nodes as local nodes.
45+
When a datacenter `"my_dc"` is preferred, the policy will treat nodes in `"my_dc"`
46+
as "local" nodes, and nodes in other datacenters as "remote" nodes. This affects
47+
the order in which nodes are returned by the policy when selecting nodes for
48+
read or write operations. If no datacenter is preferred, the policy will treat
49+
all nodes as local nodes.
50+
51+
`preferences` allow the load balancing policy to prioritize nodes based on their
52+
availability zones (racks) in the preferred datacenter, too. When a datacenter
53+
and a rack are preferred, the policy will first return replicas in the local rack
54+
in the preferred datacenter, and then the other replicas in the datacenter
55+
(followed by remote replicas). After replicas, the other node will be ordered
56+
similarly, too (local rack nodes, local datacenter nodes, remote nodes).
4757

4858
When datacenter failover is disabled (`permit_dc_failover` is set to
4959
false), the default policy will only include local nodes in load balancing
5060
plans. Remote nodes will be excluded, even if they are alive and available to
5161
serve requests.
5262

53-
#### Preferred Rack
54-
55-
The `preferred_rack` field in `DefaultPolicy` allows the load balancing policy to
56-
prioritize nodes based on their availability zones in the preferred datacenter.
57-
When a preferred rack is set, the policy will first return replicas in the local rack
58-
in the preferred datacenter, and then the other replicas in the datacenter.
59-
When a preferred datacenter is not set, setting preferred rack will not have any effect.
60-
6163
#### Datacenter Failover
6264

6365
In the event of a datacenter outage or network failure, the nodes in that
6466
datacenter may become unavailable, and clients may no longer be able to access
65-
the data stored on those nodes. To address this, the `DefaultPolicy` supports datacenter
66-
failover, which allows to route requests to nodes in other datacenters if the
67-
local nodes are unavailable.
67+
the data stored on those nodes. To address this, the `DefaultPolicy` supports
68+
datacenter failover, which allows to route requests to nodes in other datacenters
69+
if the local nodes are unavailable.
6870

6971
Datacenter failover can be enabled in `DefaultPolicy` by `permit_dc_failover`
7072
setting in the builder. When this flag is set, the policy will prefer to return

0 commit comments

Comments
 (0)