Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](replay) fix replay ReplicaPersistInfo no update lastFailedVersion and lastSuccVersion #39918 #39947

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,8 @@ private void unprotectUpdateReplica(OlapTable olapTable, ReplicaPersistInfo info
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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
Loading