Skip to content

Commit 3e13b7d

Browse files
authored
[Bugfix](light-shema-change) fix _finish_clone dead lock (#11823)
In engine_clone_task.cpp, it use tablet->tablet_schema() to create rowset, but in the method, it need a lock that already locked in engine_clone_task.cpp:514. It use cloned_tablet_meta->tablet_schema() originally, but modified in #11131. It need to revert to use cloned_tablet_meta->tablet_schema().
1 parent a07e153 commit 3e13b7d

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

be/src/olap/base_tablet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern MetricPrototype METRIC_query_scan_count;
3131

3232
BaseTablet::BaseTablet(TabletMetaSharedPtr tablet_meta, DataDir* data_dir)
3333
: _state(tablet_meta->tablet_state()), _tablet_meta(tablet_meta), _data_dir(data_dir) {
34-
_schema = TabletSchemaCache::instance()->insert(_tablet_meta->tablet_schema().to_key());
34+
_schema = TabletSchemaCache::instance()->insert(_tablet_meta->tablet_schema()->to_key());
3535
_gen_tablet_path();
3636

3737
std::stringstream ss;

be/src/olap/tablet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ void Tablet::build_tablet_report_info(TTabletInfo* tablet_info,
14341434
tablet_info->__set_storage_medium(_data_dir->storage_medium());
14351435
tablet_info->__set_version_count(_tablet_meta->version_count());
14361436
tablet_info->__set_path_hash(_data_dir->path_hash());
1437-
tablet_info->__set_is_in_memory(_tablet_meta->tablet_schema().is_in_memory());
1437+
tablet_info->__set_is_in_memory(_tablet_meta->tablet_schema()->is_in_memory());
14381438
tablet_info->__set_replica_id(replica_id());
14391439
tablet_info->__set_remote_data_size(_tablet_meta->tablet_remote_size());
14401440
}

be/src/olap/tablet_meta.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class TabletMeta {
146146
bool in_restore_mode() const;
147147
void set_in_restore_mode(bool in_restore_mode);
148148

149-
const TabletSchema& tablet_schema() const;
149+
TabletSchemaSPtr tablet_schema() const;
150150

151151
TabletSchema* mutable_tablet_schema();
152152

@@ -527,8 +527,8 @@ inline void TabletMeta::set_in_restore_mode(bool in_restore_mode) {
527527
_in_restore_mode = in_restore_mode;
528528
}
529529

530-
inline const TabletSchema& TabletMeta::tablet_schema() const {
531-
return *_schema;
530+
inline TabletSchemaSPtr TabletMeta::tablet_schema() const {
531+
return _schema;
532532
}
533533

534534
inline TabletSchema* TabletMeta::mutable_tablet_schema() {

be/src/olap/task/engine_clone_task.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,9 @@ Status EngineCloneTask::_finish_full_clone(Tablet* tablet, TabletMeta* cloned_ta
766766
// but some rowset is useless, so that remove them here
767767
for (auto& rs_meta_ptr : rs_metas_found_in_src) {
768768
RowsetSharedPtr rowset_to_remove;
769-
auto s = RowsetFactory::create_rowset(tablet->tablet_schema(), tablet->tablet_path(),
770-
rs_meta_ptr, &rowset_to_remove);
769+
auto s =
770+
RowsetFactory::create_rowset(cloned_tablet_meta->tablet_schema(),
771+
tablet->tablet_path(), rs_meta_ptr, &rowset_to_remove);
771772
if (!s.ok()) {
772773
LOG(WARNING) << "failed to init rowset to remove: "
773774
<< rs_meta_ptr->rowset_id().to_string();

fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ protected void runWaitingTxnJob() throws AlterCancelException {
401401
AlterReplicaTask rollupTask = new AlterReplicaTask(rollupReplica.getBackendId(), dbId, tableId,
402402
partitionId, rollupIndexId, baseIndexId, rollupTabletId, baseTabletId,
403403
rollupReplica.getId(), rollupSchemaHash, baseSchemaHash, visibleVersion, jobId,
404-
JobType.ROLLUP, defineExprs, descTable, null);
404+
JobType.ROLLUP, defineExprs, descTable, tbl.getSchemaByIndexId(baseIndexId));
405405
rollupBatchTask.addTask(rollupTask);
406406
}
407407
}

0 commit comments

Comments
 (0)