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

[bugfix](tablet)fix the tablet will be deleted when clone due to concurrency #25784

Closed
Closed
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
3 changes: 2 additions & 1 deletion be/src/agent/task_worker_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1911,9 +1911,10 @@ void CloneTaskPool::_clone_worker_thread_callback() {
LOG_INFO("successfully clone tablet")
.tag("signature", agent_task_req.signature)
.tag("tablet_id", clone_req.tablet_id);
++_s_report_version;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 1914, 1917: only clone a not exisist replica can add s_report_version and report s_report_version.

Because for clone a existsing replica, the report tablet no change.

Copy link
Collaborator

@yujun777 yujun777 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有在clone 新副本时,增加_s_report_version和上报_s_report_version。

对于已有的副本clone时,不要修改_s_report_version也不要上报它。 因为对一个已存在的tablet 增量clone,不会出现issue所说的问题。

假如增量clone时增大_s_report_version时,会有一个问题:它增大s_report_version,可能会导致fe丢弃上一个BE tablet report(旧report version)。进入会存在这样的情况:假如BE很多增量clone, 那FE会频繁丢弃这个BE 的tablet report。

finish_task_request.__set_finish_tablet_infos(tablet_infos);
}

finish_task_request.__set_report_version(_s_report_version);
_finish_task(finish_task_request);
_remove_task_info(agent_task_req.task_type, agent_task_req.signature);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,11 @@ private void finishClone(AgentTask task, TFinishTaskRequest request) {
} else {
LOG.warn("invalid clone task, ignore it. {}", task);
}

if (request.isSetReportVersion()) {
long reportVersion = request.getReportVersion();
Env.getCurrentSystemInfo().updateBackendReportVersion(
task.getBackendId(), reportVersion, task.getDbId(), task.getTableId());
}
AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.CLONE, task.getSignature());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,16 +784,17 @@ private static void deleteFromMeta(ListMultimap<Long, Long> tabletDeleteFromMeta
continue;
}

BinlogConfig binlogConfig = new BinlogConfig(olapTable.getBinlogConfig());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why move these two lines ahead ?


ReplicaState state = replica.getState();

// check report version again
long currentBackendReportVersion = Env.getCurrentSystemInfo()
.getBackendReportVersion(backendId);
if (backendReportVersion < currentBackendReportVersion) {
continue;
}

BinlogConfig binlogConfig = new BinlogConfig(olapTable.getBinlogConfig());

ReplicaState state = replica.getState();
if (state == ReplicaState.NORMAL || state == ReplicaState.SCHEMA_CHANGE) {
// if state is PENDING / ROLLUP / CLONE
// it's normal that the replica is not created in BE but exists in meta.
Expand Down