diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index ffb5fc73fee9d4..af16d545db8a76 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 ac2d595367f8c6..75ad835afa8d17 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 19540f21093eae..475fbdd5b3fa43 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