Skip to content

Commit a4ff6ca

Browse files
committed
Admin/XMover: Implement suggestions by CodeRabbit
1 parent 2aa331c commit a4ff6ca

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

CHANGES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Changelog
22

33
## Unreleased
4-
- Admin: Added XMover - CrateDB Shard Analyzer and Movement Tool.
5-
Thanks, @WalBeh.
4+
- Admin: Added XMover - CrateDB shard analyzer and movement tool. Thanks, @WalBeh.
65

76
## 2025/08/19 v0.0.41
87
- I/O: Updated to `influxio-0.6.0`. Thanks, @ZillKhan.

doc/admin/xmover/handbook.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ xmover recommend --prioritize-zones --execute
368368

369369
### Connection String Format
370370

371-
```
371+
```text
372372
https://hostname:port
373373
```
374374

@@ -407,31 +407,31 @@ xmover analyze
407407
### Common Issues and Solutions
408408

409409
1. **Zone Conflicts**
410-
```
410+
```text
411411
Error: "NO(a copy of this shard is already allocated to this node)"
412412
```
413413
- **Cause**: Target node already has a copy of the shard
414414
- **Solution**: Use `xmover zone-analysis --show-shards` to find alternative targets
415415
- **Prevention**: Always use `xmover validate-move` before executing moves
416416

417417
2. **Zone Allocation Limits**
418-
```
418+
```text
419419
Error: "too many copies of the shard allocated to nodes with attribute [zone]"
420420
```
421421
- **Cause**: CrateDB's zone awareness prevents too many copies in same zone
422422
- **Solution**: Move shard to a different availability zone
423423
- **Prevention**: Use `xmover recommend` which respects zone constraints
424424

425425
3. **Insufficient Space**
426-
```
426+
```text
427427
Error: "not enough disk space"
428428
```
429429
- **Cause**: Target node lacks sufficient free space
430430
- **Solution**: Choose node with more capacity or free up space
431431
- **Check**: `xmover analyze` to see available space per node
432432

433433
4. **High Disk Usage Blocking Moves**
434-
```
434+
```text
435435
Error: "Target node disk usage too high (85.3%)"
436436
```
437437
- **Cause**: Target node exceeds default 85% disk usage threshold
@@ -465,7 +465,7 @@ XMover uses configurable safety thresholds to prevent risky moves:
465465
xmover recommend --max-disk-usage 90 --prioritize-space
466466

467467
# For urgent space relief
468-
xmover validate-move SCHEMA.TABLE SHARD_ID FROM TO --max-disk-usage 95
468+
xmover validate-move <SCHEMA.TABLE> <SHARD_ID> <FROM> <TO> --max-disk-usage 95
469469
```
470470

471471
**When to Adjust Thresholds:**

doc/admin/xmover/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ SQL commands for shard rebalancing and node decommissioning.
2525
2626
Handbook <handbook>
2727
Troubleshooting <troubleshooting>
28-
Query gallery <queries>
28+
Query Gallery <queries>
2929
```

doc/admin/xmover/queries.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ select node['name'], primary, sum(size) / 1024^3, count(id) from sys.shards g
4747
```
4848

4949
## Nodes available Space
50-
5150
```sql
51+
SELECT
52+
name,
53+
attributes['zone'] AS zone,
54+
fs['total']['available'] / power(1024, 3) AS available_gb
55+
FROM sys.nodes
56+
ORDER BY name;
57+
```
58+
```text
5259
+------------+--------------------+-----------------------------------------------+
5360
| name | attributes['zone'] | (fs[1]['disks']['available'] / 1.073741824E9) |
5461
+------------+--------------------+-----------------------------------------------+
@@ -87,8 +94,7 @@ SELECT 8 rows in set (0.062 sec)
8794

8895
## Move REROUTE
8996
```sql
90-
91-
alter table "curvo"."bottlefieldData" reroute move shard 21 from 'data-hot-2' to 'data-hot-3';
97+
ALTER TABLE curvo.bottlefielddata REROUTE MOVE SHARD 21 FROM 'data-hot-2' TO 'data-hot-3';
9298
```
9399
---
94100

doc/admin/xmover/troubleshooting.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ CRATE_SSL_VERIFY=true
232232
**Step 3: Test Network Access**
233233
```bash
234234
# Test HTTP connectivity
235-
curl -u username:password https://your-cluster:4200/_sql -d '{"stmt":"SELECT 1"}'
235+
curl -u 'username:password' \
236+
-H 'Content-Type: application/json' \
237+
'https://your-cluster:4200/_sql' \
238+
-d '{"stmt":"SELECT 1"}'
236239
```
237240

238241
#### Prevention
@@ -285,7 +288,7 @@ xmover explain-error "your error message here"
285288

286289
4. **Validate specific moves**
287290
```bash
288-
xmover validate-move SCHEMA.TABLE SHARD_ID FROM TO
291+
xmover validate-move <SCHEMA.TABLE> <SHARD_ID> <FROM> <TO>
289292
```
290293

291294
5. **Execute gradually**

0 commit comments

Comments
 (0)