Remove VersionHash used to comparison in BE (#2622)

This commit is contained in:
lichaoyong
2019-12-31 19:38:45 +08:00
committed by GitHub
parent 13733d91e3
commit 4c5b0b6dc9
5 changed files with 2 additions and 47 deletions

View File

@ -78,8 +78,6 @@ Status OlapScanner::_prepare(
strtoul(scan_range.schema_hash.c_str(), nullptr, 10);
_version =
strtoul(scan_range.version.c_str(), nullptr, 10);
VersionHash version_hash =
strtoul(scan_range.version_hash.c_str(), nullptr, 10);
{
std::string err;
_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(tablet_id, schema_hash, true, &err);
@ -101,18 +99,6 @@ Status OlapScanner::_prepare(
return Status::InternalError(ss.str());
}
if (rowset->end_version() == _version
&& rowset->version_hash() != version_hash) {
LOG(WARNING) << "fail to check latest version hash. "
<< " tablet_id=" << tablet_id
<< " version_hash=" << rowset->version_hash()
<< " request_version_hash=" << version_hash;
std::stringstream ss;
ss << "fail to check version hash of tablet: " << tablet_id;
return Status::InternalError(ss.str());
}
// acquire tablet rowset readers at the beginning of the scan node
// to prevent this case: when there are lots of olap scanners to run for example 10000
// the rowsets maybe compacted when the last olap scanner starts

View File

@ -394,15 +394,10 @@ OLAPStatus SnapshotManager::_create_snapshot_files(
// get snapshot version, use request.version if specified
int32_t version = lastest_version->end_version();
if (request.__isset.version) {
if (lastest_version->end_version() < request.version
|| (lastest_version->start_version() == lastest_version->end_version()
&& lastest_version->end_version() == request.version
&& lastest_version->version_hash() != request.version_hash)) {
if (lastest_version->end_version() < request.version) {
LOG(WARNING) << "invalid make snapshot request. "
<< " version=" << lastest_version->end_version()
<< " version_hash=" << lastest_version->version_hash()
<< " req_version=" << request.version
<< " req_version_hash=" << request.version_hash;
<< " req_version=" << request.version;
res = OLAP_ERR_INPUT_PARAMETER_ERROR;
break;
}

View File

@ -711,23 +711,6 @@ const uint32_t Tablet::calc_base_compaction_score() const {
return base_rowset_exist ? score : 0;
}
OLAPStatus Tablet::compute_all_versions_hash(const vector<Version>& versions,
VersionHash* version_hash) const {
DCHECK(version_hash != nullptr) << "invalid parameter, version_hash is nullptr";
int64_t v_hash = 0L;
for (auto version : versions) {
auto it = _rs_version_map.find(version);
if (it == _rs_version_map.end()) {
LOG(WARNING) << "fail to find Rowset. "
<< "version=" << version.first << "-" << version.second;
return OLAP_ERR_TABLE_VERSION_INDEX_MISMATCH_ERROR;
}
v_hash ^= it->second->version_hash();
}
*version_hash = v_hash;
return OLAP_SUCCESS;
}
void Tablet::compute_version_hash_from_rowsets(
const std::vector<RowsetSharedPtr>& rowsets, VersionHash* version_hash) const {
DCHECK(version_hash != nullptr) << "invalid parameter, version_hash is nullptr";

View File

@ -182,8 +182,6 @@ public:
bool can_do_compaction();
const uint32_t calc_cumulative_compaction_score() const;
const uint32_t calc_base_compaction_score() const;
OLAPStatus compute_all_versions_hash(const std::vector<Version>& versions,
VersionHash* version_hash) const;
void compute_version_hash_from_rowsets(const std::vector<RowsetSharedPtr>& rowsets,
VersionHash* version_hash) const;

View File

@ -72,13 +72,6 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {
return OLAP_ERR_VERSION_NOT_EXIST;
}
if (message->end_version() == _version
&& message->version_hash() != _version_hash) {
OLAP_LOG_WARNING("fail to check latest version hash. "
"[res=%d tablet_id=%ld version_hash=%ld request_version_hash=%ld]",
res, _tablet_id, message->version_hash(), _version_hash);
return OLAP_ERR_CE_CMD_PARAMS_ERROR;
}
OLAPStatus acquire_reader_st = tablet->capture_rs_readers(reader_params.version, &reader_params.rs_readers);
if (acquire_reader_st != OLAP_SUCCESS) {
LOG(WARNING) << "fail to init reader. tablet=" << tablet->full_name()