Expand description
The invariant checker: what must hold of a tenant’s disk whoever wrote it.
tenant reads InodeDB and S3 alone, so it runs beside live writers and readers. stock_load then has a
fresh stock exclusive writer load the disk, which is the final word on whether stock ClickHouse accepts it;
starting that writer fences every other writer, so it runs once they have stopped. orphans counts the
blobs in S3 that the disk no longer names, or never did.
use libch::check;
let report = check::tenant(&tenant, key).await?;
if !report.is_clean() {
// The report lists each violation: intersecting parts, a block number used twice, a missing blob.
eprintln!("{report}");
}
// What a quiet tenant keeps in S3 beyond its parts: blobs awaiting removal, and blobs nothing names.
let left = check::orphans(&tenant, key).await?;
println!("{} orphan blobs of {} bytes", left.orphans.len(), left.bytes());Structs§
- Orphans
- What S3 holds under a tenant’s prefix, sorted by what still names it.
- Report
- What a check found, and how much it read.
Enums§
- Violation
- One way a disk breaks an invariant.
Functions§
- catalog_
invariants - Checks what InodeDB alone shows: parts, counters and coordination files.
- orphans
- Counts the blobs under a tenant’s prefix that neither a file nor a freed file names.
- stock_
load - Has a fresh stock exclusive writer load the disk, and reports what it rejects: parts it sets aside as
broken, and tables that fail
CHECK TABLE. - tenant
- Checks a tenant’s disk from InodeDB and S3.
keyneeds thereadgrant on the tenant’s directory.