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.
This commit is contained in:
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user