This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3e13b7d2c2 [Bugfix](light-shema-change) fix _finish_clone dead lock
(#11823)
3e13b7d2c2 is described below
commit 3e13b7d2c20421040b6bbb8ecc74545e2bc072d5
Author: Lightman <[email protected]>
AuthorDate: Wed Aug 17 09:10:08 2022 +0800
[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().
---
be/src/olap/base_tablet.cpp | 2 +-
be/src/olap/tablet.cpp | 2 +-
be/src/olap/tablet_meta.h | 6 +++---
be/src/olap/task/engine_clone_task.cpp | 5 +++--
fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java | 2 +-
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/be/src/olap/base_tablet.cpp b/be/src/olap/base_tablet.cpp
index 443923e28f..b69c6947d7 100644
--- a/be/src/olap/base_tablet.cpp
+++ b/be/src/olap/base_tablet.cpp
@@ -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;
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index c4371f124e..b7029278b6 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -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());
}
diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h
index 22cd1d3254..1bf4da2cbd 100644
--- a/be/src/olap/tablet_meta.h
+++ b/be/src/olap/tablet_meta.h
@@ -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() {
diff --git a/be/src/olap/task/engine_clone_task.cpp
b/be/src/olap/task/engine_clone_task.cpp
index 997ed3ff52..becae02264 100644
--- a/be/src/olap/task/engine_clone_task.cpp
+++ b/be/src/olap/task/engine_clone_task.cpp
@@ -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();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
index e2cad5aceb..baea44c646 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
@@ -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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]