[CP] force cache hastable for cs encoder to avoid frequently page fault

This commit is contained in:
saltonz 2024-06-21 12:52:58 +00:00 committed by ob-robot
parent e1dd490185
commit a8517e4167
4 changed files with 7 additions and 7 deletions

View File

@ -976,7 +976,7 @@ int ObMicroBlockCSEncoder::prescan_(const int64_t column_index)
if (OB_FAIL(ret)) {
// avoid overwirte ret
int temp_ret = OB_SUCCESS;
if (OB_SUCCESS != (temp_ret = hashtable_factory_.recycle(ht))) {
if (OB_SUCCESS != (temp_ret = hashtable_factory_.recycle(true, ht))) {
LOG_WARN("recycle hashtable failed", K(temp_ret));
}
}
@ -1271,7 +1271,7 @@ void ObMicroBlockCSEncoder::free_encoders_()
FOREACH(ht, hashtables_)
{
// should continue even fail
if (OB_FAIL(hashtable_factory_.recycle(*ht))) {
if (OB_FAIL(hashtable_factory_.recycle(true, *ht))) {
LOG_WARN("recycle hashtable failed", K(ret));
}
}

View File

@ -283,7 +283,7 @@ int ObEncodingHashTableFactory::create(const int64_t bucket_num, const int64_t n
return ret;
}
int ObEncodingHashTableFactory::recycle(ObEncodingHashTable *hashtable)
int ObEncodingHashTableFactory::recycle(const bool force_cache, ObEncodingHashTable *hashtable)
{
int ret = OB_SUCCESS;
if (NULL == hashtable) {
@ -292,7 +292,7 @@ int ObEncodingHashTableFactory::recycle(ObEncodingHashTable *hashtable)
} else if (!hashtable->created()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("hashtable not created", K(ret));
} else if (hashtable->get_node_cnt() >= MAX_CACHED_HASHTABLE_SIZE) {
} else if (!force_cache && hashtable->get_node_cnt() >= MAX_CACHED_HASHTABLE_SIZE) {
allocator_.free(hashtable);
} else {
if (OB_FAIL(hashtables_.push_back(hashtable))) {

View File

@ -301,7 +301,7 @@ public:
int create(const int64_t bucket_num, const int64_t node_num,
ObEncodingHashTable *&hashtable);
int recycle(ObEncodingHashTable *hashtable);
int recycle(const bool force_cache, ObEncodingHashTable *hashtable);
private:
void clear();

View File

@ -1246,7 +1246,7 @@ int ObMicroBlockEncoder::prescan(const int64_t column_index)
if (OB_FAIL(ret)) {
// avoid overwirte ret
int temp_ret = OB_SUCCESS;
if (OB_SUCCESS != (temp_ret = hashtable_factory_.recycle(ht))) {
if (OB_SUCCESS != (temp_ret = hashtable_factory_.recycle(false, ht))) {
LOG_WARN("recycle hashtable failed", K(temp_ret));
}
if (OB_SUCCESS != (temp_ret = multi_prefix_tree_factory_.recycle(prefix_tree))) {
@ -1829,7 +1829,7 @@ void ObMicroBlockEncoder::free_encoders()
}
FOREACH(ht, hashtables_) {
// should continue even fail
if (OB_FAIL(hashtable_factory_.recycle(*ht))) {
if (OB_FAIL(hashtable_factory_.recycle(false, *ht))) {
// overwrite ret
LOG_WARN("recycle hashtable failed", K(ret));
}