Skip to content
Permalink
Browse files
[fix](schema_hash) Fix bug that introduced by removing schema_hash (#…
  • Loading branch information
caiconghui committed May 8, 2022
1 parent c633402 commit 580ce38a3fa3dfb4b3fa2a83f06d2f3ff0efda35
Showing 8 changed files with 26 additions and 33 deletions.
@@ -1637,8 +1637,8 @@ void TaskWorkerPool::_submit_table_compaction_worker_thread_callback() {
compaction_type = CompactionType::CUMULATIVE_COMPACTION;
}

TabletSharedPtr tablet_ptr = StorageEngine::instance()->tablet_manager()->get_tablet(
compaction_req.tablet_id, compaction_req.schema_hash);
TabletSharedPtr tablet_ptr =
StorageEngine::instance()->tablet_manager()->get_tablet(compaction_req.tablet_id);
if (tablet_ptr != nullptr) {
auto data_dir = tablet_ptr->data_dir();
if (!tablet_ptr->can_do_compaction(data_dir->path_hash(), compaction_type)) {
@@ -461,8 +461,7 @@ Status DataDir::load() {
// ignore any errors when load tablet or rowset, because fe will repair them after report
int64_t invalid_rowset_counter = 0;
for (auto rowset_meta : dir_rowset_metas) {
TabletSharedPtr tablet = _tablet_manager->get_tablet(rowset_meta->tablet_id(),
rowset_meta->tablet_schema_hash());
TabletSharedPtr tablet = _tablet_manager->get_tablet(rowset_meta->tablet_id());
// tablet maybe dropped, but not drop related rowset meta
if (tablet == nullptr) {
VLOG_NOTICE << "could not find tablet id: " << rowset_meta->tablet_id()
@@ -70,19 +70,17 @@ Status SnapshotManager::make_snapshot(const TSnapshotRequest& request, string* s
return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
}

TabletSharedPtr ref_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.tablet_id, request.schema_hash);
TabletSharedPtr ref_tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.tablet_id);
if (ref_tablet == nullptr) {
LOG(WARNING) << "failed to get tablet. tablet=" << request.tablet_id
<< " schema_hash=" << request.schema_hash;
LOG(WARNING) << "failed to get tablet. tablet=" << request.tablet_id;
return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
}

res = _create_snapshot_files(ref_tablet, request, snapshot_path, allow_incremental_clone);

if (!res.ok()) {
LOG(WARNING) << "failed to make snapshot. res=" << res << " tablet=" << request.tablet_id
<< " schema_hash=" << request.schema_hash;
LOG(WARNING) << "failed to make snapshot. res=" << res << " tablet=" << request.tablet_id;
return res;
}

@@ -73,8 +73,8 @@ Status StorageMigrationV2Handler::process_storage_migration_v2(
<< ", new_tablet_id=" << request.new_tablet_id
<< ", migration_version=" << request.migration_version;

TabletSharedPtr base_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.base_tablet_id, request.base_schema_hash);
TabletSharedPtr base_tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.base_tablet_id);
if (base_tablet == nullptr) {
LOG(WARNING) << "fail to find base tablet. base_tablet=" << request.base_tablet_id;
return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
@@ -96,21 +96,19 @@ Status StorageMigrationV2Handler::process_storage_migration_v2(
Status StorageMigrationV2Handler::_do_process_storage_migration_v2(
const TStorageMigrationReqV2& request) {
Status res = Status::OK();
TabletSharedPtr base_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.base_tablet_id, request.base_schema_hash);
TabletSharedPtr base_tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.base_tablet_id);
if (base_tablet == nullptr) {
LOG(WARNING) << "fail to find base tablet. base_tablet=" << request.base_tablet_id
<< ", base_schema_hash=" << request.base_schema_hash;
LOG(WARNING) << "fail to find base tablet. base_tablet=" << request.base_tablet_id;
return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
}

// new tablet has to exist
TabletSharedPtr new_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.new_tablet_id, request.new_schema_hash);
TabletSharedPtr new_tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.new_tablet_id);
if (new_tablet == nullptr) {
LOG(WARNING) << "fail to find new tablet."
<< " new_tablet=" << request.new_tablet_id
<< ", new_schema_hash=" << request.new_schema_hash;
<< " new_tablet=" << request.new_tablet_id;
return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
}

@@ -103,8 +103,7 @@ Status EngineBatchLoadTask::_init() {

// Check replica exist
TabletSharedPtr tablet;
tablet = StorageEngine::instance()->tablet_manager()->get_tablet(_push_req.tablet_id,
_push_req.schema_hash);
tablet = StorageEngine::instance()->tablet_manager()->get_tablet(_push_req.tablet_id);
if (tablet == nullptr) {
LOG(WARNING) << "get tables failed. "
<< "tablet_id: " << _push_req.tablet_id
@@ -290,8 +289,8 @@ Status EngineBatchLoadTask::_push(const TPushReq& request,
return Status::OLAPInternalError(OLAP_ERR_CE_CMD_PARAMS_ERROR);
}

TabletSharedPtr tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.tablet_id, request.schema_hash);
TabletSharedPtr tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.tablet_id);
if (tablet == nullptr) {
LOG(WARNING) << "false to find tablet. tablet=" << request.tablet_id
<< ", schema_hash=" << request.schema_hash;
@@ -352,11 +351,10 @@ Status EngineBatchLoadTask::_delete_data(const TPushReq& request,
}

// 1. Get all tablets with same tablet_id
TabletSharedPtr tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
request.tablet_id, request.schema_hash);
TabletSharedPtr tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(request.tablet_id);
if (tablet == nullptr) {
LOG(WARNING) << "can't find tablet. tablet=" << request.tablet_id
<< ", schema_hash=" << request.schema_hash;
LOG(WARNING) << "can't find tablet. tablet=" << request.tablet_id;
return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
}

@@ -76,8 +76,8 @@ Status EngineCloneTask::_do_clone() {
string src_file_path;
TBackend src_host;
// Check local tablet exist or not
TabletSharedPtr tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
_clone_req.tablet_id, _clone_req.schema_hash);
TabletSharedPtr tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(_clone_req.tablet_id);
bool is_new_tablet = tablet == nullptr;
// try to repair a tablet with missing version
if (tablet != nullptr) {
@@ -118,8 +118,8 @@ Status EnginePublishVersionTask::finish() {
if (!_publish_version_req.strict_mode) {
break;
}
TabletSharedPtr tablet = StorageEngine::instance()->tablet_manager()->get_tablet(
tablet_info.tablet_id, tablet_info.schema_hash);
TabletSharedPtr tablet =
StorageEngine::instance()->tablet_manager()->get_tablet(tablet_info.tablet_id);
if (tablet == nullptr) {
_error_tablet_ids->push_back(tablet_info.tablet_id);
} else {
@@ -498,7 +498,7 @@ private void addScanRangeLocations(Partition partition,
TScanRangeLocations scanRangeLocations = new TScanRangeLocations();
TPaloScanRange paloRange = new TPaloScanRange();
paloRange.setDbName("");
paloRange.setSchemaHash("");
paloRange.setSchemaHash("0");
paloRange.setVersion(visibleVersionStr);
paloRange.setVersionHash("");
paloRange.setTabletId(tabletId);

0 comments on commit 580ce38

Please sign in to comment.