luoyuxia commented on code in PR #3630:
URL: https://github.com/apache/fluss/pull/3630#discussion_r3602297057


##########
fluss-client/src/main/java/org/apache/fluss/client/lookup/PrimaryKeyLookuper.java:
##########
@@ -115,19 +125,89 @@ public CompletableFuture<LookupResult> lookup(InternalRow 
lookupKey) {
                                 tableInfo.getTablePath(),
                                 metadataUpdater);
             } catch (PartitionNotExistException e) {
-                return CompletableFuture.completedFuture(new 
LookupResult(Collections.emptyList()));
+                return mayFallbackToHistoricalLookup(
+                        bucketingFunction.bucketing(bkBytes, numBuckets), 
pkBytes, lookupKey);
             }
         }
 
         int bucketId = bucketingFunction.bucketing(bkBytes, numBuckets);
         TableBucket tableBucket = new TableBucket(tableInfo.getTableId(), 
partitionId, bucketId);
+        return lookupBucket(tableBucket, pkBytes, insertIfNotExists, null, 
lookupKey);
+    }
+
+    /** Falls back to historical lookup if the lookup key belongs to a 
historical partition. */
+    private CompletableFuture<LookupResult> mayFallbackToHistoricalLookup(
+            int bucketId, byte[] keyBytes, InternalRow lookupKey) {
+        String originalPartitionName = partitionGetter.getPartition(lookupKey);
+        if (!isHistoricalLookupCandidatePartition(
+                tableInfo, originalPartitionName, Instant.now())) {

Review Comment:
   This is a valid clock-skew edge case.
   
   In a normally time-synchronized deployment, triggering it requires the 
partition cleanup to complete during the short interval after the Coordinator 
crosses a partition boundary but before the client does. A lookup must also 
target the newly expired time slice during that same interval. The negative 
decision is not cached, so subsequent lookups start using the historical path 
as soon as the client crosses the boundary.
   
   Making the decision fully authoritative would require moving it to the 
Coordinator or exposing Coordinator-derived expiration state through 
metadata/RPC, which is a broader cross-layer change.
   
   Given the narrow and transient failure window, I’d prefer to track this in a 
follow-up issue and keep the current PR scoped.



-- 
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]

Reply via email to