Skip to content

Commit db5f904

Browse files
authored
Merge pull request #520 from tidesdb/tdb936r
reference documentation update across all languages and integrations
2 parents 2839475 + 7200eff commit db5f904

9 files changed

Lines changed: 1329 additions & 32 deletions

File tree

src/content/docs/reference/admintool.md

Lines changed: 182 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@ open <path> [options]
8484
| `--obj-replica-mode` | Open the database in read-only replica mode |
8585
| `--obj-replica-sync-interval <us>` | Replica MANIFEST poll interval (default: 5000000) |
8686
| `--obj-wal-sync-on-commit` | Upload the WAL to the object store after every commit (RPO=0) |
87+
| `--obj-cache-on-read <0\|1>` | Cache downloaded object files locally (default 1) |
88+
| `--obj-cache-on-write <0\|1>` | Keep a local copy after upload (default 1) |
89+
| `--obj-max-uploads <n>` | Parallel upload threads (default 4) |
90+
| `--obj-max-downloads <n>` | Parallel download threads (default 8) |
91+
| `--obj-multipart-threshold <n>` | Use multipart upload at/above this object size (bytes) |
92+
| `--obj-multipart-part-size <n>` | Multipart chunk size (bytes) |
93+
| `--obj-sync-manifest <0\|1>` | Upload the MANIFEST after each compaction (default 1) |
94+
| `--obj-replicate-wal <0\|1>` | Upload closed WAL segments for node-failure recovery (default 1) |
95+
| `--obj-wal-upload-sync <0\|1>` | Block flush until the WAL is uploaded (default 0 = background) |
96+
| `--obj-wal-sync-threshold <n>` | Sync the active WAL when it grows by this many bytes (0 = off) |
97+
| `--obj-replica-replay-wal <0\|1>` | Replay the WAL for near-real-time replica reads (default 1) |
98+
| `--object-store-s3` | Enable the S3-compatible object-store connector (requires a library built with `TIDESDB_WITH_S3=ON`) |
99+
| `--s3-endpoint <ep>` | S3 endpoint (e.g. `s3.amazonaws.com` or `minio.local:9000`) |
100+
| `--s3-bucket <name>` | S3 bucket name |
101+
| `--s3-prefix <p>` | S3 key prefix (e.g. `production/db1/`) |
102+
| `--s3-access-key <k>` | AWS access key ID (falls back to `$AWS_ACCESS_KEY_ID`) |
103+
| `--s3-secret-key <k>` | AWS secret access key (falls back to `$AWS_SECRET_ACCESS_KEY`) |
104+
| `--s3-region <r>` | AWS region (falls back to `$AWS_REGION`) |
105+
| `--s3-no-ssl` | Use HTTP instead of HTTPS |
106+
| `--s3-path-style` | Use path-style URLs (required for MinIO) |
107+
| `--s3-ca-path <path>` | Custom CA bundle file for TLS verification |
108+
| `--s3-insecure-skip-verify` | Disable TLS verification (test endpoints only; insecure) |
109+
| `--s3-multipart-threshold <n>` | S3 multipart upload threshold (bytes) |
110+
| `--s3-multipart-part-size <n>` | S3 multipart chunk size (bytes) |
87111

88112
**Examples**
89113
```
@@ -101,6 +125,11 @@ Opened database at './mydb'
101125
102126
admintool> open ./mydb --object-store-fs /mnt/objects
103127
Opened database at './mydb' (object-store fs:/mnt/objects)
128+
129+
admintool> open ./mydb --object-store-s3 --s3-endpoint minio.local:9000 \
130+
--s3-bucket tidesdb --s3-path-style --s3-no-ssl \
131+
--s3-access-key minioadmin --s3-secret-key minioadmin
132+
Opened database at './mydb' (object-store s3:minio.local:9000/tidesdb)
104133
```
105134

106135
:::note[Unified Memtable Mode]
@@ -111,6 +140,10 @@ When `--unified` is set, all column families share a single skip list and WAL in
111140
`--object-store-fs <root_dir>` attaches a filesystem-backed object-store connector that mirrors objects under the given directory. This is intended for testing and local replication scenarios. Object-store mode automatically enables unified memtable mode. The connector is destroyed when the database is closed. Combine with `--obj-cache-max-bytes`, `--obj-replica-mode`, `--obj-replica-sync-interval`, and `--obj-wal-sync-on-commit` to tune behavior.
112141
:::
113142

143+
:::note[S3 Object Store]
144+
`--object-store-s3` attaches an S3-compatible connector (AWS S3, MinIO, etc.). It is only available when the linked TidesDB library was built with `TIDESDB_WITH_S3=ON`; otherwise the command reports `This TidesDB library was built without S3 support` and the open is rejected (the connector symbol is resolved at runtime, so the tool still runs against an S3-off library). At a minimum supply `--s3-endpoint` and `--s3-bucket`; credentials may be passed with `--s3-access-key`/`--s3-secret-key` or left to the standard `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`/`AWS_REGION` environment variables. Use `--s3-path-style` for MinIO. The shared `--obj-*` tuning flags apply to both the filesystem and S3 connectors.
145+
:::
146+
114147
### close
115148
Close the current database.
116149
```
@@ -396,10 +429,27 @@ OK
396429
### scan
397430
Scan all keys in a column family.
398431
```
399-
scan <cf> [limit]
432+
scan <cf> [limit] [--reverse] [--isolation <level>]
400433
```
401434
Default limit: 100
402435

436+
**Options**
437+
| Option | Description |
438+
|--------|-------------|
439+
| `--reverse` | Iterate from the last key to the first (descending order) |
440+
| `--isolation <level>` | Open the read transaction at a specific isolation level: `read_uncommitted`\|`read_committed`\|`repeatable_read`\|`snapshot`\|`serializable` |
441+
442+
**Examples**
443+
```
444+
admintool(./mydb)> scan users 10 --reverse
445+
1) "user:9" -> "..."
446+
2) "user:8" -> "..."
447+
...
448+
(10 entries, reverse)
449+
450+
admintool(./mydb)> scan users --isolation snapshot
451+
```
452+
403453
### range
404454
Scan keys within a range.
405455
```
@@ -426,27 +476,31 @@ Show SSTable file information.
426476
sstable-info <klog_path>
427477
```
428478

479+
:::note[On-disk format handling]
480+
The SSTable inspectors parse the klog directly off disk: they read the trailing metadata block to find how many leading blocks are key/value data blocks (the remaining blocks are the block-index, bloom and metadata blobs), skip each data block's header, and decompress data blocks with the column family's compression algorithm before decoding entries. Entries written by `single-delete` are labelled `[SINGLE-DEL]`; plain tombstones are labelled `[DEL]`.
481+
:::
482+
429483
### sstable-dump
430-
Dump SSTable entries (keys and values).
484+
Dump SSTable entries (keys and values). Tombstones are shown as `[DEL]`, single-deletes as `[SINGLE-DEL]`, expiring keys as `[TTL:<expiry>]`, and vlog-stored values as `[VLOG:<offset>]`.
431485
```
432486
sstable-dump <klog_path> [limit]
433487
```
434488
Default limit: 1000
435489

436490
### sstable-dump-full
437-
Dump SSTable entries with vlog value resolution.
491+
Dump SSTable entries with vlog value resolution. When `vlog_path` is supplied, values stored in the vlog are read back and decompressed (using the SSTable's compression algorithm) instead of being shown as `(in vlog, N bytes)`.
438492
```
439493
sstable-dump-full <klog_path> [vlog_path] [limit]
440494
```
441495

442496
### sstable-stats
443-
Show SSTable statistics.
497+
Show SSTable statistics, including total entries, tombstones (and how many are single-deletes), TTL entries, vlog references, sequence range, and key/value size distribution.
444498
```
445499
sstable-stats <klog_path>
446500
```
447501

448502
### sstable-keys
449-
List only keys from an SSTable.
503+
List only keys from an SSTable. Single-delete and plain tombstones are flagged inline.
450504
```
451505
sstable-keys <klog_path> [limit]
452506
```
@@ -458,7 +512,7 @@ sstable-checksum <klog_path>
458512
```
459513

460514
### bloom-stats
461-
Show bloom filter statistics for an SSTable.
515+
Show bloom filter statistics for an SSTable, including the filter size, hash function count, hash version (1 = legacy, 2 = fmix-finalized), fill ratio, and estimated false-positive rate.
462516
```
463517
bloom-stats <klog_path>
464518
```
@@ -484,11 +538,11 @@ wal-dump <wal_path> [limit]
484538
```
485539
Default limit: 1000
486540

487-
For unified WAL files (created when using `--unified` mode), each entry is prefixed with `[CF:<index>]` showing which column family the entry belongs to. Unified WAL blocks can contain multiple entries per block.
541+
For unified WAL files (created when using `--unified` mode), each entry is prefixed with `[CF:<index>]` showing which column family the entry belongs to. Both WAL formats pack every operation of a committed transaction into a single block, so one block can hold many entries `wal-dump` decodes them all. Entries are labelled `[PUT]`, `[DELETE]`, or `[SINGLE-DELETE]`.
488542

489543
**Example (per-CF WAL)**
490544
```
491-
admintool(./mydb)> wal-dump ./mydb/users/wal_000001.log 5
545+
admintool(./mydb)> wal-dump ./mydb/users/wal_1.log 5
492546
WAL Entries (limit: 5):
493547
1) [PUT] seq=1 key="user:1" value="John Doe"
494548
2) [PUT] [TTL:1711584000] seq=2 key="sess:abc" value="token123"
@@ -499,7 +553,7 @@ WAL Entries (limit: 5):
499553

500554
**Example (unified WAL)**
501555
```
502-
admintool(./mydb)> wal-dump ./mydb/uwal_000001.log 5
556+
admintool(./mydb)> wal-dump ./mydb/uwal_0.log 5
503557
WAL Entries (limit: 5):
504558
1) [CF:0] [PUT] seq=10 key="user:1" value="Alice"
505559
2) [CF:1] [PUT] seq=10 key="order:1" value="item_A"
@@ -516,8 +570,8 @@ wal-verify <wal_path>
516570

517571
**Example**
518572
```
519-
admintool(./mydb)> wal-verify ./mydb/users/wal_000001.log
520-
Verifying WAL: ./mydb/users/wal_000001.log
573+
admintool(./mydb)> wal-verify ./mydb/users/wal_1.log
574+
Verifying WAL: ./mydb/users/wal_1.log
521575
File Size: 4096 bytes
522576
Format: Per-CF WAL
523577
Valid Entries: 42
@@ -811,6 +865,123 @@ Promoted to primary successfully.
811865
- After promotion, writes are accepted normally
812866
- Returns an error if the database is already a primary
813867

868+
### cancel-background-work
869+
Cancel background compaction across the whole database for a fast shutdown. In-flight merges bail out safely and queued compaction is skipped; flushes are left untouched so durability is preserved. The cancellation is sticky for the session and is reset on the next `open` — typically issued right before `close`.
870+
```
871+
cancel-background-work
872+
```
873+
874+
**Example**
875+
```
876+
admintool(./mydb)> cancel-background-work
877+
Background compaction cancelled (flushes preserved). Sticky until next open.
878+
```
879+
880+
### raise-open-file-limit
881+
Raise this process's open-file ceiling so the engine can keep more SSTables open. Because the engine sizes `max_open_sstables` to fit the ceiling at open time, run this **before** `open`. With no argument (or a non-positive one) it just reports the current ceiling.
882+
```
883+
raise-open-file-limit [n]
884+
```
885+
886+
**Example**
887+
```
888+
admintool> raise-open-file-limit 100000
889+
Requested open-file ceiling 100000; effective ceiling now 100000.
890+
admintool> open ./mydb
891+
```
892+
893+
## Transactions
894+
895+
admintool can hold a single transaction open across interactive prompts, which makes the isolation, savepoint, and reset APIs reachable from the command line. Begin a transaction with `txn-begin`, stage operations with the `txn-*` commands, then finish with `txn-commit` or `txn-rollback`. Closing the database (or leaving admintool) automatically rolls back an open transaction.
896+
897+
### txn-begin
898+
Begin a transaction, optionally at a specific isolation level (default `read_committed`).
899+
```
900+
txn-begin [read_uncommitted|read_committed|repeatable_read|snapshot|serializable]
901+
```
902+
903+
### txn-status
904+
Show whether a transaction is active and its isolation level.
905+
```
906+
txn-status
907+
```
908+
909+
### txn-put
910+
Stage a put in the active transaction.
911+
```
912+
txn-put <cf> <key> <value> [--ttl <seconds>]
913+
```
914+
915+
### txn-get
916+
Read a key through the active transaction (sees the transaction's own uncommitted writes).
917+
```
918+
txn-get <cf> <key>
919+
```
920+
921+
### txn-delete
922+
Stage a delete in the active transaction.
923+
```
924+
txn-delete <cf> <key>
925+
```
926+
927+
### txn-single-delete
928+
Stage a single-delete in the active transaction (see [single-delete](#single-delete) for the contract).
929+
```
930+
txn-single-delete <cf> <key>
931+
```
932+
933+
### txn-savepoint
934+
Create a named savepoint within the active transaction.
935+
```
936+
txn-savepoint <name>
937+
```
938+
939+
### txn-rollback-to
940+
Roll the transaction back to a previously created savepoint, discarding everything staged after it.
941+
```
942+
txn-rollback-to <name>
943+
```
944+
945+
### txn-release
946+
Release (drop) a savepoint without rolling back.
947+
```
948+
txn-release <name>
949+
```
950+
951+
### txn-reset
952+
Reset the active transaction for reuse, optionally changing the isolation level.
953+
```
954+
txn-reset [read_uncommitted|read_committed|repeatable_read|snapshot|serializable]
955+
```
956+
957+
### txn-commit
958+
Commit the active transaction.
959+
```
960+
txn-commit
961+
```
962+
963+
### txn-rollback
964+
Roll back and discard the active transaction.
965+
```
966+
txn-rollback
967+
```
968+
969+
**Example**
970+
```
971+
admintool(./mydb)> txn-begin snapshot
972+
Transaction started (isolation: snapshot).
973+
admintool(./mydb)> txn-put users user:1 "John"
974+
Staged put in transaction.
975+
admintool(./mydb)> txn-savepoint sp1
976+
Savepoint 'sp1' created.
977+
admintool(./mydb)> txn-put users user:2 "Jane"
978+
Staged put in transaction.
979+
admintool(./mydb)> txn-rollback-to sp1
980+
Rolled back to savepoint 'sp1'.
981+
admintool(./mydb)> txn-commit
982+
Transaction committed.
983+
```
984+
814985
## Interactive Mode
815986

816987
When run without `-c`, admintool enters interactive mode with a prompt:

0 commit comments

Comments
 (0)