[cache][be]Fix the bug of cross-border access cache (#4639)
* When the different partition of the table is updated frequently, the partition key list of the cache is discontinuous, and the partition key in the request cannot hit the key list in the cache, resulting in the access overrun,the BE will crash. * Add some unit test case,add test cases that fail to hit the boundary value of cache
This commit is contained in:
17
be/src/runtime/cache/result_node.cpp
vendored
17
be/src/runtime/cache/result_node.cpp
vendored
@ -167,14 +167,19 @@ PCacheStatus ResultNode::fetch_partition(const PFetchCacheRequest* request,
|
||||
request->params(param_idx).partition_key() > (*part_it)->get_partition_key()) {
|
||||
part_it++;
|
||||
}
|
||||
while (param_idx < request->params_size() &&
|
||||
request->params(param_idx).partition_key() < (*part_it)->get_partition_key()) {
|
||||
param_idx++;
|
||||
}
|
||||
if (request->params(param_idx).partition_key() == (*part_it)->get_partition_key()) {
|
||||
find = true;
|
||||
if (part_it != _partition_list.end()) {
|
||||
while (param_idx < request->params_size() &&
|
||||
request->params(param_idx).partition_key() < (*part_it)->get_partition_key()) {
|
||||
param_idx++;
|
||||
}
|
||||
if (param_idx < request->params_size()) {
|
||||
if (request->params(param_idx).partition_key() == (*part_it)->get_partition_key()) {
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (find) {
|
||||
#ifdef PARTITION_CACHE_DEV
|
||||
LOG(INFO) << "Find! Param index : " << param_idx
|
||||
|
||||
Reference in New Issue
Block a user