This is an automated email from the ASF dual-hosted git repository.

liaoxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c57041ad932 [fix](cloud version) fix version of information_schema 
table backward when query in follower node (#43451)
c57041ad932 is described below

commit c57041ad932388f4989214d2ca03041420cea460
Author: hui lai <[email protected]>
AuthorDate: Fri Nov 8 14:31:12 2024 +0800

    [fix](cloud version) fix version of information_schema table backward when 
query in follower node (#43451)
    
    Problem Summary:
    
    For the follower node in cloud mode, when querying the
    information_schema table, the version needs to be updated.
    Otherwise, the version will always be the old value unless there is a
    query for the table in the follower node.
---
 .../org/apache/doris/service/FrontendServiceImpl.java     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 31aef1ebb7c..346f1a66008 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -45,6 +45,7 @@ import org.apache.doris.catalog.TableIf;
 import org.apache.doris.catalog.TableIf.TableType;
 import org.apache.doris.catalog.Tablet;
 import org.apache.doris.catalog.TabletMeta;
+import org.apache.doris.cloud.catalog.CloudPartition;
 import org.apache.doris.cloud.catalog.CloudTablet;
 import org.apache.doris.cloud.proto.Cloud.CommitTxnResponse;
 import org.apache.doris.cluster.ClusterNamespace;
@@ -623,6 +624,20 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
                                         table.getName(), PrivPredicate.SHOW)) {
                             continue;
                         }
+                        // For the follower node in cloud mode,
+                        // when querying the information_schema table,
+                        // the version needs to be updated.
+                        // Otherwise, the version will always be the old value
+                        // unless there is a query for the table in the 
follower node.
+                        if (!Env.getCurrentEnv().isMaster() && 
Config.isCloudMode()
+                                && table instanceof OlapTable) {
+                            OlapTable olapTable = (OlapTable) table;
+                            List<CloudPartition> partitions = 
olapTable.getAllPartitions().stream()
+                                    .filter(p -> p instanceof CloudPartition)
+                                    .map(cloudPartition -> (CloudPartition) 
cloudPartition)
+                                    .collect(Collectors.toList());
+                            
CloudPartition.getSnapshotVisibleVersion(partitions);
+                        }
                         table.readLock();
                         try {
                             if (matcher != null && 
!matcher.match(table.getName())) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to