This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 959ea278cb6 [fix](replay) fix replay ReplicaPersistInfo no update
lastFailedVersion and lastSuccVersion #39918 (#39947)
959ea278cb6 is described below
commit 959ea278cb6bd2be105a2d3d0fc0b4b37991b530
Author: yujun <[email protected]>
AuthorDate: Tue Aug 27 11:58:13 2024 +0800
[fix](replay) fix replay ReplicaPersistInfo no update lastFailedVersion and
lastSuccVersion #39918 (#39947)
cherry pick from #39918
---
.../apache/doris/datasource/InternalCatalog.java | 3 +-
.../clone_p0/test_clone_no_missing_version.groovy | 78 ++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 732776832a2..1fb8826903b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -1071,7 +1071,8 @@ public class InternalCatalog implements
CatalogIf<Database> {
Tablet tablet = materializedIndex.getTablet(info.getTabletId());
Replica replica = tablet.getReplicaById(info.getReplicaId());
Preconditions.checkNotNull(replica, info);
- replica.updateVersion(info.getVersion());
+ replica.updateVersionWithFailed(info.getVersion(),
info.getLastFailedVersion(),
+ info.getLastSuccessVersion());
replica.setDataSize(info.getDataSize());
replica.setRemoteDataSize(info.getRemoteDataSize());
replica.setRowCount(info.getRowCount());
diff --git
a/regression-test/suites/clone_p0/test_clone_no_missing_version.groovy
b/regression-test/suites/clone_p0/test_clone_no_missing_version.groovy
new file mode 100644
index 00000000000..75eb3866ec8
--- /dev/null
+++ b/regression-test/suites/clone_p0/test_clone_no_missing_version.groovy
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import org.apache.doris.regression.suite.ClusterOptions
+import org.apache.doris.regression.util.NodeType
+
+suite('test_clone_no_missing_version') {
+ def tbl = 'tbl_test_clone_no_missing_version'
+ def options = new ClusterOptions()
+ options.feConfigs += [
+ 'disable_tablet_scheduler=true',
+ 'tablet_checker_interval_ms=500',
+ 'schedule_batch_size=1000',
+ 'schedule_slot_num_per_hdd_path=1000',
+ ]
+ options.beConfigs += [
+ 'report_tablet_interval_seconds=100000', // don't report tablets
+ ]
+
+ options.feNum = 3
+ options.cloudMode = false
+ options.connectToFollower = true
+
+ docker(options) {
+ sql '''SET forward_to_master = false'''
+
+ sql """
+ CREATE TABLE ${tbl} (k INT) DISTRIBUTED BY HASH(k) BUCKETS 1;
+ """
+
+ sql """INSERT INTO ${tbl} VALUES (1) """
+ sql """INSERT INTO ${tbl} VALUES (2) """
+
+ def tablets = sql_return_maparray "SHOW TABLETS FROM ${tbl}"
+ assertEquals(3, tablets.size())
+
+ def originTablet = tablets[0]
+
+ sql """ ADMIN SET REPLICA VERSION PROPERTIES (
+ "tablet_id" = "${originTablet.TabletId}", "backend_id" =
"${originTablet.BackendId}",
+ "version" = "3", "last_failed_version" = "4"
+ ); """
+
+ def checkTabletIsGood = { good ->
+ def changedTablet = sql_return_maparray("SHOW TABLETS FROM
${tbl}").find { it.BackendId == originTablet.BackendId }
+ assertNotNull(changedTablet)
+ assertEquals(3L, changedTablet.Version.toLong())
+ if (good) {
+ assertEquals(-1L, changedTablet.LstFailedVersion.toLong())
+ } else {
+ assertEquals(4L, changedTablet.LstFailedVersion.toLong())
+ }
+ }
+
+ sleep 1000
+
+ checkTabletIsGood(false)
+
+ sql "ADMIN SET FRONTEND CONFIG ('disable_tablet_scheduler' = 'false')"
+
+ sleep 5000
+ checkTabletIsGood(true)
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]