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 364c8733fa fix light schema change coredump (#10828) 364c8733fa is described below commit 364c8733fa5b52279c9be4035986a6c97be120cd Author: Lightman <31928846+lchangli...@users.noreply.github.com> AuthorDate: Thu Jul 14 15:43:15 2022 +0800 fix light schema change coredump (#10828) --- be/src/olap/data_dir.cpp | 25 +++++++++++++++---------- be/src/olap/tablet.cpp | 4 ---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index d63d792acf..52d1570e48 100644 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -442,6 +442,14 @@ Status DataDir::load() { << ", error tablet: " << failed_tablet_ids.size() << ", path: " << _path; } + for (int64_t tablet_id : tablet_ids) { + TabletSharedPtr tablet = _tablet_manager->get_tablet(tablet_id); + if (tablet && tablet->set_tablet_schema_into_rowset_meta()) { + TabletMetaManager::save(this, tablet->tablet_id(), tablet->schema_hash(), + tablet->tablet_meta()); + } + } + // traverse rowset // 1. add committed rowset to txn map // 2. add visible rowset to tablet @@ -469,6 +477,11 @@ Status DataDir::load() { } if (rowset_meta->rowset_state() == RowsetStatePB::COMMITTED && rowset_meta->tablet_uid() == tablet->tablet_uid()) { + if (!rowset_meta->get_rowset_pb().has_tablet_schema()) { + rowset_meta->set_tablet_schema(&tablet->tablet_schema()); + RowsetMetaManager::save(_meta, rowset_meta->tablet_uid(), rowset_meta->rowset_id(), + rowset_meta->get_rowset_pb()); + } Status commit_txn_status = _txn_manager->commit_txn( _meta, rowset_meta->partition_id(), rowset_meta->txn_id(), rowset_meta->tablet_id(), rowset_meta->tablet_schema_hash(), @@ -485,13 +498,13 @@ Status DataDir::load() { << " schema hash: " << rowset_meta->tablet_schema_hash() << " for txn: " << rowset_meta->txn_id(); } + } else if (rowset_meta->rowset_state() == RowsetStatePB::VISIBLE && + rowset_meta->tablet_uid() == tablet->tablet_uid()) { if (!rowset_meta->get_rowset_pb().has_tablet_schema()) { rowset_meta->set_tablet_schema(&tablet->tablet_schema()); RowsetMetaManager::save(_meta, rowset_meta->tablet_uid(), rowset_meta->rowset_id(), rowset_meta->get_rowset_pb()); } - } else if (rowset_meta->rowset_state() == RowsetStatePB::VISIBLE && - rowset_meta->tablet_uid() == tablet->tablet_uid()) { Status publish_status = tablet->add_rowset(rowset); if (!publish_status && publish_status.precise_code() != OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) { @@ -512,14 +525,6 @@ Status DataDir::load() { } } - for (int64_t tablet_id : tablet_ids) { - TabletSharedPtr tablet = _tablet_manager->get_tablet(tablet_id); - if (tablet && tablet->set_tablet_schema_into_rowset_meta()) { - TabletMetaManager::save(this, tablet->tablet_id(), tablet->schema_hash(), - tablet->tablet_meta()); - } - } - // At startup, we only count these invalid rowset, but do not actually delete it. // The actual delete operation is in StorageEngine::_clean_unused_rowset_metas, // which is cleaned up uniformly by the background cleanup thread. diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 17188991da..366755770e 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -1813,12 +1813,8 @@ void Tablet::remove_all_remote_rowsets() { const TabletSchema& Tablet::tablet_schema() const { std::shared_lock wrlock(_meta_lock); - _tablet_meta->all_rs_metas(); const RowsetMetaSharedPtr rowset_meta = rowset_meta_with_max_schema_version(_tablet_meta->all_rs_metas()); - if (rowset_meta->tablet_schema() == nullptr) { - return _schema; - } return *rowset_meta->tablet_schema(); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org