From 9363aa9241026c470e91550d06f64260d3b01139 Mon Sep 17 00:00:00 2001 From: Eugen Betke Date: Wed, 23 Oct 2024 19:09:48 +0200 Subject: [PATCH] ECC-1898: Remove alias from cache --- src/action_class_alias.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/action_class_alias.cc b/src/action_class_alias.cc index 3ae756cbe..b5bf7f179 100644 --- a/src/action_class_alias.cc +++ b/src/action_class_alias.cc @@ -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];