Tags: cockroachdb/pebble
Tags
rowblk: fix IsLowerBound to account for synthetic suffix `Iter.firstUserKey` has the synthetic prefix prepended but the on-disk suffix is preserved; suffix replacement is only applied per-returned key via `maybeReplaceSuffix`. Comparing `firstUserKey` directly against the probe could return true even though the iterator's actual first key (after synthetic suffix replacement) sorts strictly less than the probe, violating the `blockiter.Data.IsLowerBound` contract. When a synthetic suffix is in effect, only compare the prefix portion of `firstUserKey` and require it to be strictly greater than the probe. The contract permits false negatives, so this conservative comparison is sound and avoids reasoning about the unknown suffix. Adds `TestIsLowerBoundRandomized` which cross-checks `IsLowerBound` against `First()` across random blocks and transform combinations, and documents the transform state of `firstUserKey`.
rowblk: fix IsLowerBound to account for synthetic suffix `Iter.firstUserKey` has the synthetic prefix prepended but the on-disk suffix is preserved; suffix replacement is only applied per-returned key via `maybeReplaceSuffix`. Comparing `firstUserKey` directly against the probe could return true even though the iterator's actual first key (after synthetic suffix replacement) sorts strictly less than the probe, violating the `blockiter.Data.IsLowerBound` contract. When a synthetic suffix is in effect, only compare the prefix portion of `firstUserKey` and require it to be strictly greater than the probe. The contract permits false negatives, so this conservative comparison is sound and avoids reasoning about the unknown suffix. Adds `TestIsLowerBoundRandomized` which cross-checks `IsLowerBound` against `First()` across random blocks and transform combinations, and documents the transform state of `firstUserKey`.
db: error when opening a database in format major version 1 Format major version 1 (`FormatMostCompatible`) predates the `format-version` marker file and uses a `CURRENT` file rather than the atomic `manifest` marker. When opening such a database, `lookupFormatMajorVersion` returned `FormatDefault` and `findCurrentManifest` reported no manifest, so `Open` treated the directory as a fresh store and overwrote the existing data. The existing `ErrorIfNotPristine` safeguard only fires during WAL replay or after a successful manifest recovery, neither of which happens for a v1 store, so the safeguard was bypassed. Detect the legacy state in `Open` by scanning the directory listing for a `CURRENT` file when no `format-version` marker is present, and return an error indicating that format major version 1 is no longer supported. The check runs before any destructive work. `CURRENT` is the unambiguous v1 signal: real v1 stores always have it, and modern Pebble never writes it. We deliberately do not flag directories with `MANIFEST-*` but no `CURRENT`, because that state can also occur transiently when a modern store crashes mid-creation; that case is handled by `ErrorIfNotPristine`. Fixes #5969. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
db: error when opening a database in format major version 1 Format major version 1 (`FormatMostCompatible`) predates the `format-version` marker file and uses a `CURRENT` file rather than the atomic `manifest` marker. When opening such a database, `lookupFormatMajorVersion` returned `FormatDefault` and `findCurrentManifest` reported no manifest, so `Open` treated the directory as a fresh store and overwrote the existing data. The existing `ErrorIfNotPristine` safeguard only fires during WAL replay or after a successful manifest recovery, neither of which happens for a v1 store, so the safeguard was bypassed. Detect the legacy state in `Open` by scanning the directory listing for a `CURRENT` file when no `format-version` marker is present, and return an error indicating that format major version 1 is no longer supported. The check runs before any destructive work. `CURRENT` is the unambiguous v1 signal: real v1 stores always have it, and modern Pebble never writes it. We deliberately do not flag directories with `MANIFEST-*` but no `CURRENT`, because that state can also occur transiently when a modern store crashes mid-creation; that case is handled by `ErrorIfNotPristine`. Fixes #5969. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
feat: add pebblegozstd build tag to allow to configure zstd lib Add a build tag that lets developers choose the zstd library. The current cgo implementation dramatically slows down builds and tests, and it blocks non‑cgo projects from running tests with the race detector unless they also switch the underlying library.
options: add Unsafe.AllowMissingWALDir option This unsafe option allows opening a store after moving or losing the previous WAL dir. This is understood to be risky and have associated data loss if any of the necessary WALs are not in the new directory. Fixes #5421
PreviousNext