Gabriel39 commented on code in PR #69158:
URL: https://github.com/apache/doris/pull/69158#discussion_r4290640419
##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonSchemaPin.java:
##########
@@ -125,6 +126,29 @@ private static void validate(Table table, Map<String,
String> pin, String path)
}
}
+ static FileStoreTable bindRestSchema(FileStoreTable table) {
+ if (table instanceof FallbackReadFileStoreTable) {
+ FallbackReadFileStoreTable pair = (FallbackReadFileStoreTable)
table;
+ return PaimonTableDecorators.rebuildFallbackPair(pair,
+ bindRestSchema(pair.wrapped()),
bindRestSchema(pair.other()));
+ }
+ if (table instanceof DelegatedFileStoreTable) {
+ return PaimonTableDecorators.replaceWrapped(table,
+ bindRestSchema(((DelegatedFileStoreTable)
table).wrapped()));
+ }
+ TableSchema retained = table.schema();
+ TableSchema persisted = table.schemaManager().schema(retained.id());
+ // REST reconstructs TableSchema from Schema, synthesizing timeMillis,
version and highestFieldId.
+ // Bind physical identity only on catalog load: rebinding a cached
handle could adopt a replacement.
+ if (!retained.copy(Collections.emptyMap()).toSchema()
+ .equals(persisted.copy(Collections.emptyMap()).toSchema())) {
+ throw new DorisConnectorException("Paimon REST schema does not
match stored schema "
+ + retained.id() + "; retry the statement");
+ }
+ // Copy the schema on the existing table to preserve REST FileIO and
catalog callbacks/options.
+ return table.copy(persisted.copy(retained.options()));
Review Comment:
Fixed in 63a7b2ba1f6. The initial REST handle now only locates schema files.
We capture full physical identities, perform a fresh uncached REST lookup, and
validate the physical identities again before binding and caching. The identity
includes options and branch/path, and the wrapper shape and fallback leaves are
checked as well. A replacement before the bracket uses fresh REST options;
replacement during it rejects the load without caching it. UUID is not used as
the fence.
Added deterministic tests for both interleavings, equal creation timestamps
with changed bucket keys, fallback replacement/shape changes and changed
location. A real local Paimon fixture writes 16 matching rows: mixed-generation
options demonstrably lose rows, while the corrected load returns all 16. All
nine REST schema tests pass. Full reactor install, Checkstyle and plugin
assembly passed: 1,464 tests passed and one existing environment-dependent live
test skipped. Live REST/DLF regression remains for CI.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]