ECC-1898: Remove alias from cache

This commit is contained in:
Eugen Betke 2024-10-23 19:09:48 +02:00
parent 879f5b0aea
commit 9363aa9241
1 changed files with 9 additions and 0 deletions

View File

@ -137,6 +137,8 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
if (x->name_space_ == NULL)
x->name_space_ = act->name_space;
// TODO(maee): Make sure that the accessor is added to the trie
grib_context_log(p->h->context, GRIB_LOG_DEBUG, "alias: add only namespace: %s.%s",
act->name_space, act->name);
i = 0;
@ -178,6 +180,13 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
act->name_space, act->name, y->name_);
/* printf("[%s %s]\n",y->all_names_[i], y->all_name_spaces_[i]); */
// ECC-1898: Remove accessor from cache
grib_handle* hand = grib_handle_of_accessor(y);
if (hand->use_trie && y->all_name_spaces_[i] != NULL && strcmp(y->name_, act->name) != 0) {
int id = grib_hash_keys_get_id(hand->context->keys, act->name);
hand->accessors[id] = NULL;
}
while (i < MAX_ACCESSOR_NAMES - 1) {
y->all_names_[i] = y->all_names_[i + 1];
y->all_name_spaces_[i] = y->all_name_spaces_[i + 1];