Erase location cache

This commit is contained in:
ym0
2022-01-04 11:10:21 +08:00
committed by LINxiansheng
parent d896138376
commit 70016c6a4e
3 changed files with 277 additions and 11 deletions

View File

@ -177,13 +177,33 @@ int ObFlushCacheExecutor::execute(ObExecContext& ctx, ObFlushCacheStmt& stmt)
case CACHE_TYPE_BLOCK:
case CACHE_TYPE_ROW:
case CACHE_TYPE_BLOOM_FILTER:
case CACHE_TYPE_LOCATION:
case CACHE_TYPE_CLOG:
case CACHE_TYPE_ILOG:
case CACHE_TYPE_SCHEMA: {
ret = OB_NOT_SUPPORTED;
LOG_WARN("cache type not supported flush", "type", stmt.flush_cache_arg_.cache_type_, K(ret));
} break;
case CACHE_TYPE_LOCATION: {
share::ObPartitionLocationCache *location_cache = GCTX.location_cache_;
if (OB_ISNULL(location_cache)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("location cache ptr is null", KR(ret));
} else if (0 == tenant_num) {
if (OB_FAIL(location_cache->flush_cache(OB_INVALID_TENANT_ID))) {
LOG_WARN("fail to flush all location cache", KR(ret));
}
} else {
int64_t tenant_num = stmt.flush_cache_arg_.tenant_ids_.count();
for (int64_t i = 0; i < tenant_num; i++) { // ingore error
const uint64_t tenant_id = stmt.flush_cache_arg_.tenant_ids_.at(i);
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = location_cache->flush_cache(tenant_id))) {
LOG_WARN("fail to flush tenant's cache", KR(ret), K(tenant_id));
}
ret = OB_SUCC(ret) ? tmp_ret : ret;
} // end for
}
} break;
default: {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid cache type", "type", stmt.flush_cache_arg_.cache_type_);