Skip to content

Commit 31a9352

Browse files
authored
[hotfix][client] Fix potential metadata inconsistency by deduplicating getBucketLocation call (#1897)
1 parent dbf6f61 commit 31a9352

File tree

1 file changed

+4
-2
lines changed
  • fluss-client/src/main/java/org/apache/fluss/client/table/scanner/log

1 file changed

+4
-2
lines changed

fluss-client/src/main/java/org/apache/fluss/client/table/scanner/log/LogFetcher.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import java.util.HashSet;
6666
import java.util.List;
6767
import java.util.Map;
68+
import java.util.Optional;
6869
import java.util.Set;
6970
import java.util.stream.Collectors;
7071

@@ -502,8 +503,9 @@ private List<TableBucket> fetchableBuckets() {
502503
}
503504

504505
private Integer getTableBucketLeader(TableBucket tableBucket) {
505-
if (metadataUpdater.getBucketLocation(tableBucket).isPresent()) {
506-
BucketLocation bucketLocation = metadataUpdater.getBucketLocation(tableBucket).get();
506+
Optional<BucketLocation> bucketLocationOpt = metadataUpdater.getBucketLocation(tableBucket);
507+
if (bucketLocationOpt.isPresent()) {
508+
BucketLocation bucketLocation = bucketLocationOpt.get();
507509
if (bucketLocation.getLeader() != null) {
508510
return bucketLocation.getLeader();
509511
}

0 commit comments

Comments
 (0)