Skip to content

Commit c57041a

Browse files
authored
[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.
1 parent 47fe087 commit c57041a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.apache.doris.catalog.TableIf.TableType;
4646
import org.apache.doris.catalog.Tablet;
4747
import org.apache.doris.catalog.TabletMeta;
48+
import org.apache.doris.cloud.catalog.CloudPartition;
4849
import org.apache.doris.cloud.catalog.CloudTablet;
4950
import org.apache.doris.cloud.proto.Cloud.CommitTxnResponse;
5051
import org.apache.doris.cluster.ClusterNamespace;
@@ -623,6 +624,20 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE
623624
table.getName(), PrivPredicate.SHOW)) {
624625
continue;
625626
}
627+
// For the follower node in cloud mode,
628+
// when querying the information_schema table,
629+
// the version needs to be updated.
630+
// Otherwise, the version will always be the old value
631+
// unless there is a query for the table in the follower node.
632+
if (!Env.getCurrentEnv().isMaster() && Config.isCloudMode()
633+
&& table instanceof OlapTable) {
634+
OlapTable olapTable = (OlapTable) table;
635+
List<CloudPartition> partitions = olapTable.getAllPartitions().stream()
636+
.filter(p -> p instanceof CloudPartition)
637+
.map(cloudPartition -> (CloudPartition) cloudPartition)
638+
.collect(Collectors.toList());
639+
CloudPartition.getSnapshotVisibleVersion(partitions);
640+
}
626641
table.readLock();
627642
try {
628643
if (matcher != null && !matcher.match(table.getName())) {

0 commit comments

Comments
 (0)