This is an automated email from the ASF dual-hosted git repository. zhaoc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 86e40dd Fix old tablet inserting bug (#5113) 86e40dd is described below commit 86e40dd3e54b450fe7fe3ebec394eddae17f3297 Author: Skysheepwang <wangt...@163.com> AuthorDate: Thu Dec 24 15:20:54 2020 +0800 Fix old tablet inserting bug (#5113) #4996 When BE is restarting and the older tablet have been added to the garbage collection queue but not deleted yet. In this case, since the data_dirs are parallel loaded, a later loaded tablet may be older than previously loaded one, which should not be acknowledged as a failure. It should be noted that the _add_tablet_unlocked() method will also be called when creating a new tablet. In that case, the changes in this pull request will not be accessed so there is no affect on the tablet creating process. --- be/src/olap/data_dir.cpp | 10 +++++++++- be/src/olap/olap_define.h | 1 + be/src/olap/tablet_manager.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index d746730..9c20ddf 100644 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -687,7 +687,8 @@ OLAPStatus DataDir::load() { const std::string& value) -> bool { OLAPStatus status = _tablet_manager->load_tablet_from_meta(this, tablet_id, schema_hash, value, false, false); - if (status != OLAP_SUCCESS && status != OLAP_ERR_TABLE_ALREADY_DELETED_ERROR) { + if (status != OLAP_SUCCESS && status != OLAP_ERR_TABLE_ALREADY_DELETED_ERROR + && status != OLAP_ERR_ENGINE_INSERT_OLD_TABLET) { // load_tablet_from_meta() may return OLAP_ERR_TABLE_ALREADY_DELETED_ERROR // which means the tablet status is DELETED // This may happen when the tablet was just deleted before the BE restarted, @@ -695,6 +696,13 @@ OLAPStatus DataDir::load() { // will read the tablet in the DELETE state from rocksdb. These tablets have been // added to the garbage collection queue and will be automatically deleted afterwards. // Therefore, we believe that this situation is not a failure. + + // Besides, load_tablet_from_meta() may return OLAP_ERR_ENGINE_INSERT_OLD_TABLET + // when BE is restarting and the older tablet have been added to the + // garbage collection queue but not deleted yet. + // In this case, since the data_dirs are parallel loaded, a later loaded tablet + // may be older than previously loaded one, which should not be acknowledged as a + // failure. LOG(WARNING) << "load tablet from header failed. status:" << status << ", tablet=" << tablet_id << "." << schema_hash; failed_tablet_ids.insert(tablet_id); diff --git a/be/src/olap/olap_define.h b/be/src/olap/olap_define.h index ac2d595..75ad835 100644 --- a/be/src/olap/olap_define.h +++ b/be/src/olap/olap_define.h @@ -194,6 +194,7 @@ enum OLAPStatus { OLAP_ERR_TABLE_INSERT_DUPLICATION_ERROR = -503, OLAP_ERR_DELETE_VERSION_ERROR = -504, OLAP_ERR_GC_SCAN_PATH_ERROR = -505, + OLAP_ERR_ENGINE_INSERT_OLD_TABLET = -506, // FetchHandler // [-600, -700) diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp index 1567698..a85b0c0 100644 --- a/be/src/olap/tablet_manager.cpp +++ b/be/src/olap/tablet_manager.cpp @@ -147,7 +147,7 @@ OLAPStatus TabletManager::_add_tablet_unlocked(TTabletId tablet_id, SchemaHash s res = _add_tablet_to_map_unlocked(tablet_id, schema_hash, tablet, update_meta, keep_files, true /*drop_old*/); } else { - res = OLAP_ERR_ENGINE_INSERT_EXISTS_TABLE; + res = OLAP_ERR_ENGINE_INSERT_OLD_TABLET; } LOG(WARNING) << "add duplicated tablet. force=" << force << ", res=" << res << ", tablet_id=" << tablet_id << ", schema_hash=" << schema_hash --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org