junmuz commented on code in PR #11017: URL: https://github.com/apache/paimon/pull/11017#discussion_r4566952864
########## paimon-core/src/main/java/org/apache/paimon/index/DeleteOrderingGuardFile.java: ########## @@ -0,0 +1,320 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.paimon.index; + +import org.apache.paimon.Snapshot; +import org.apache.paimon.fs.FileIO; +import org.apache.paimon.fs.Path; +import org.apache.paimon.fs.PositionOutputStream; +import org.apache.paimon.fs.SeekableInputStream; +import org.apache.paimon.io.cache.CacheManager; +import org.apache.paimon.lookup.sort.SortLookupStoreReader; +import org.apache.paimon.lookup.sort.SortLookupStoreWriter; +import org.apache.paimon.memory.MemorySlice; +import org.apache.paimon.reader.RecordReader; +import org.apache.paimon.sst.BlockIterator; +import org.apache.paimon.sst.SstFileReader; + +import javax.annotation.Nullable; + +import java.io.Closeable; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.Comparator; +import java.util.Map; + +import static org.apache.paimon.utils.Preconditions.checkArgument; +import static org.apache.paimon.utils.Preconditions.checkState; + +/** + * Immutable bucket-local SST segments of {@link DeleteOrderingGuard}s. + * + * <p>A segment starts with magic, format version, and table schema id, followed by the native SST + * blocks and footer. Keys consist of primary-key fields; values contain the internal sequence + * number and projected ordering fields. Native SST blocks provide checksums and a block index. + * Reads stream the segment for merge processing, with no per-event guard lookup or ingestion-time + * rewrite of previous segments. + * + * <p>The path factory defines the bucket scope. Callers must commit returned index references + * atomically with the corresponding data changes. Finishing a writer only produces an uncommitted + * file; it does not publish ordering protection. No bound is retired by this storage layer. + * Instances and their serializers are not thread-safe. + */ +public class DeleteOrderingGuardFile extends IndexFile { + + public static final String DELETE_ORDERING_GUARD = "DELETE_ORDERING_GUARD"; + public static final String SNAPSHOT_MAX_SEQUENCE_NUMBER = + "delete-ordering-guards.max-sequence-number"; + + /** Conservative hint, retained through resets along with the internal sequence watermark. */ + public static boolean mayContainGuards(@Nullable Snapshot snapshot) { Review Comment: Added PyPaimon validation before planning, reading, writer/backend initialization, and commit publication, including retries. It rejects both capture-enabled tables and retained guard history after capture is disabled. Regression coverage includes rejection before native backend selection and rejection of staged commits. The documentation also requires upgrading Java clients, coordinators, and workers together and stopping older clients before enabling capture. -- 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]
