From 3ccf21f5aae2f5024eccdc11fd3a9ee99283fee1 Mon Sep 17 00:00:00 2001 From: Lu Qiu Date: Fri, 18 Sep 2026 12:16:37 -0700 Subject: [PATCH] fix(format): move FLAG_UNKNOWN off the tagged FRI bit FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS (#9119) took bit 9, which pushed FLAG_UNKNOWN up to bit 10 -- the same bit FLAG_FRAGMENT_REUSE_INDEX (#9136) already occupies. On main the collision is latent because the tagged FRI bit stays below the FLAG_UNKNOWN boundary and is never marked supported. Move FLAG_UNKNOWN to bit 11 so it sits above every named flag again, reorder FLAG_FRAGMENT_REUSE_INDEX to its bit-order position (after bit 9, before the unknown boundary), add a const assert pinning it below the boundary so an insertion cannot recreate the collision silently, and explicitly keep the tagged FRI bit unsupported (as the boundary used to do implicitly) until its reader/writer handling lands. No behavior change. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01DgAshYD7wVzPVdjXRuWPPs --- rust/lance-table/src/feature_flags.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/rust/lance-table/src/feature_flags.rs b/rust/lance-table/src/feature_flags.rs index 09ff7fdbe69..3c67753910d 100644 --- a/rust/lance-table/src/feature_flags.rs +++ b/rust/lance-table/src/feature_flags.rs @@ -60,8 +60,12 @@ pub const FLAG_MIXED_DATA_FILE_VERSIONS: u64 = 1 << 8; /// (see `supported_flags_when`), so a build that knows the flag but not the /// handling behind it cannot open such a table. pub const FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS: u64 = 1 << 9; +/// Tagged FRI requires a reader that interprets its mappings and a writer that +/// preserves them during maintenance. Legacy-only FRI does not set this bit. +/// Bit 9 is taken by the stable-row-id FRI compatibility flag. +pub const FLAG_FRAGMENT_REUSE_INDEX: u64 = 1 << 10; /// The first bit that is unknown as a feature flag -pub const FLAG_UNKNOWN: u64 = 1 << 10; +pub const FLAG_UNKNOWN: u64 = 1 << 11; const _: () = assert!(FLAG_COVERED_INDEX_METADATA < FLAG_UNKNOWN); // The fence needs a bit the current released build already refuses, which means @@ -72,11 +76,7 @@ const _: () = assert!(FLAG_MIXED_DATA_FILE_VERSIONS < FLAG_UNKNOWN); // boundary is bit 8, so anything at or above it is refused there. const _: () = assert!(FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS >= 1 << 8); const _: () = assert!(FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS < FLAG_UNKNOWN); - -/// Tagged FRI requires a reader that interprets its mappings and a writer that -/// preserves them during maintenance. Legacy-only FRI does not set this bit. -/// Bit 9 is taken by the stable-row-id FRI compatibility flag. -pub const FLAG_FRAGMENT_REUSE_INDEX: u64 = 1 << 10; +const _: () = assert!(FLAG_FRAGMENT_REUSE_INDEX < FLAG_UNKNOWN); pub(crate) const STICKY_PAIRED_FLAGS: u64 = FLAG_MIXED_DATA_FILE_VERSIONS; @@ -209,6 +209,9 @@ fn supported_flags_when(overlay_enabled: bool) -> u64 { ); // Reserved, not implemented: see the flag's doc comment. mark_supported(&mut supported, FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS, false); + // Bit 10 now falls below the unknown boundary, so keep tagged FRI refused + // until its reader/writer handling lands. + mark_supported(&mut supported, FLAG_FRAGMENT_REUSE_INDEX, false); supported }