[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().
This commit is contained in:
Lightman
2022-08-17 09:10:08 +08:00
committed by GitHub
parent a07e153419
commit 3e13b7d2c2
5 changed files with 9 additions and 8 deletions

View File

@ -31,7 +31,7 @@ extern MetricPrototype METRIC_query_scan_count;
BaseTablet::BaseTablet(TabletMetaSharedPtr tablet_meta, DataDir* data_dir)
: _state(tablet_meta->tablet_state()), _tablet_meta(tablet_meta), _data_dir(data_dir) {
_schema = TabletSchemaCache::instance()->insert(_tablet_meta->tablet_schema().to_key());
_schema = TabletSchemaCache::instance()->insert(_tablet_meta->tablet_schema()->to_key());
_gen_tablet_path();
std::stringstream ss;

View File

@ -1434,7 +1434,7 @@ void Tablet::build_tablet_report_info(TTabletInfo* tablet_info,
tablet_info->__set_storage_medium(_data_dir->storage_medium());
tablet_info->__set_version_count(_tablet_meta->version_count());
tablet_info->__set_path_hash(_data_dir->path_hash());
tablet_info->__set_is_in_memory(_tablet_meta->tablet_schema().is_in_memory());
tablet_info->__set_is_in_memory(_tablet_meta->tablet_schema()->is_in_memory());
tablet_info->__set_replica_id(replica_id());
tablet_info->__set_remote_data_size(_tablet_meta->tablet_remote_size());
}

View File

@ -146,7 +146,7 @@ public:
bool in_restore_mode() const;
void set_in_restore_mode(bool in_restore_mode);
const TabletSchema& tablet_schema() const;
TabletSchemaSPtr tablet_schema() const;
TabletSchema* mutable_tablet_schema();
@ -527,8 +527,8 @@ inline void TabletMeta::set_in_restore_mode(bool in_restore_mode) {
_in_restore_mode = in_restore_mode;
}
inline const TabletSchema& TabletMeta::tablet_schema() const {
return *_schema;
inline TabletSchemaSPtr TabletMeta::tablet_schema() const {
return _schema;
}
inline TabletSchema* TabletMeta::mutable_tablet_schema() {

View File

@ -766,8 +766,9 @@ Status EngineCloneTask::_finish_full_clone(Tablet* tablet, TabletMeta* cloned_ta
// but some rowset is useless, so that remove them here
for (auto& rs_meta_ptr : rs_metas_found_in_src) {
RowsetSharedPtr rowset_to_remove;
auto s = RowsetFactory::create_rowset(tablet->tablet_schema(), tablet->tablet_path(),
rs_meta_ptr, &rowset_to_remove);
auto s =
RowsetFactory::create_rowset(cloned_tablet_meta->tablet_schema(),
tablet->tablet_path(), rs_meta_ptr, &rowset_to_remove);
if (!s.ok()) {
LOG(WARNING) << "failed to init rowset to remove: "
<< rs_meta_ptr->rowset_id().to_string();

View File

@ -401,7 +401,7 @@ public class RollupJobV2 extends AlterJobV2 implements GsonPostProcessable {
AlterReplicaTask rollupTask = new AlterReplicaTask(rollupReplica.getBackendId(), dbId, tableId,
partitionId, rollupIndexId, baseIndexId, rollupTabletId, baseTabletId,
rollupReplica.getId(), rollupSchemaHash, baseSchemaHash, visibleVersion, jobId,
JobType.ROLLUP, defineExprs, descTable, null);
JobType.ROLLUP, defineExprs, descTable, tbl.getSchemaByIndexId(baseIndexId));
rollupBatchTask.addTask(rollupTask);
}
}