JingsongLi commented on code in PR #9845: URL: https://github.com/apache/paimon/pull/9845#discussion_r4023146025
########## docs/docs/concepts/spec/manifest.md: ########## @@ -63,6 +63,242 @@ skip manifests before opening them. Each extra file belongs exclusively to one manifest. It is retained and cleaned up together with that manifest during snapshot, tag, or changelog deletion. +### Manifest Sidecar + +`ManifestSidecar` provides a binary sidecar for selecting complete Avro manifest blocks +using independent partition, row-ID and bucket coverage. A sidecar uses the +`<manifest-file-name>.avro.sidecar` naming convention. Readers find it through an explicit +`.avro.sidecar` reference in the manifest metadata's `_EXTRA_FILES`, without probing a +derived file name. The Avro schemas and `_VERSION` identifiers remain unchanged. + +The utility includes construction, validation, block selection and optional caching. Table +writers and scans do not yet invoke it automatically. Callers are responsible for publishing +sidecar references, managing file ownership, applying entry filters and reconciling ADD/DELETE +entries after block selection. `build` reads the completed physical manifest and returns +sidecar bytes; it does not write or publish another file. + +Callers decide whether to invoke `build` and `read`; these utilities have no read/write switches. +`build` and `Builder` accept `rowIdEnabled` and `bucketEnabled` arguments for independent +payload generation. Partition generation is always enabled, +including the empty partition tuple for unpartitioned tables. Missing or invalid +metadata makes only the affected block's dimension unavailable. There is no sidecar byte budget: +construction keeps complete coverage and `read` consumes the entire file once it is opened. + +`read` returns null for an absent sidecar reference or an `IOException`, allowing the caller +to fall back to the manifest. If the thread is interrupted, the I/O failure is propagated as +`UncheckedIOException`. Other exceptions and errors propagate unchanged. `select` validates +supplied bytes directly and reports invalid containers with `IOException`. + +Version 1 uses the following layout. Counts, lengths, offsets and the version use canonical +nonnegative unsigned LEB128 varints. Counts and payload lengths are bounded by `Integer.MAX_VALUE`; +block offsets, lengths and record counts are bounded by `Long.MAX_VALUE`. Row-ID envelope +endpoints remain fixed-width, eight-byte big-endian longs. Encoding IDs are unsigned bytes +with separate namespaces. The existing serialized partition tuple bytes are unchanged. + +```text +magic : 4 bytes // ASCII PMSC +formatVersion : varint // 1 +avroHeaderLength : varint +avroHeader : bytes // original schema, codec and sync marker +partitionCount : varint +partitionDictionary[] + partitionByteLength : varint + partitionBytes : bytes // existing manifest BinaryRow serialization +blockCount : varint +blocks[] // original physical order + offset : varint + length : varint // complete encoded block, including sync marker + recordCount : varint + partitionEncoding : byte + if partitionEncoding != 0: + partitionPayloadLength : varint + partitionPayload : bytes + rowIdEncoding : byte + if rowIdEncoding != 0: + rowIdPayloadLength : varint + rowIdPayload : bytes + bucketEncoding : byte + if bucketEncoding != 0: + bucketPayloadLength : varint + bucketPayload : bytes +checksum : 32 bytes // SHA-256 of all preceding bytes Review Comment: 4 bytes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
