Copilot commented on code in PR #64045:
URL: https://github.com/apache/doris/pull/64045#discussion_r3345639624
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/backup/CloudRestoreJob.java:
##########
@@ -157,6 +159,36 @@ public synchronized void run() {
}
}
+ @Override
+ protected void updateOlapTablesVersion(Database db, boolean isReplay) {
+ super.updateOlapTablesVersion(db, isReplay);
+ if (isReplay) {
+ return;
+ }
+ for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
+ Table tbl =
db.getTableNullable(jobInfo.getAliasByOriginNameIfSet(tableName));
+ if (tbl == null || tbl.getType() != TableType.OLAP) {
+ continue;
+ }
+ OlapTable olapTable = (OlapTable) tbl;
+
+ // sync version
+ List<Pair<OlapTable, Long>> tableVersionMap = Lists.newArrayList(
+ Pair.of(olapTable, olapTable.getCachedTableVersion()));
+ Map<CloudPartition, Pair<Long, Long>> partitionVersionMap = new
HashMap<>(olapTable.getPartitions().size());
+ for (Partition partition : olapTable.getPartitions()) {
+ CloudPartition cloudPartition = (CloudPartition) partition;
+ long version = cloudPartition.getCachedVisibleVersion();
+ partitionVersionMap.put(cloudPartition, Pair.of(version,
partition.getVisibleVersionTime()));
+ }
Review Comment:
`partitionVersionMap` is built from cached partition/table versions and
pushed to other FEs. In cloud mode, `CloudPartition` can legitimately have
`cachedVisibleVersion == -1` before any fetch; pushing `-1` will call
`CloudPartition#setCachedVisibleVersion(-1, …)` on followers, which updates
`lastVersionCachedTimeMs` and makes `getVisibleVersion()` return `-1` until TTL
expires. Filter out invalid cached versions or actively fetch versions before
pushing to avoid poisoning follower caches.
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/backup/CloudRestoreJob.java:
##########
@@ -462,6 +494,13 @@ private void handleOlapTableMeta(MetaSeriviceOperation
operation, OlapTable olap
partitions.forEach(partition -> {
visibleVersions.add(partition.getCachedVisibleVersion());
partitionIds.add(partition.getId());
+ if (partition instanceof CloudPartition) {
+ ((CloudPartition)
partition).setCachedVisibleVersion(partition.getVisibleVersion(),
+ System.currentTimeMillis());
+ LOG.info("set cloud partition: {}, version: {},
versionTime: {}",
+ partition.getId(),
partition.getCachedVisibleVersion(),
+ partition.getVisibleVersionTime());
+ }
Review Comment:
This per-partition INFO log runs inside a loop and can flood logs for
restores with many partitions. Since it's mainly useful for troubleshooting, it
should be DEBUG-level (optionally guarded by `LOG.isDebugEnabled()`) to reduce
noise and overhead.
--
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]