diff --git a/docs/de/operations.md b/docs/de/operations.md index 99af609..2ff6cd4 100644 --- a/docs/de/operations.md +++ b/docs/de/operations.md @@ -67,7 +67,9 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ### `bench` -Siehe [Tests und Benches](./testing.md#metadb-ctl-bench). Das ist ein Client gegen einen laufenden Server. Es ist kein Cargo-Bench-Ziel. Das Repository zeichnet dafür keine Durchsatzzahl auf. +See [Tests and benches](./testing.md#metadb-ctl-bench). Remote `hotspot-create` and `bulk-ttl-delete` are a client against a running server. They print JSON with `attempted`, `succeeded`, and `failed`, and the process exits non-zero unless `succeeded` equals `--ops`. `--embedded` and `--workload mixed` run the [in-process stress harness](./testing.md#in-process-stress-harness) instead of dialing the endpoint. That path passes when `errors` and `correctness_errors` are both zero, and it prints latency percentiles in microseconds. Neither path is a Cargo benchmark target. The repository does not check in a throughput number for either path. A printed line is not a service-level result and is not the official 1,000,000-create profile. + +The separate prefix-load harness (100 prefixes × 10,000 creates, then 100,000 `SetAttr` overwrites, then 100,000 deletes, concurrency 64) is documented in [Tests and benches](../en/testing.md#prefix-load). GitHub Actions runs only the small profile. It does not run the 1,000,000-create profile. ## Metriken @@ -105,7 +107,7 @@ Was als Betriebsverfahren nicht funktioniert: 3. `metadb-ctl cell register` erzeugt keine zweite Zelle. `open_and_serve` registriert nur die lokale Zelle beim Global Manager. 4. Der Speicherpfad `MetaDbEngine::new_single_node`, den die Tests `T1`–`T6` nutzen, kann eine Wählerzahl im Speicher auf 3 setzen. Dieses Objekt hat weder Platte noch Raft. Es ist keine Skalierung von `metadbd`. -[Offener Pull Request 2](https://github.com/rustfs/MetaDB/pull/2) (nicht zusammengeführt) zieht dieselbe Grenze: Sein verteilter Test ruft `DurableCellManager::scale_out_replicas` mit drei localhost-Raft-Wählern in einem Betriebssystemprozess auf. Er startet keine drei `metadbd`-Prozesse. Disaggregierte Rollen und eine zweite Zelle werden dort ebenfalls nicht als lebende Einsätze getestet. Die Jumbo-Isolation auf einem gewidmeten Knoten bleibt in diesem Pull Request das Verhalten des Speichersimulators. +`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. The shared-secret case in that file opens two clusters inside the test process; it does not start two `metadbd` OS processes. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. ## Fehler, die auftreten können @@ -131,11 +133,11 @@ Die Varianten sind in `crates/metadb-core/src/error.rs` definiert. gRPC-Methoden ## Bekannte Grenzen -- Ein Betriebssystemprozess, nur Rolle `all-in-one`. +- Role `all-in-one` only. `be`, `proxy`, `cell-manager`, and `global-manager` are rejected before listen. - Ein zweiter all-in-one-Prozess kann mit `[cluster] join` derselben Zelle beitreten. Das erzeugt keine zweite Zelle. `RegisterCell` liefert einen Fehler. - `GetRoutes` scheitert geschlossen bei einer unbekannten `cell_id` ungleich null. `StoreHeartbeat` ersetzt zwischengespeicherte Routen nicht. - Jumbo-Isolation ist ein Routenflag plus eine Knotenkennung aus der lokalen Knotentabelle. Sie verdrängt andere Shards nicht von einer Platte. -- Heartbeats sind ein RPC ohne Sender in `metadbd`. `StoreHeartbeat` speichert nicht dauerhaft. +- Registered-node liveness is fsynced in `CELL_CONTROL_PLANE`. `metadbd` persists its own record about every 3 seconds and sends it to the current leader when this process is not the leader. Descriptors on that RPC are annotations, not routes. The observation does not schedule placement. See [Scale control plane](../en/scale-control-plane-status.md). - A secret that contains a non-whitespace character authenticates Raft, the other three gRPC services, and the metrics listener, including `/livez`, `/readyz`, and `/healthz`, with the same bearer. An empty secret does not start the process. `allow_unauthenticated = true` is the explicit exception for literal loopback IPs (`127.0.0.0/8` or `::1`) and still refuses a wildcard bind. The hostname `localhost` is not accepted for that exception. The bound socket is checked again after listen. A whitespace-only secret is rejected and is not compared as a bearer. A usable secret combined with the flag is rejected. The process does not terminate TLS. - `memtable_size_bytes` versiegelt die aktive Memtable und schreibt sie aus. `max_imm_memtables` begrenzt die eingereihten unveränderlichen Tabellen. `[raft]` timers and `max_segment_bytes` apply when a group starts. They are not reloaded from a changed file, and the segment size does not rewrite segments already on disk. - `metadb-ctl bench` für `hotspot-create` und `bulk-ttl-delete` druckt JSON-Zeilen: einen Kopf mit `bench_pid`, dann Phasenberichte mit attempted, succeeded, failed und Latenzperzentilen. Der Prozess endet mit einem Fehler, wenn nicht jede angeforderte Operation gelingt. `--workload mixed` oder `--embedded` startet den prozessinternen Stress-Harness. `sql` druckt die Antwort als JSON und endet bei einem Anwendungsfehler mit einem Fehlerstatus. @@ -145,9 +147,8 @@ Die Varianten sind in `crates/metadb-core/src/error.rs` definiert. gRPC-Methoden Diese Punkte fehlen im Produkt, daher kann dieser Leitfaden kein Verfahren dafür beschreiben: 1. Eine Mehrprozess-Anordnung für `be`, `proxy`, `cell-manager` und `global-manager`. -2. Einen zweiten und dritten `metadbd`-Betriebssystemprozess einer bestehenden Raft-Gruppe hinzufügen. -3. Eine zweite Zelle anlegen und dorthin routen. -4. Einen Jumbo-Shard auf eine eigene Maschine legen und andere Shards von dieser Maschine wegziehen. -5. Natives TLS. Dieser Prozess beendet TLS nicht. Konfigurationsschlüssel, die TLS oder ein Zertifikat verlangen, werden abgelehnt, statt Klartext zu dienen. Die Terminierung gehört in einen externen Proxy. Raft und Metriken nutzen denselben Bearer wie die anderen Dienste, wenn ein Geheimnis gesetzt ist; das ist kein gegenseitiges TLS. Eine heartbeat-getriebene Steuerschleife ist nicht implementiert. -6. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). -7. Ein eingechecktes Ergebnis auf Dienstebene für `metadb-ctl bench`. Der Befehl druckt Zahlen für die Maschine, auf der man ihn ausführt. Dieses Repository zeichnet keine auf. Der nicht zusammengeführte Pull Request 2 berichtet einen eigenen eingebetteten Harness; diese Befehle sind nicht in diesem Baum. Siehe [Tests und Benches](./testing.md). +2. A second Cell. `RegisterCell` stays an error. Join reaches only the current leader; a follower does not forward it. +3. Einen Jumbo-Shard auf eine eigene Maschine legen und andere Shards von dieser Maschine wegziehen. +4. Natives TLS. Dieser Prozess beendet TLS nicht. Konfigurationsschlüssel, die TLS oder ein Zertifikat verlangen, werden abgelehnt, statt Klartext zu dienen. Die Terminierung gehört in einen externen Proxy. Raft und Metriken nutzen denselben Bearer wie die anderen Dienste, wenn ein Geheimnis gesetzt ist; das ist kein gegenseitiges TLS. Eine heartbeat-getriebene Steuerschleife ist nicht implementiert. +5. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded and is not `#[serde(skip)]`. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). +6. A checked-in service-level result for `metadb-ctl bench`. The command prints numbers for the machine you run it on. This repository does not record one. See [Tests and benches](./testing.md). diff --git a/docs/de/testing.md b/docs/de/testing.md index 21ae0c0..896c968 100644 --- a/docs/de/testing.md +++ b/docs/de/testing.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings cargo test --workspace ``` -`cargo test --workspace` baut die Bibliothek, die Integrationstests und beide Binärdateien. Es gibt kein `[[bench]]`-Ziel und kein Verzeichnis `benches/`. Der Lastgenerator, der in diesem Baum mitgeliefert wird, ist `metadb-ctl bench`, unten. +`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generators that ship in this tree are `metadb-ctl bench` and `cargo test -p metadb-server --test stress_harness`, below. Nützliche engere Befehle: @@ -31,6 +31,7 @@ cargo test -p metadb-proxy --test sql_templates_tests cargo test -p metadb-storage --test lsm_recovery_tests cargo test -p metadb-storage --test mvcc_snapshot_tests cargo test -p metadb-storage --test locality_compaction_tests +cargo test -p metadb-server --test stress_harness ``` ## Was jede Suite wirklich ausführt @@ -99,31 +100,61 @@ cargo run -p metadb-server --bin metadb-ctl -- \ bench --workload bulk-ttl-delete --concurrency 16 --ops 1000 ``` -Flags: `--workload` ist `hotspot-create` (die Vorgabe), `bulk-ttl-delete` oder `mixed`. `--concurrency` ist 16, wenn es fehlt. `--ops` ist Vorgabe 1000. `--embedded` oder `--workload mixed` startet einen temporären All-in-one-Knoten und den prozessinternen Stress-Harness, statt `--endpoint` zu wählen. +Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. For the remote workloads, omitted `--concurrency` is 16 and `--ops` defaults to 1000. `--profile` is read only when the command takes the embedded path. `--embedded` or `--workload mixed` does not dial `--endpoint` and does not use `--ops`. It starts a temporary all-in-one node and runs the in-process stress harness. See [In-process stress harness](#in-process-stress-harness). -Verhalten aus `crates/metadb-server/src/bin/metadb-ctl.rs` für die entfernten Workloads: +Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote workloads: -- Der Client belegt eine Verzeichnis-ID und dann Datei-Inode- und Datei-ID-Blöcke der Länge `--ops`. Eine Zuteilung mit falscher Anzahl oder Überlauf wird abgelehnt. -- Er druckt ein JSON-Objekt mit `bench_pid`, `workload` und `requested_ops` und legt danach so viele 4096-Byte-Dateien in einem neuen Verzeichnis an. -- Jede Phase druckt JSON mit `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind` und Latenzperzentilen. Der Prozess endet mit einem Fehler, wenn `succeeded` nicht `--ops` ist. -- `bulk-ttl-delete` entfernt die angelegten Namen und listet das Verzeichnis mit `limit = 1`. -- Ein zweiter Lauf belegt eine neue `bench_pid`. Abgewiesene Anlegen gelten nicht als Erfolg. +- The client allocates one directory id, then file-inode and file-id blocks of length `--ops`, and refuses a grant whose count or end overflows. +- It prints one JSON object with `bench_pid`, `workload`, and `requested_ops`, then creates that many 4096-byte files under a new directory. +- Each phase prints JSON with `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind`, and latency percentiles (`p50_ms`, `p99_ms`, `p999_ms`). The process exits non-zero unless `succeeded` equals `--ops`. +- `bulk-ttl-delete` unlinks the names that were created, then lists the directory with `limit = 1` and prints whether that page is empty. +- A second run allocates a new `bench_pid`. It does not reuse a fixed inode, and it does not report rejected creates as successes. -Eine Zahl aus diesem Befehl nicht als Repository-Ergebnis behandeln. Sie hängt von der Maschine, dem Build-Profil und dem angesprochenen Server ab. Dieser Baum zeichnet keine Stichprobe auf. +Do not treat a number from this command as a repository result. A remote run depends on the machine, the build profile, and the server you pointed at. An embedded run depends on the machine and the build profile. This tree does not record a sample of either. -## Offener Pull Request 2 +## In-process stress harness -[Pull Request 2](https://github.com/rustfs/MetaDB/pull/2) ist offen und nicht Teil dieses Zweigs. Er fügt dauerhafte Topologietests und einen eingebetteten Stress-Harness hinzu. Seine eigene Beschreibung sagt: +`crates/metadb-server/tests/stress_harness.rs` and `metadb-ctl bench --embedded` both call `metadb_server::stress` (`crates/metadb-server/src/stress.rs`). There is no third profile named `mixed`. `--workload mixed` selects this harness. Both profiles run the same mixed workload: create, lookup, dirstat, listdir, rename, and unlink against one persistent all-in-one node on a temporary data directory. After the timed loop the harness runs maintenance ticks, then checks directory listings, dirstat, and quota against the operations that succeeded. A failed maintenance tick adds one to `errors`, sets `correctness_errors` to 1, and skips that check. The run is one OS process and one data directory. It is not three `metadbd` processes, and it is not the [official prefix load](../en/testing.md#prefix-load). -- Der Einzelknoten-Test ruft `PersistentMetaDbCluster::open_and_serve` auf einem temporären Verzeichnis auf. -- Der Skalierungstest erzwingt einen PID-Grenz-Split in demselben Prozess. -- Der verteilte Test ist ein Prozess mit drei localhost-Raft-Wählern. Er ruft `DurableCellManager::scale_out_replicas` auf. Er startet keine drei `metadbd`-Betriebssystemprozesse. -- `open_and_serve` weist weiterhin jede Rolle außer `all-in-one` zurück. Disaggregierte Rollen und eine zweite Zelle bleiben unimplementiert. +| Profile | Test | Duration | Concurrency | Directories | When it runs | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `smoke` | `stress_smoke_mixed_workload` | 5 seconds | 4 | 4 | `cargo test -p metadb-server --test stress_harness`, including `cargo test --workspace`. Ignores `METADB_STRESS_*`. | +| `local` | `stress_local_mixed_workload` | 30 seconds unless overridden | 8 unless overridden | 16 unless overridden | `#[ignore]`. Not part of `cargo test --workspace`. Reads `METADB_STRESS_DURATION_SECS`, `METADB_STRESS_CONCURRENCY`, `METADB_STRESS_KEYSPACE`, and `METADB_STRESS_SEED`. | -Der Bericht dieses Pull Requests, auf der VM des Autors mit Rust 1.100.0 (die Hardware ist nicht genannt), enthält eine Smoke-Zeile aus dem Harness, den dieser Zweig nicht enthält: +```bash +cargo test -p metadb-server --test stress_harness stress_smoke -- --nocapture + +METADB_STRESS_DURATION_SECS=120 \ +METADB_STRESS_CONCURRENCY=16 \ +METADB_STRESS_KEYSPACE=32 \ +METADB_STRESS_SEED=7 \ + cargo test -p metadb-server --test stress_harness stress_local -- --ignored --nocapture + +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile smoke +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile local +``` + +`METADB_STRESS_*` applies to the local profile, including `metadb-ctl bench --embedded --profile local`. On `metadb-ctl bench --embedded`, `--duration-secs`, `--concurrency`, `--keyspace`, and `--seed` override whichever profile was selected, after the environment is read. The `cargo test` local profile has no flag overrides; it reads only those variables. A duration, concurrency, or directory count below 1 is raised to 1. `--profile` defaults to `smoke`. `--profile ci` is the same smoke profile. Any other `--profile` value exits with an error. The smoke profile does not read `METADB_STRESS_*`. Remote `hotspot-create` and `bulk-ttl-delete` ignore `--profile`. + +The test prints one line and requires `errors = 0`, `correctness_errors = 0`, and `ops > 0`. `metadb-ctl bench --embedded` prints `embedded metadbd listening on ` and the same line, and exits non-zero when `errors` or `correctness_errors` is greater than zero. The line fields are: ```text -metadb stress profile=smoke ops=12219 errors=0 correctness_errors=0 elapsed_ms=5221 ops_per_s=2340.3 latency_us p50=1318 p99=5207 max=12449 +metadb stress profile= ops= errors= correctness_errors= elapsed_ms= ops_per_s= latency_us p50= p99= max= ``` -Diese Zeile ist ein einzelner Lauf eines nicht zusammengeführten Tests. Sie ist kein Dienstziel und wird von `metadb-ctl bench` auf diesem Zweig nicht nachgestellt. Befehle wie `cargo test -p metadb-server --test topology_distributed` und `metadb-ctl bench --embedded` gibt es nur auf dem Zweig dieses Pull Requests. +`ops` counts only mixed-loop operations that succeeded. `ops_per_s` divides that count by the elapsed time. `errors` counts mixed-loop operations that did not succeed. A failed maintenance tick is also added to `errors`, and it sets `correctness_errors` to 1 instead of running the check. When the check runs, `correctness_errors` counts mismatched directory listings, dirstat, and quota, and it also counts failed verification calls (`dirstat`, `listdir`, and `get_quota`). `latency_us` `p50`, `p99`, and `max` are percentiles of every mixed-loop attempt, including failed attempts, in microseconds. They are not percentiles of `ops`. They are printed. This tree does not enforce a latency threshold. + +A line from either command is a result for the machine that printed it. This repository does not record that line. It is not a service-level result, not a first-ship pass, and not the official 1,000,000-create prefix load. + +## Persistent topology and join + +These commands are in this tree. CI runs them with `cargo test --workspace --locked`. + +- `cargo test -p metadb-server --test topology_single_node` opens `PersistentMetaDbCluster` on a temporary directory. +- `cargo test -p metadb-server --test topology_scale_out` forces a PID-boundary split in that process. +- `cargo test -p metadb-server --test topology_distributed` uses one process and `DurableCellManager::scale_out_replicas` for three localhost voters, including leader loss under create load. +- `cargo test -p metadb-server --test stress_crash_restart` stops without flushing the memtable while a create is inside `propose`, then reopens the same `data_dir`. +- `cargo test -p metadb-server --test join_existing_group` covers two different joins. `metadbd_processes_join_existing_group_and_fail_over` starts real `metadbd` processes, joins the first process's Raft group, and fails over. `join_sends_the_shared_secret` opens two `PersistentMetaDbCluster` servers inside the test process and checks that the shared secret is sent on that join. That case does not start two `metadbd` OS processes. +- `open_and_serve` still rejects every role except `all-in-one`. A second Cell stays unimplemented. `RegisterCell` returns an error. + +The smoke profile and the ignored local profile are the [in-process stress harness](#in-process-stress-harness). `topology_distributed` is still one OS process with three localhost Raft voters, not three `metadbd` processes. Disaggregated roles and a second Cell are still not live deployments. diff --git a/docs/en/operations.md b/docs/en/operations.md index 3d1bd7f..f7fb48c 100644 --- a/docs/en/operations.md +++ b/docs/en/operations.md @@ -67,7 +67,7 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ### `bench` -See [Tests and benches](./testing.md#metadb-ctl-bench). This is a client against a running server. It is not a Cargo benchmark target. The repository does not check in a throughput number for it. +See [Tests and benches](./testing.md#metadb-ctl-bench). Remote `hotspot-create` and `bulk-ttl-delete` are a client against a running server. They print JSON with `attempted`, `succeeded`, and `failed`, and the process exits non-zero unless `succeeded` equals `--ops`. `--embedded` and `--workload mixed` run the [in-process stress harness](./testing.md#in-process-stress-harness) instead of dialing the endpoint. That path passes when `errors` and `correctness_errors` are both zero, and it prints latency percentiles in microseconds. Neither path is a Cargo benchmark target. The repository does not check in a throughput number for either path. A printed line is not a service-level result and is not the official 1,000,000-create profile. The separate prefix-load harness (100 prefixes × 10,000 creates, then 100,000 `SetAttr` overwrites, then 100,000 deletes, concurrency 64) is documented in [Tests and benches](./testing.md#prefix-load). GitHub Actions runs only the small profile. It does not run the 1,000,000-create profile. @@ -123,7 +123,7 @@ What does not work as an operator procedure: 3. `metadb-ctl cell register` does not create a second cell. `RegisterCell` fails closed. `open_and_serve` registers only the local cell on the global manager. 4. The in-memory `MetaDbEngine::new_single_node` path used by tests `T1`–`T6` can bump an in-memory voter count to 3. That object has no disk and no Raft. It is not a scale-out of `metadbd`. -`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. +`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. The shared-secret case in that file opens two clusters inside the test process; it does not start two `metadbd` OS processes. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. ## Errors you can hit diff --git a/docs/en/testing.md b/docs/en/testing.md index f70f87b..097c062 100644 --- a/docs/en/testing.md +++ b/docs/en/testing.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings cargo test --workspace ``` -`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generator that ships in this tree is `metadb-ctl bench`, below. +`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generators that ship in this tree are `metadb-ctl bench` and `cargo test -p metadb-server --test stress_harness`, below. Useful narrower commands: @@ -33,6 +33,7 @@ cargo test -p metadb-storage --test mvcc_snapshot_tests cargo test -p metadb-storage --test locality_compaction_tests cargo test -p metadb-server --test auth_fail_closed cargo test -p metadb-server --test prefix_load +cargo test -p metadb-server --test stress_harness ``` ## What each suite actually exercises @@ -105,7 +106,7 @@ cargo run -p metadb-server --bin metadb-ctl -- \ bench --workload bulk-ttl-delete --concurrency 16 --ops 1000 ``` -Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. `--concurrency` defaults to 16 when omitted. `--ops` defaults to 1000. `--embedded` or `--workload mixed` starts a temporary all-in-one node and runs the in-process stress harness instead of dialing `--endpoint`. +Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. For the remote workloads, omitted `--concurrency` is 16 and `--ops` defaults to 1000. `--profile` is read only when the command takes the embedded path. `--embedded` or `--workload mixed` does not dial `--endpoint` and does not use `--ops`. It starts a temporary all-in-one node and runs the in-process stress harness. See [In-process stress harness](#in-process-stress-harness). Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote workloads: @@ -115,7 +116,41 @@ Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote worklo - `bulk-ttl-delete` unlinks the names that were created, then lists the directory with `limit = 1` and prints whether that page is empty. - A second run allocates a new `bench_pid`. It does not reuse a fixed inode, and it does not report rejected creates as successes. -Do not treat a number from this command as a repository result. It depends on the machine, the build profile, and the server you pointed at. This tree does not record a sample. +Do not treat a number from this command as a repository result. A remote run depends on the machine, the build profile, and the server you pointed at. An embedded run depends on the machine and the build profile. This tree does not record a sample of either. + +## In-process stress harness + +`crates/metadb-server/tests/stress_harness.rs` and `metadb-ctl bench --embedded` both call `metadb_server::stress` (`crates/metadb-server/src/stress.rs`). There is no third profile named `mixed`. `--workload mixed` selects this harness. Both profiles run the same mixed workload: create, lookup, dirstat, listdir, rename, and unlink against one persistent all-in-one node on a temporary data directory. After the timed loop the harness runs maintenance ticks, then checks directory listings, dirstat, and quota against the operations that succeeded. A failed maintenance tick adds one to `errors`, sets `correctness_errors` to 1, and skips that check. The run is one OS process and one data directory. It is not three `metadbd` processes, and it is not the [official prefix load](#prefix-load). + +| Profile | Test | Duration | Concurrency | Directories | When it runs | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `smoke` | `stress_smoke_mixed_workload` | 5 seconds | 4 | 4 | `cargo test -p metadb-server --test stress_harness`, including `cargo test --workspace`. Ignores `METADB_STRESS_*`. | +| `local` | `stress_local_mixed_workload` | 30 seconds unless overridden | 8 unless overridden | 16 unless overridden | `#[ignore]`. Not part of `cargo test --workspace`. Reads `METADB_STRESS_DURATION_SECS`, `METADB_STRESS_CONCURRENCY`, `METADB_STRESS_KEYSPACE`, and `METADB_STRESS_SEED`. | + +```bash +cargo test -p metadb-server --test stress_harness stress_smoke -- --nocapture + +METADB_STRESS_DURATION_SECS=120 \ +METADB_STRESS_CONCURRENCY=16 \ +METADB_STRESS_KEYSPACE=32 \ +METADB_STRESS_SEED=7 \ + cargo test -p metadb-server --test stress_harness stress_local -- --ignored --nocapture + +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile smoke +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile local +``` + +`METADB_STRESS_*` applies to the local profile, including `metadb-ctl bench --embedded --profile local`. On `metadb-ctl bench --embedded`, `--duration-secs`, `--concurrency`, `--keyspace`, and `--seed` override whichever profile was selected, after the environment is read. The `cargo test` local profile has no flag overrides; it reads only those variables. A duration, concurrency, or directory count below 1 is raised to 1. `--profile` defaults to `smoke`. `--profile ci` is the same smoke profile. Any other `--profile` value exits with an error. The smoke profile does not read `METADB_STRESS_*`. Remote `hotspot-create` and `bulk-ttl-delete` ignore `--profile`. + +The test prints one line and requires `errors = 0`, `correctness_errors = 0`, and `ops > 0`. `metadb-ctl bench --embedded` prints `embedded metadbd listening on ` and the same line, and exits non-zero when `errors` or `correctness_errors` is greater than zero. The line fields are: + +```text +metadb stress profile= ops= errors= correctness_errors= elapsed_ms= ops_per_s= latency_us p50= p99= max= +``` + +`ops` counts only mixed-loop operations that succeeded. `ops_per_s` divides that count by the elapsed time. `errors` counts mixed-loop operations that did not succeed. A failed maintenance tick is also added to `errors`, and it sets `correctness_errors` to 1 instead of running the check. When the check runs, `correctness_errors` counts mismatched directory listings, dirstat, and quota, and it also counts failed verification calls (`dirstat`, `listdir`, and `get_quota`). `latency_us` `p50`, `p99`, and `max` are percentiles of every mixed-loop attempt, including failed attempts, in microseconds. They are not percentiles of `ops`. They are printed. This tree does not enforce a latency threshold. + +A line from either command is a result for the machine that printed it. This repository does not record that line. It is not a service-level result, not a first-ship pass, and not the official 1,000,000-create prefix load. ## Fail-closed auth leftovers @@ -212,7 +247,7 @@ These commands are in this tree. CI runs them with `cargo test --workspace --loc - `cargo test -p metadb-server --test topology_scale_out` forces a PID-boundary split in that process. - `cargo test -p metadb-server --test topology_distributed` uses one process and `DurableCellManager::scale_out_replicas` for three localhost voters, including leader loss under create load. - `cargo test -p metadb-server --test stress_crash_restart` stops without flushing the memtable while a create is inside `propose`, then reopens the same `data_dir`. -- `cargo test -p metadb-server --test join_existing_group` starts a second `metadbd` and joins the first process's Raft group, including a shared-secret case. +- `cargo test -p metadb-server --test join_existing_group` covers two different joins. `metadbd_processes_join_existing_group_and_fail_over` starts real `metadbd` processes, joins the first process's Raft group, and fails over. `join_sends_the_shared_secret` opens two `PersistentMetaDbCluster` servers inside the test process and checks that the shared secret is sent on that join. That case does not start two `metadbd` OS processes. - `open_and_serve` still rejects every role except `all-in-one`. A second Cell stays unimplemented. `RegisterCell` returns an error. -`stress_smoke_mixed_workload` runs in that same workspace test. It prints one line for the machine that ran it. This repository does not check in a service-level target. Remote `metadb-ctl bench` records attempt counts and latency percentiles in JSON and fails the process when an application or transport error occurs. +The smoke profile and the ignored local profile are the [in-process stress harness](#in-process-stress-harness). `topology_distributed` is still one OS process with three localhost Raft voters, not three `metadbd` processes. Disaggregated roles and a second Cell are still not live deployments. diff --git a/docs/fr/operations.md b/docs/fr/operations.md index 3556a3a..d219fe2 100644 --- a/docs/fr/operations.md +++ b/docs/fr/operations.md @@ -67,7 +67,9 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ### `bench` -Voir [Tests et bancs](./testing.md#metadb-ctl-bench). C'est un client contre un serveur en cours d'exécution. Ce n'est pas une cible de banc Cargo. Le dépôt n'enregistre pas de nombre de débit pour cette commande. +See [Tests and benches](./testing.md#metadb-ctl-bench). Remote `hotspot-create` and `bulk-ttl-delete` are a client against a running server. They print JSON with `attempted`, `succeeded`, and `failed`, and the process exits non-zero unless `succeeded` equals `--ops`. `--embedded` and `--workload mixed` run the [in-process stress harness](./testing.md#in-process-stress-harness) instead of dialing the endpoint. That path passes when `errors` and `correctness_errors` are both zero, and it prints latency percentiles in microseconds. Neither path is a Cargo benchmark target. The repository does not check in a throughput number for either path. A printed line is not a service-level result and is not the official 1,000,000-create profile. + +The separate prefix-load harness (100 prefixes × 10,000 creates, then 100,000 `SetAttr` overwrites, then 100,000 deletes, concurrency 64) is documented in [Tests and benches](../en/testing.md#prefix-load). GitHub Actions runs only the small profile. It does not run the 1,000,000-create profile. ## Métriques @@ -105,7 +107,7 @@ Ce qui ne fonctionne pas comme procédure d'exploitation : 3. `metadb-ctl cell register` ne crée pas une seconde cellule. `open_and_serve` n'enregistre que la cellule locale sur le gestionnaire global. 4. Le chemin en mémoire `MetaDbEngine::new_single_node` utilisé par les tests `T1`–`T6` peut porter un compteur de votants en mémoire à 3. Cet objet n'a ni disque ni Raft. Ce n'est pas une montée en charge de `metadbd`. -La [pull request ouverte n° 2](https://github.com/rustfs/MetaDB/pull/2) (non fusionnée) énonce la même frontière : son test distribué appelle `DurableCellManager::scale_out_replicas` avec trois votants Raft sur localhost dans un seul processus du système d'exploitation. Il ne lance pas trois processus `metadbd`. Les rôles désagrégés et une seconde cellule n'y sont pas non plus testés comme déploiements vivants. L'isolation jumbo sur nœud dédié dans cette pull request reste le comportement du simulateur en mémoire. +`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. The shared-secret case in that file opens two clusters inside the test process; it does not start two `metadbd` OS processes. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. ## Erreurs que l'on peut rencontrer @@ -131,11 +133,11 @@ Les variantes sont définies dans `crates/metadb-core/src/error.rs`. Les méthod ## Limites connues -- Un seul processus du système d'exploitation, rôle `all-in-one` seulement. +- Role `all-in-one` only. `be`, `proxy`, `cell-manager`, and `global-manager` are rejected before listen. - Un second processus all-in-one peut rejoindre la même cellule avec `[cluster] join`. Cela ne crée pas une seconde cellule. `RegisterCell` renvoie une erreur. - `GetRoutes` échoue fermé pour un `cell_id` non nul inconnu. `StoreHeartbeat` ne remplace pas les routes en cache. - L'isolation jumbo est un indicateur de route plus un identifiant de nœud choisi dans la table locale. Elle n'évince pas d'autres shards d'un disque. -- Les battements de cœur sont un RPC sans émetteur dans `metadbd`. `StoreHeartbeat` ne persiste pas. +- Registered-node liveness is fsynced in `CELL_CONTROL_PLANE`. `metadbd` persists its own record about every 3 seconds and sends it to the current leader when this process is not the leader. Descriptors on that RPC are annotations, not routes. The observation does not schedule placement. See [Scale control plane](../en/scale-control-plane-status.md). - A secret that contains a non-whitespace character authenticates Raft, the other three gRPC services, and the metrics listener, including `/livez`, `/readyz`, and `/healthz`, with the same bearer. An empty secret does not start the process. `allow_unauthenticated = true` is the explicit exception for literal loopback IPs (`127.0.0.0/8` or `::1`) and still refuses a wildcard bind. The hostname `localhost` is not accepted for that exception. The bound socket is checked again after listen. A whitespace-only secret is rejected and is not compared as a bearer. A usable secret combined with the flag is rejected. The process does not terminate TLS. - `memtable_size_bytes` scelle et vide le memtable actif. `max_imm_memtables` limite les tables immuables en file. `[raft]` timers and `max_segment_bytes` apply when a group starts. They are not reloaded from a changed file, and the segment size does not rewrite segments already on disk. - `metadb-ctl bench` pour `hotspot-create` et `bulk-ttl-delete` imprime des lignes JSON : un en-tête avec `bench_pid`, puis des rapports de phase avec attempted, succeeded, failed et des percentiles de latence. Le processus se termine en erreur si une opération demandée échoue. `--workload mixed` ou `--embedded` lance le harnais de stress dans le processus. `sql` imprime la réponse en JSON et se termine en erreur sur une erreur d'application. @@ -145,9 +147,8 @@ Les variantes sont définies dans `crates/metadb-core/src/error.rs`. Les méthod Ces éléments manquent au produit, donc ce guide ne peut pas décrire de procédure pour eux : 1. Une disposition multi-processus pour `be`, `proxy`, `cell-manager` et `global-manager`. -2. L'ajout d'un second et d'un troisième processus `metadbd` du système d'exploitation à un groupe Raft existant. -3. La création et le routage vers une seconde cellule. -4. Le placement d'un shard jumbo sur sa propre machine et le déplacement des autres shards hors de cette machine. -5. Le TLS natif. Ce processus ne termine pas TLS. Les clés de configuration qui demandent TLS ou un certificat sont rejetées au lieu de servir en clair. Placer la terminaison dans un proxy externe. Raft et les métriques utilisent le même bearer que les autres services lorsqu'un secret est défini ; ce n'est pas du TLS mutuel. Une boucle de contrôle pilotée par les battements de cœur n'est pas implémentée. -6. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). -7. Un résultat de niveau service enregistré pour `metadb-ctl bench`. La commande imprime des nombres pour la machine sur laquelle on l'exécute. Ce dépôt n'en enregistre pas. La pull request non fusionnée n° 2 rapporte un harnais embarqué distinct ; ces commandes ne sont pas dans cet arbre. Voir [Tests et bancs](./testing.md). +2. A second Cell. `RegisterCell` stays an error. Join reaches only the current leader; a follower does not forward it. +3. Le placement d'un shard jumbo sur sa propre machine et le déplacement des autres shards hors de cette machine. +4. Le TLS natif. Ce processus ne termine pas TLS. Les clés de configuration qui demandent TLS ou un certificat sont rejetées au lieu de servir en clair. Placer la terminaison dans un proxy externe. Raft et les métriques utilisent le même bearer que les autres services lorsqu'un secret est défini ; ce n'est pas du TLS mutuel. Une boucle de contrôle pilotée par les battements de cœur n'est pas implémentée. +5. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded and is not `#[serde(skip)]`. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). +6. A checked-in service-level result for `metadb-ctl bench`. The command prints numbers for the machine you run it on. This repository does not record one. See [Tests and benches](./testing.md). diff --git a/docs/fr/testing.md b/docs/fr/testing.md index 83923bd..c72e31a 100644 --- a/docs/fr/testing.md +++ b/docs/fr/testing.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings cargo test --workspace ``` -`cargo test --workspace` construit la bibliothèque, les tests d'intégration et les deux binaires. Il n'y a pas de cible `[[bench]]` ni de répertoire `benches/`. Le générateur de charge livré dans cet arbre est `metadb-ctl bench`, ci-dessous. +`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generators that ship in this tree are `metadb-ctl bench` and `cargo test -p metadb-server --test stress_harness`, below. Commandes plus étroites utiles : @@ -31,6 +31,7 @@ cargo test -p metadb-proxy --test sql_templates_tests cargo test -p metadb-storage --test lsm_recovery_tests cargo test -p metadb-storage --test mvcc_snapshot_tests cargo test -p metadb-storage --test locality_compaction_tests +cargo test -p metadb-server --test stress_harness ``` ## Ce que chaque suite exerce réellement @@ -99,31 +100,61 @@ cargo run -p metadb-server --bin metadb-ctl -- \ bench --workload bulk-ttl-delete --concurrency 16 --ops 1000 ``` -Options : `--workload` vaut `hotspot-create` (le défaut), `bulk-ttl-delete` ou `mixed`. `--concurrency` vaut 16 s'il est omis. `--ops` vaut 1000 par défaut. `--embedded` ou `--workload mixed` démarre un nœud all-in-one temporaire et le harnais de stress dans le processus, au lieu d'appeler `--endpoint`. +Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. For the remote workloads, omitted `--concurrency` is 16 and `--ops` defaults to 1000. `--profile` is read only when the command takes the embedded path. `--embedded` or `--workload mixed` does not dial `--endpoint` and does not use `--ops`. It starts a temporary all-in-one node and runs the in-process stress harness. See [In-process stress harness](#in-process-stress-harness). -Comportement issu de `crates/metadb-server/src/bin/metadb-ctl.rs` pour les charges distantes : +Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote workloads: -- Le client alloue un identifiant de répertoire, puis des blocs d'inodes et d'identifiants de fichier de longueur `--ops`. Une attribution au mauvais compte ou qui déborde est refusée. -- Il imprime un objet JSON avec `bench_pid`, `workload` et `requested_ops`, puis crée autant de fichiers de 4096 octets dans un nouveau répertoire. -- Chaque phase imprime du JSON avec `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind` et des percentiles de latence. Le processus se termine en erreur si `succeeded` n'est pas égal à `--ops`. -- `bulk-ttl-delete` supprime les noms créés, puis liste le répertoire avec `limit = 1`. -- Une seconde exécution alloue un nouveau `bench_pid`. Les créations rejetées ne comptent pas comme des succès. +- The client allocates one directory id, then file-inode and file-id blocks of length `--ops`, and refuses a grant whose count or end overflows. +- It prints one JSON object with `bench_pid`, `workload`, and `requested_ops`, then creates that many 4096-byte files under a new directory. +- Each phase prints JSON with `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind`, and latency percentiles (`p50_ms`, `p99_ms`, `p999_ms`). The process exits non-zero unless `succeeded` equals `--ops`. +- `bulk-ttl-delete` unlinks the names that were created, then lists the directory with `limit = 1` and prints whether that page is empty. +- A second run allocates a new `bench_pid`. It does not reuse a fixed inode, and it does not report rejected creates as successes. -Ne pas traiter un nombre issu de cette commande comme un résultat du dépôt. Il dépend de la machine, du profil de compilation et du serveur visé. Cet arbre n'enregistre pas d'échantillon. +Do not treat a number from this command as a repository result. A remote run depends on the machine, the build profile, and the server you pointed at. An embedded run depends on the machine and the build profile. This tree does not record a sample of either. -## Pull request ouverte n° 2 +## In-process stress harness -La [pull request n° 2](https://github.com/rustfs/MetaDB/pull/2) est ouverte et ne fait pas partie de cette branche. Elle ajoute des tests de topologie persistants et un harnais de stress embarqué. Sa propre description dit : +`crates/metadb-server/tests/stress_harness.rs` and `metadb-ctl bench --embedded` both call `metadb_server::stress` (`crates/metadb-server/src/stress.rs`). There is no third profile named `mixed`. `--workload mixed` selects this harness. Both profiles run the same mixed workload: create, lookup, dirstat, listdir, rename, and unlink against one persistent all-in-one node on a temporary data directory. After the timed loop the harness runs maintenance ticks, then checks directory listings, dirstat, and quota against the operations that succeeded. A failed maintenance tick adds one to `errors`, sets `correctness_errors` to 1, and skips that check. The run is one OS process and one data directory. It is not three `metadbd` processes, and it is not the [official prefix load](../en/testing.md#prefix-load). -- Le test mono-nœud appelle `PersistentMetaDbCluster::open_and_serve` sur un répertoire temporaire. -- Le test de montée en charge force un découpage à frontière de PID dans ce même processus. -- Le test distribué est un processus avec trois votants Raft sur localhost. Il appelle `DurableCellManager::scale_out_replicas`. Il ne lance pas trois processus `metadbd` du système d'exploitation. -- `open_and_serve` rejette toujours tout rôle autre que `all-in-one`. Les rôles désagrégés et une seconde cellule restent non implémentés. +| Profile | Test | Duration | Concurrency | Directories | When it runs | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `smoke` | `stress_smoke_mixed_workload` | 5 seconds | 4 | 4 | `cargo test -p metadb-server --test stress_harness`, including `cargo test --workspace`. Ignores `METADB_STRESS_*`. | +| `local` | `stress_local_mixed_workload` | 30 seconds unless overridden | 8 unless overridden | 16 unless overridden | `#[ignore]`. Not part of `cargo test --workspace`. Reads `METADB_STRESS_DURATION_SECS`, `METADB_STRESS_CONCURRENCY`, `METADB_STRESS_KEYSPACE`, and `METADB_STRESS_SEED`. | -Le rapport de cette pull request, sur la machine virtuelle de l'auteur avec Rust 1.100.0 (le matériel n'est pas nommé), contient une ligne smoke du harnais que cette branche ne contient pas : +```bash +cargo test -p metadb-server --test stress_harness stress_smoke -- --nocapture + +METADB_STRESS_DURATION_SECS=120 \ +METADB_STRESS_CONCURRENCY=16 \ +METADB_STRESS_KEYSPACE=32 \ +METADB_STRESS_SEED=7 \ + cargo test -p metadb-server --test stress_harness stress_local -- --ignored --nocapture + +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile smoke +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile local +``` + +`METADB_STRESS_*` applies to the local profile, including `metadb-ctl bench --embedded --profile local`. On `metadb-ctl bench --embedded`, `--duration-secs`, `--concurrency`, `--keyspace`, and `--seed` override whichever profile was selected, after the environment is read. The `cargo test` local profile has no flag overrides; it reads only those variables. A duration, concurrency, or directory count below 1 is raised to 1. `--profile` defaults to `smoke`. `--profile ci` is the same smoke profile. Any other `--profile` value exits with an error. The smoke profile does not read `METADB_STRESS_*`. Remote `hotspot-create` and `bulk-ttl-delete` ignore `--profile`. + +The test prints one line and requires `errors = 0`, `correctness_errors = 0`, and `ops > 0`. `metadb-ctl bench --embedded` prints `embedded metadbd listening on ` and the same line, and exits non-zero when `errors` or `correctness_errors` is greater than zero. The line fields are: ```text -metadb stress profile=smoke ops=12219 errors=0 correctness_errors=0 elapsed_ms=5221 ops_per_s=2340.3 latency_us p50=1318 p99=5207 max=12449 +metadb stress profile= ops= errors= correctness_errors= elapsed_ms= ops_per_s= latency_us p50= p99= max= ``` -Cette ligne est une seule exécution d'un test non fusionné. Ce n'est pas une cible de service et elle n'est pas reproduite par `metadb-ctl bench` sur cette branche. Des commandes telles que `cargo test -p metadb-server --test topology_distributed` et `metadb-ctl bench --embedded` n'existent que sur la branche de cette pull request. +`ops` counts only mixed-loop operations that succeeded. `ops_per_s` divides that count by the elapsed time. `errors` counts mixed-loop operations that did not succeed. A failed maintenance tick is also added to `errors`, and it sets `correctness_errors` to 1 instead of running the check. When the check runs, `correctness_errors` counts mismatched directory listings, dirstat, and quota, and it also counts failed verification calls (`dirstat`, `listdir`, and `get_quota`). `latency_us` `p50`, `p99`, and `max` are percentiles of every mixed-loop attempt, including failed attempts, in microseconds. They are not percentiles of `ops`. They are printed. This tree does not enforce a latency threshold. + +A line from either command is a result for the machine that printed it. This repository does not record that line. It is not a service-level result, not a first-ship pass, and not the official 1,000,000-create prefix load. + +## Persistent topology and join + +These commands are in this tree. CI runs them with `cargo test --workspace --locked`. + +- `cargo test -p metadb-server --test topology_single_node` opens `PersistentMetaDbCluster` on a temporary directory. +- `cargo test -p metadb-server --test topology_scale_out` forces a PID-boundary split in that process. +- `cargo test -p metadb-server --test topology_distributed` uses one process and `DurableCellManager::scale_out_replicas` for three localhost voters, including leader loss under create load. +- `cargo test -p metadb-server --test stress_crash_restart` stops without flushing the memtable while a create is inside `propose`, then reopens the same `data_dir`. +- `cargo test -p metadb-server --test join_existing_group` covers two different joins. `metadbd_processes_join_existing_group_and_fail_over` starts real `metadbd` processes, joins the first process's Raft group, and fails over. `join_sends_the_shared_secret` opens two `PersistentMetaDbCluster` servers inside the test process and checks that the shared secret is sent on that join. That case does not start two `metadbd` OS processes. +- `open_and_serve` still rejects every role except `all-in-one`. A second Cell stays unimplemented. `RegisterCell` returns an error. + +The smoke profile and the ignored local profile are the [in-process stress harness](#in-process-stress-harness). `topology_distributed` is still one OS process with three localhost Raft voters, not three `metadbd` processes. Disaggregated roles and a second Cell are still not live deployments. diff --git a/docs/ja/operations.md b/docs/ja/operations.md index 9a6a1c8..c2c2064 100644 --- a/docs/ja/operations.md +++ b/docs/ja/operations.md @@ -67,7 +67,9 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ### `bench` -[テストとベンチ](./testing.md#metadb-ctl-bench) を参照してください。これは起動中のサーバに対するクライアントです。Cargo のベンチターゲットではありません。このリポジトリは、このコマンドのスループット数値を記録していません。 +See [Tests and benches](./testing.md#metadb-ctl-bench). Remote `hotspot-create` and `bulk-ttl-delete` are a client against a running server. They print JSON with `attempted`, `succeeded`, and `failed`, and the process exits non-zero unless `succeeded` equals `--ops`. `--embedded` and `--workload mixed` run the [in-process stress harness](./testing.md#in-process-stress-harness) instead of dialing the endpoint. That path passes when `errors` and `correctness_errors` are both zero, and it prints latency percentiles in microseconds. Neither path is a Cargo benchmark target. The repository does not check in a throughput number for either path. A printed line is not a service-level result and is not the official 1,000,000-create profile. + +The separate prefix-load harness (100 prefixes × 10,000 creates, then 100,000 `SetAttr` overwrites, then 100,000 deletes, concurrency 64) is documented in [Tests and benches](../en/testing.md#prefix-load). GitHub Actions runs only the small profile. It does not run the 1,000,000-create profile. ## メトリクス @@ -105,7 +107,7 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ 3. `metadb-ctl cell register` は 2 つ目のセルを作りません。`open_and_serve` はグローバルマネージャへローカルセルだけを登録します。 4. テスト `T1`–`T6` が使うメモリ内の `MetaDbEngine::new_single_node` は、メモリ上の投票者数を 3 に増やせます。そのオブジェクトにはディスクも Raft もありません。`metadbd` のスケールアウトではありません。 -[未マージのプルリクエスト 2](https://github.com/rustfs/MetaDB/pull/2) は同じ境界を述べています。その分散テストは、1 つの OS プロセスの中で localhost の Raft 投票者 3 つに対し `DurableCellManager::scale_out_replicas` を呼びます。`metadbd` を 3 プロセス起動しません。分離されたロールと 2 つ目のセルも、そこでは稼働中の配備としてはテストされていません。そのプルリクエストのジャンボ専用ノード隔離は、メモリ内シミュレータの挙動のままです。 +`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. The shared-secret case in that file opens two clusters inside the test process; it does not start two `metadbd` OS processes. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. ## 遭遇しうるエラー @@ -131,11 +133,11 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ## 既知の制限 -- OS プロセスは 1 つ、ロールは `all-in-one` だけ。 +- Role `all-in-one` only. `be`, `proxy`, `cell-manager`, and `global-manager` are rejected before listen. - 2 つ目の all-in-one プロセスは `[cluster] join` で同じセルに参加できる。これは 2 つ目のセルを作らない。`RegisterCell` はエラーを返す。 - 未知で非ゼロの `cell_id` に対する `GetRoutes` は失敗して閉じる。`StoreHeartbeat` はキャッシュ済みルートを置き換えない。 - ジャンボ隔離はルートフラグと、ローカルノード表から選んだノード ID である。他のシャードをディスクから追い出すことはしない。 -- ハートビートは RPC であり、`metadbd` に送信側はない。`StoreHeartbeat` は永続化しない。 +- Registered-node liveness is fsynced in `CELL_CONTROL_PLANE`. `metadbd` persists its own record about every 3 seconds and sends it to the current leader when this process is not the leader. Descriptors on that RPC are annotations, not routes. The observation does not schedule placement. See [Scale control plane](../en/scale-control-plane-status.md). - A secret that contains a non-whitespace character authenticates Raft, the other three gRPC services, and the metrics listener, including `/livez`, `/readyz`, and `/healthz`, with the same bearer. An empty secret does not start the process. `allow_unauthenticated = true` is the explicit exception for literal loopback IPs (`127.0.0.0/8` or `::1`) and still refuses a wildcard bind. The hostname `localhost` is not accepted for that exception. The bound socket is checked again after listen. A whitespace-only secret is rejected and is not compared as a bearer. A usable secret combined with the flag is rejected. The process does not terminate TLS. - `memtable_size_bytes` はアクティブな memtable を封印してフラッシュする。`max_imm_memtables` はキューに積まれた不変テーブルの数を抑える。`[raft]` timers and `max_segment_bytes` apply when a group starts. They are not reloaded from a changed file, and the segment size does not rewrite segments already on disk. - `hotspot-create` と `bulk-ttl-delete` の `metadb-ctl bench` は JSON 行を印字する。`bench_pid` を含むヘッダのあと、attempted、succeeded、failed とレイテンシのパーセンタイルを持つフェーズ報告が続く。要求した操作がすべて成功しない限り、プロセスは非ゼロで終了する。`--workload mixed` または `--embedded` はプロセス内のストレステストを実行する。`sql` は応答を JSON で印字し、アプリケーションエラーでは非ゼロで終了する。 @@ -145,9 +147,8 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ 次の項目は製品に無いため、このガイドは手順を書けません。 1. `be`、`proxy`、`cell-manager`、`global-manager` の複数プロセス配置。 -2. 既存の Raft グループへ 2 つ目と 3 つ目の `metadbd` OS プロセスを加えること。 -3. 2 つ目のセルを作り、そこへルーティングすること。 -4. ジャンボシャードを専用マシンに置き、他のシャードをそのマシンから移すこと。 -5. プロセス内の TLS。このプロセスは TLS を終端しない。TLS や証明書を求める設定キーは、平文で提供する代わりに拒否される。終端は外部プロキシに置く。シークレットがあるとき、Raft とメトリクスは他のサービスと同じベアラを使う。これは相互 TLS ではない。ハートビート駆動の制御ループは未実装である。 -6. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). -7. `metadb-ctl bench` のチェックインされたサービス水準の結果。コマンドは実行したマシンの数値を印字します。このリポジトリはそれを記録していません。未マージのプルリクエスト 2 は別の組み込みハーネスを報告しています。それらのコマンドはこのツリーにはありません。 [テストとベンチ](./testing.md) を参照してください。 +2. A second Cell. `RegisterCell` stays an error. Join reaches only the current leader; a follower does not forward it. +3. ジャンボシャードを専用マシンに置き、他のシャードをそのマシンから移すこと。 +4. プロセス内の TLS。このプロセスは TLS を終端しない。TLS や証明書を求める設定キーは、平文で提供する代わりに拒否される。終端は外部プロキシに置く。シークレットがあるとき、Raft とメトリクスは他のサービスと同じベアラを使う。これは相互 TLS ではない。ハートビート駆動の制御ループは未実装である。 +5. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded and is not `#[serde(skip)]`. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). +6. A checked-in service-level result for `metadb-ctl bench`. The command prints numbers for the machine you run it on. This repository does not record one. See [Tests and benches](./testing.md). diff --git a/docs/ja/testing.md b/docs/ja/testing.md index 8f85da4..832da53 100644 --- a/docs/ja/testing.md +++ b/docs/ja/testing.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings cargo test --workspace ``` -`cargo test --workspace` はライブラリ、統合テスト、両方のバイナリをビルドします。`[[bench]]` ターゲットも `benches/` ディレクトリもありません。このツリーに同梱される負荷生成は、下の `metadb-ctl bench` です。 +`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generators that ship in this tree are `metadb-ctl bench` and `cargo test -p metadb-server --test stress_harness`, below. 範囲を狭めた便利なコマンド: @@ -31,6 +31,7 @@ cargo test -p metadb-proxy --test sql_templates_tests cargo test -p metadb-storage --test lsm_recovery_tests cargo test -p metadb-storage --test mvcc_snapshot_tests cargo test -p metadb-storage --test locality_compaction_tests +cargo test -p metadb-server --test stress_harness ``` ## 各スイートが実際に行使するもの @@ -99,31 +100,61 @@ cargo run -p metadb-server --bin metadb-ctl -- \ bench --workload bulk-ttl-delete --concurrency 16 --ops 1000 ``` -フラグ: `--workload` は `hotspot-create`(既定)、`bulk-ttl-delete`、または `mixed` です。`--concurrency` を省略すると 16 です。`--ops` の既定は 1000 です。`--embedded` または `--workload mixed` は `--endpoint` を呼ばず、一時的な all-in-one ノードとプロセス内ストレステストを起動します。 +Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. For the remote workloads, omitted `--concurrency` is 16 and `--ops` defaults to 1000. `--profile` is read only when the command takes the embedded path. `--embedded` or `--workload mixed` does not dial `--endpoint` and does not use `--ops`. It starts a temporary all-in-one node and runs the in-process stress harness. See [In-process stress harness](#in-process-stress-harness). -遠隔ワークロードについて `crates/metadb-server/src/bin/metadb-ctl.rs` の挙動: +Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote workloads: -- クライアントはディレクトリ ID を 1 つ取り、そのあと長さ `--ops` のファイル inode とファイル ID のブロックを取ります。個数や終端が不正な払い出しは拒否します。 -- `bench_pid`、`workload`、`requested_ops` を持つ JSON を 1 つ印字し、新しいディレクトリに 4096 バイトのファイルをその個数だけ作ります。 -- 各フェーズは `attempted`、`succeeded`、`failed`、`transport_failed`、`application_failed`、`errors_by_kind`、レイテンシのパーセンタイルを JSON で印字します。`succeeded` が `--ops` と等しくなければプロセスは非ゼロで終了します。 -- `bulk-ttl-delete` は作成した名前を削除し、`limit = 1` でディレクトリを一覧します。 -- 2 回目は新しい `bench_pid` を取ります。拒否された作成は成功に数えません。 +- The client allocates one directory id, then file-inode and file-id blocks of length `--ops`, and refuses a grant whose count or end overflows. +- It prints one JSON object with `bench_pid`, `workload`, and `requested_ops`, then creates that many 4096-byte files under a new directory. +- Each phase prints JSON with `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind`, and latency percentiles (`p50_ms`, `p99_ms`, `p999_ms`). The process exits non-zero unless `succeeded` equals `--ops`. +- `bulk-ttl-delete` unlinks the names that were created, then lists the directory with `limit = 1` and prints whether that page is empty. +- A second run allocates a new `bench_pid`. It does not reuse a fixed inode, and it does not report rejected creates as successes. -このコマンドの数値をリポジトリの結果として扱わないでください。マシン、ビルドプロファイル、向けたサーバに依存します。このツリーはサンプルを記録していません。 +Do not treat a number from this command as a repository result. A remote run depends on the machine, the build profile, and the server you pointed at. An embedded run depends on the machine and the build profile. This tree does not record a sample of either. -## 未マージのプルリクエスト 2 +## In-process stress harness -[プルリクエスト 2](https://github.com/rustfs/MetaDB/pull/2) は開いており、このブランチの一部ではありません。永続トポロジのテストと組み込みストレスハーネスを追加します。その説明自身が次を述べています。 +`crates/metadb-server/tests/stress_harness.rs` and `metadb-ctl bench --embedded` both call `metadb_server::stress` (`crates/metadb-server/src/stress.rs`). There is no third profile named `mixed`. `--workload mixed` selects this harness. Both profiles run the same mixed workload: create, lookup, dirstat, listdir, rename, and unlink against one persistent all-in-one node on a temporary data directory. After the timed loop the harness runs maintenance ticks, then checks directory listings, dirstat, and quota against the operations that succeeded. A failed maintenance tick adds one to `errors`, sets `correctness_errors` to 1, and skips that check. The run is one OS process and one data directory. It is not three `metadbd` processes, and it is not the [official prefix load](../en/testing.md#prefix-load). -- 単一ノードのテストは一時ディレクトリで `PersistentMetaDbCluster::open_and_serve` を呼ぶ。 -- スケールアウトのテストは同じプロセスで PID 境界の分割を強制する。 -- 分散テストは、localhost の Raft 投票者 3 つを持つ 1 プロセスである。`DurableCellManager::scale_out_replicas` を呼ぶ。`metadbd` の OS プロセスを 3 つ起動しない。 -- `open_and_serve` は今も `all-in-one` 以外のロールを拒否する。分離されたロールと 2 つ目のセルは未実装のままである。 +| Profile | Test | Duration | Concurrency | Directories | When it runs | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `smoke` | `stress_smoke_mixed_workload` | 5 seconds | 4 | 4 | `cargo test -p metadb-server --test stress_harness`, including `cargo test --workspace`. Ignores `METADB_STRESS_*`. | +| `local` | `stress_local_mixed_workload` | 30 seconds unless overridden | 8 unless overridden | 16 unless overridden | `#[ignore]`. Not part of `cargo test --workspace`. Reads `METADB_STRESS_DURATION_SECS`, `METADB_STRESS_CONCURRENCY`, `METADB_STRESS_KEYSPACE`, and `METADB_STRESS_SEED`. | -そのプルリクエストの報告は、著者の VM 上の Rust 1.100.0(ハードウェア名は無い)で、このブランチに無いハーネスのスモーク行を 1 つ含みます。 +```bash +cargo test -p metadb-server --test stress_harness stress_smoke -- --nocapture + +METADB_STRESS_DURATION_SECS=120 \ +METADB_STRESS_CONCURRENCY=16 \ +METADB_STRESS_KEYSPACE=32 \ +METADB_STRESS_SEED=7 \ + cargo test -p metadb-server --test stress_harness stress_local -- --ignored --nocapture + +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile smoke +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile local +``` + +`METADB_STRESS_*` applies to the local profile, including `metadb-ctl bench --embedded --profile local`. On `metadb-ctl bench --embedded`, `--duration-secs`, `--concurrency`, `--keyspace`, and `--seed` override whichever profile was selected, after the environment is read. The `cargo test` local profile has no flag overrides; it reads only those variables. A duration, concurrency, or directory count below 1 is raised to 1. `--profile` defaults to `smoke`. `--profile ci` is the same smoke profile. Any other `--profile` value exits with an error. The smoke profile does not read `METADB_STRESS_*`. Remote `hotspot-create` and `bulk-ttl-delete` ignore `--profile`. + +The test prints one line and requires `errors = 0`, `correctness_errors = 0`, and `ops > 0`. `metadb-ctl bench --embedded` prints `embedded metadbd listening on ` and the same line, and exits non-zero when `errors` or `correctness_errors` is greater than zero. The line fields are: ```text -metadb stress profile=smoke ops=12219 errors=0 correctness_errors=0 elapsed_ms=5221 ops_per_s=2340.3 latency_us p50=1318 p99=5207 max=12449 +metadb stress profile= ops= errors= correctness_errors= elapsed_ms= ops_per_s= latency_us p50= p99= max= ``` -この行は未マージテストの 1 回の実行です。サービスの目標値ではなく、このブランチの `metadb-ctl bench` では再現しません。`cargo test -p metadb-server --test topology_distributed` や `metadb-ctl bench --embedded` のようなコマンドは、そのプルリクエストのブランチにだけあります。 +`ops` counts only mixed-loop operations that succeeded. `ops_per_s` divides that count by the elapsed time. `errors` counts mixed-loop operations that did not succeed. A failed maintenance tick is also added to `errors`, and it sets `correctness_errors` to 1 instead of running the check. When the check runs, `correctness_errors` counts mismatched directory listings, dirstat, and quota, and it also counts failed verification calls (`dirstat`, `listdir`, and `get_quota`). `latency_us` `p50`, `p99`, and `max` are percentiles of every mixed-loop attempt, including failed attempts, in microseconds. They are not percentiles of `ops`. They are printed. This tree does not enforce a latency threshold. + +A line from either command is a result for the machine that printed it. This repository does not record that line. It is not a service-level result, not a first-ship pass, and not the official 1,000,000-create prefix load. + +## Persistent topology and join + +These commands are in this tree. CI runs them with `cargo test --workspace --locked`. + +- `cargo test -p metadb-server --test topology_single_node` opens `PersistentMetaDbCluster` on a temporary directory. +- `cargo test -p metadb-server --test topology_scale_out` forces a PID-boundary split in that process. +- `cargo test -p metadb-server --test topology_distributed` uses one process and `DurableCellManager::scale_out_replicas` for three localhost voters, including leader loss under create load. +- `cargo test -p metadb-server --test stress_crash_restart` stops without flushing the memtable while a create is inside `propose`, then reopens the same `data_dir`. +- `cargo test -p metadb-server --test join_existing_group` covers two different joins. `metadbd_processes_join_existing_group_and_fail_over` starts real `metadbd` processes, joins the first process's Raft group, and fails over. `join_sends_the_shared_secret` opens two `PersistentMetaDbCluster` servers inside the test process and checks that the shared secret is sent on that join. That case does not start two `metadbd` OS processes. +- `open_and_serve` still rejects every role except `all-in-one`. A second Cell stays unimplemented. `RegisterCell` returns an error. + +The smoke profile and the ignored local profile are the [in-process stress harness](#in-process-stress-harness). `topology_distributed` is still one OS process with three localhost Raft voters, not three `metadbd` processes. Disaggregated roles and a second Cell are still not live deployments. diff --git a/docs/zh/operations.md b/docs/zh/operations.md index 971556d..7a9d370 100644 --- a/docs/zh/operations.md +++ b/docs/zh/operations.md @@ -67,7 +67,9 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ### `bench` -见 [测试与压测](./testing.md#metadb-ctl-bench)。这是针对正在运行的服务器的客户端。它不是 Cargo 基准目标。本仓库没有为它登记吞吐量数字。 +See [Tests and benches](./testing.md#metadb-ctl-bench). Remote `hotspot-create` and `bulk-ttl-delete` are a client against a running server. They print JSON with `attempted`, `succeeded`, and `failed`, and the process exits non-zero unless `succeeded` equals `--ops`. `--embedded` and `--workload mixed` run the [in-process stress harness](./testing.md#in-process-stress-harness) instead of dialing the endpoint. That path passes when `errors` and `correctness_errors` are both zero, and it prints latency percentiles in microseconds. Neither path is a Cargo benchmark target. The repository does not check in a throughput number for either path. A printed line is not a service-level result and is not the official 1,000,000-create profile. + +The separate prefix-load harness (100 prefixes × 10,000 creates, then 100,000 `SetAttr` overwrites, then 100,000 deletes, concurrency 64) is documented in [Tests and benches](../en/testing.md#prefix-load). GitHub Actions runs only the small profile. It does not run the 1,000,000-create profile. ## 指标 @@ -105,7 +107,7 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ 3. `metadb-ctl cell register` 不创建第二个单元。`open_and_serve` 只把本地单元注册到全局管理器。 4. 测试 `T1`–`T6` 使用的内存路径 `MetaDbEngine::new_single_node` 可以把内存中的投票者计数加到 3。那个对象没有磁盘,也没有 Raft。它不是 `metadbd` 的扩容。 -[未合并的拉取请求 2](https://github.com/rustfs/MetaDB/pull/2) 陈述了同一边界:它的分布式测试在一个操作系统进程里,用三个 localhost Raft 投票者调用 `DurableCellManager::scale_out_replicas`。它不启动三个 `metadbd` 进程。拆开的角色和第二个单元在那里也没有作为真实部署被测试。该拉取请求中的巨型分片专用节点隔离仍是内存模拟器的行为。 +`topology_distributed` still uses `DurableCellManager::scale_out_replicas` with localhost voters inside one OS process. `join_existing_group` starts real `metadbd` processes and joins them. The shared-secret case in that file opens two clusters inside the test process; it does not start two `metadbd` OS processes. Disaggregated roles and a second Cell are still not live deployments. Jumbo dedicated-node isolation remains a route flag, not a move of shards onto another machine. ## 会遇到的错误 @@ -131,11 +133,11 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ ## 已知限制 -- 一个操作系统进程,角色只能是 `all-in-one`。 +- Role `all-in-one` only. `be`, `proxy`, `cell-manager`, and `global-manager` are rejected before listen. - 第二个 all-in-one 进程可以用 `[cluster] join` 加入同一个单元。这不会创建第二个单元。`RegisterCell` 返回错误。 - 未知且非零的 `cell_id` 上,`GetRoutes` 失败关闭。`StoreHeartbeat` 不会替换缓存路由。 - 巨型隔离是路由标志加上从本地节点表选出的节点标识。它不会把其他分片从磁盘上赶走。 -- 心跳是一个 RPC,`metadbd` 里没有发送方。`StoreHeartbeat` 不持久化。 +- Registered-node liveness is fsynced in `CELL_CONTROL_PLANE`. `metadbd` persists its own record about every 3 seconds and sends it to the current leader when this process is not the leader. Descriptors on that RPC are annotations, not routes. The observation does not schedule placement. See [Scale control plane](../en/scale-control-plane-status.md). - A secret that contains a non-whitespace character authenticates Raft, the other three gRPC services, and the metrics listener, including `/livez`, `/readyz`, and `/healthz`, with the same bearer. An empty secret does not start the process. `allow_unauthenticated = true` is the explicit exception for literal loopback IPs (`127.0.0.0/8` or `::1`) and still refuses a wildcard bind. The hostname `localhost` is not accepted for that exception. The bound socket is checked again after listen. A whitespace-only secret is rejected and is not compared as a bearer. A usable secret combined with the flag is rejected. The process does not terminate TLS. - `memtable_size_bytes` 会封印并刷出活动 memtable。`max_imm_memtables` 限制已排队的不可变表数量。`[raft]` timers and `max_segment_bytes` apply when a group starts. They are not reloaded from a changed file, and the segment size does not rewrite segments already on disk. - `hotspot-create` 和 `bulk-ttl-delete` 的 `metadb-ctl bench` 打印 JSON 行:先是带 `bench_pid` 的头,然后是包含 attempted、succeeded、failed 和延迟分位数的阶段报告。只要有一次请求的操作失败,进程就以非零状态退出。`--workload mixed` 或 `--embedded` 运行进程内的压力工具。`sql` 把响应打印成 JSON,遇到应用错误时以非零状态退出。 @@ -145,9 +147,8 @@ metadb-ctl --endpoint 127.0.0.1:7800 sql \ 下列能力产品里没有,因此本指南无法为它们写出步骤: 1. `be`、`proxy`、`cell-manager` 和 `global-manager` 的多进程布局。 -2. 把第二个和第三个 `metadbd` 操作系统进程加入已有 Raft 组。 -3. 创建第二个单元并路由到它。 -4. 把巨型分片放到独立机器上,并把其他分片从那台机器移走。 -5. 本进程内的 TLS。进程不终结 TLS。要求 TLS 或证书的配置键会被拒绝,而不是以明文提供服务。请在外部代理终结 TLS。密钥非空时,Raft 和指标与其他服务使用同一个持有者令牌;这不是双向 TLS。由心跳驱动的控制循环没有实现。 -6. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). -7. 记入仓库的 `metadb-ctl bench` 服务级结果。该命令打印你运行它的那台机器上的数字。本仓库没有记录一份。未合并的拉取请求 2 报告了另一套嵌入式工具;那些命令不在本树中。见 [测试与压测](./testing.md)。 +2. A second Cell. `RegisterCell` stays an error. Join reaches only the current leader; a follower does not forward it. +3. 把巨型分片放到独立机器上,并把其他分片从那台机器移走。 +4. 本进程内的 TLS。进程不终结 TLS。要求 TLS 或证书的配置键会被拒绝,而不是以明文提供服务。请在外部代理终结 TLS。密钥非空时,Raft 和指标与其他服务使用同一个持有者令牌;这不是双向 TLS。由心跳驱动的控制循环没有实现。 +5. A gRPC health RPC, probes when `metrics_listen_addr` is unset, and per-shard Prometheus series. `/readyz` does not wait for the 250 ms 2PC recovery pass. A leader election makes `/readyz` and `/healthz` return 503 on replicas that do not know a leader. `[raft]` is loaded and is not `#[serde(skip)]`. Its values apply when a group starts and are not reloaded. See [Operability](../en/operability.md). +6. A checked-in service-level result for `metadb-ctl bench`. The command prints numbers for the machine you run it on. This repository does not record one. See [Tests and benches](./testing.md). diff --git a/docs/zh/testing.md b/docs/zh/testing.md index 23844b2..e70ccf3 100644 --- a/docs/zh/testing.md +++ b/docs/zh/testing.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings cargo test --workspace ``` -`cargo test --workspace` 会构建库、集成测试和两个二进制。没有 `[[bench]]` 目标,也没有 `benches/` 目录。本树自带的负载发生器是下面的 `metadb-ctl bench`。 +`cargo test --workspace` builds the library, the integration tests, and both binaries. There is no `[[bench]]` target and no `benches/` directory. The load generators that ship in this tree are `metadb-ctl bench` and `cargo test -p metadb-server --test stress_harness`, below. 较窄的常用命令: @@ -31,6 +31,7 @@ cargo test -p metadb-proxy --test sql_templates_tests cargo test -p metadb-storage --test lsm_recovery_tests cargo test -p metadb-storage --test mvcc_snapshot_tests cargo test -p metadb-storage --test locality_compaction_tests +cargo test -p metadb-server --test stress_harness ``` ## 每个套件实际覆盖什么 @@ -99,31 +100,61 @@ cargo run -p metadb-server --bin metadb-ctl -- \ bench --workload bulk-ttl-delete --concurrency 16 --ops 1000 ``` -标志:`--workload` 为 `hotspot-create`(默认)、`bulk-ttl-delete` 或 `mixed`。省略 `--concurrency` 时为 16。`--ops` 默认 1000。`--embedded` 或 `--workload mixed` 会启动一个临时的 all-in-one 节点和进程内压力工具,而不是拨号 `--endpoint`。 +Flags: `--workload` is `hotspot-create` (the default), `bulk-ttl-delete`, or `mixed`. For the remote workloads, omitted `--concurrency` is 16 and `--ops` defaults to 1000. `--profile` is read only when the command takes the embedded path. `--embedded` or `--workload mixed` does not dial `--endpoint` and does not use `--ops`. It starts a temporary all-in-one node and runs the in-process stress harness. See [In-process stress harness](#in-process-stress-harness). -来自 `crates/metadb-server/src/bin/metadb-ctl.rs` 的远程负载行为: +Behavior from `crates/metadb-server/src/bin/metadb-ctl.rs` for the remote workloads: -- 客户端分配一个目录 id,再分配长度为 `--ops` 的文件 inode 和文件 id 块。数量或结尾溢出的授予会被拒绝。 -- 它打印一个包含 `bench_pid`、`workload` 和 `requested_ops` 的 JSON 对象,然后在新目录下创建同样数量的 4096 字节文件。 -- 每个阶段打印包含 `attempted`、`succeeded`、`failed`、`transport_failed`、`application_failed`、`errors_by_kind` 和延迟分位数的 JSON。若 `succeeded` 不等于 `--ops`,进程以非零状态退出。 -- `bulk-ttl-delete` 删除已创建的名字,再用 `limit = 1` 列举该目录。 -- 再跑一次会分配新的 `bench_pid`。被拒绝的创建不算成功。 +- The client allocates one directory id, then file-inode and file-id blocks of length `--ops`, and refuses a grant whose count or end overflows. +- It prints one JSON object with `bench_pid`, `workload`, and `requested_ops`, then creates that many 4096-byte files under a new directory. +- Each phase prints JSON with `attempted`, `succeeded`, `failed`, `transport_failed`, `application_failed`, `errors_by_kind`, and latency percentiles (`p50_ms`, `p99_ms`, `p999_ms`). The process exits non-zero unless `succeeded` equals `--ops`. +- `bulk-ttl-delete` unlinks the names that were created, then lists the directory with `limit = 1` and prints whether that page is empty. +- A second run allocates a new `bench_pid`. It does not reuse a fixed inode, and it does not report rejected creates as successes. -不要把这条命令打出的数字当作仓库结果。它取决于机器、构建配置和你指向的服务器。本树没有记录样本。 +Do not treat a number from this command as a repository result. A remote run depends on the machine, the build profile, and the server you pointed at. An embedded run depends on the machine and the build profile. This tree does not record a sample of either. -## 未合并的拉取请求 2 +## In-process stress harness -[拉取请求 2](https://github.com/rustfs/MetaDB/pull/2) 处于打开状态,不属于本分支。它增加持久拓扑测试和一套嵌入式压力工具。它自己的说明写道: +`crates/metadb-server/tests/stress_harness.rs` and `metadb-ctl bench --embedded` both call `metadb_server::stress` (`crates/metadb-server/src/stress.rs`). There is no third profile named `mixed`. `--workload mixed` selects this harness. Both profiles run the same mixed workload: create, lookup, dirstat, listdir, rename, and unlink against one persistent all-in-one node on a temporary data directory. After the timed loop the harness runs maintenance ticks, then checks directory listings, dirstat, and quota against the operations that succeeded. A failed maintenance tick adds one to `errors`, sets `correctness_errors` to 1, and skips that check. The run is one OS process and one data directory. It is not three `metadbd` processes, and it is not the [official prefix load](../en/testing.md#prefix-load). -- 单节点测试在临时目录上调用 `PersistentMetaDbCluster::open_and_serve`。 -- 扩容测试在同一进程里强制一次 PID 边界分裂。 -- 分布式测试是一个进程、三个 localhost Raft 投票者。它调用 `DurableCellManager::scale_out_replicas`。它不启动三个 `metadbd` 操作系统进程。 -- `open_and_serve` 仍然拒绝除 `all-in-one` 以外的每个角色。拆开的角色和第二个单元仍未实现。 +| Profile | Test | Duration | Concurrency | Directories | When it runs | +| :--- | :--- | :--- | :--- | :--- | :--- | +| `smoke` | `stress_smoke_mixed_workload` | 5 seconds | 4 | 4 | `cargo test -p metadb-server --test stress_harness`, including `cargo test --workspace`. Ignores `METADB_STRESS_*`. | +| `local` | `stress_local_mixed_workload` | 30 seconds unless overridden | 8 unless overridden | 16 unless overridden | `#[ignore]`. Not part of `cargo test --workspace`. Reads `METADB_STRESS_DURATION_SECS`, `METADB_STRESS_CONCURRENCY`, `METADB_STRESS_KEYSPACE`, and `METADB_STRESS_SEED`. | -该拉取请求的报告,在作者的虚拟机上、Rust 1.100.0(未写明硬件),包含本分支没有的那套工具的一行冒烟输出: +```bash +cargo test -p metadb-server --test stress_harness stress_smoke -- --nocapture + +METADB_STRESS_DURATION_SECS=120 \ +METADB_STRESS_CONCURRENCY=16 \ +METADB_STRESS_KEYSPACE=32 \ +METADB_STRESS_SEED=7 \ + cargo test -p metadb-server --test stress_harness stress_local -- --ignored --nocapture + +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile smoke +cargo run -p metadb-server --bin metadb-ctl -- bench --embedded --profile local +``` + +`METADB_STRESS_*` applies to the local profile, including `metadb-ctl bench --embedded --profile local`. On `metadb-ctl bench --embedded`, `--duration-secs`, `--concurrency`, `--keyspace`, and `--seed` override whichever profile was selected, after the environment is read. The `cargo test` local profile has no flag overrides; it reads only those variables. A duration, concurrency, or directory count below 1 is raised to 1. `--profile` defaults to `smoke`. `--profile ci` is the same smoke profile. Any other `--profile` value exits with an error. The smoke profile does not read `METADB_STRESS_*`. Remote `hotspot-create` and `bulk-ttl-delete` ignore `--profile`. + +The test prints one line and requires `errors = 0`, `correctness_errors = 0`, and `ops > 0`. `metadb-ctl bench --embedded` prints `embedded metadbd listening on ` and the same line, and exits non-zero when `errors` or `correctness_errors` is greater than zero. The line fields are: ```text -metadb stress profile=smoke ops=12219 errors=0 correctness_errors=0 elapsed_ms=5221 ops_per_s=2340.3 latency_us p50=1318 p99=5207 max=12449 +metadb stress profile= ops= errors= correctness_errors= elapsed_ms= ops_per_s= latency_us p50= p99= max= ``` -这一行是一次未合并测试的单次运行。它不是服务目标,本分支上的 `metadb-ctl bench` 也不会复现它。`cargo test -p metadb-server --test topology_distributed` 和 `metadb-ctl bench --embedded` 这类命令只存在于该拉取请求的分支上。 +`ops` counts only mixed-loop operations that succeeded. `ops_per_s` divides that count by the elapsed time. `errors` counts mixed-loop operations that did not succeed. A failed maintenance tick is also added to `errors`, and it sets `correctness_errors` to 1 instead of running the check. When the check runs, `correctness_errors` counts mismatched directory listings, dirstat, and quota, and it also counts failed verification calls (`dirstat`, `listdir`, and `get_quota`). `latency_us` `p50`, `p99`, and `max` are percentiles of every mixed-loop attempt, including failed attempts, in microseconds. They are not percentiles of `ops`. They are printed. This tree does not enforce a latency threshold. + +A line from either command is a result for the machine that printed it. This repository does not record that line. It is not a service-level result, not a first-ship pass, and not the official 1,000,000-create prefix load. + +## Persistent topology and join + +These commands are in this tree. CI runs them with `cargo test --workspace --locked`. + +- `cargo test -p metadb-server --test topology_single_node` opens `PersistentMetaDbCluster` on a temporary directory. +- `cargo test -p metadb-server --test topology_scale_out` forces a PID-boundary split in that process. +- `cargo test -p metadb-server --test topology_distributed` uses one process and `DurableCellManager::scale_out_replicas` for three localhost voters, including leader loss under create load. +- `cargo test -p metadb-server --test stress_crash_restart` stops without flushing the memtable while a create is inside `propose`, then reopens the same `data_dir`. +- `cargo test -p metadb-server --test join_existing_group` covers two different joins. `metadbd_processes_join_existing_group_and_fail_over` starts real `metadbd` processes, joins the first process's Raft group, and fails over. `join_sends_the_shared_secret` opens two `PersistentMetaDbCluster` servers inside the test process and checks that the shared secret is sent on that join. That case does not start two `metadbd` OS processes. +- `open_and_serve` still rejects every role except `all-in-one`. A second Cell stays unimplemented. `RegisterCell` returns an error. + +The smoke profile and the ignored local profile are the [in-process stress harness](#in-process-stress-harness). `topology_distributed` is still one OS process with three localhost Raft voters, not three `metadbd` processes. Disaggregated roles and a second Cell are still not live deployments.