Skip to content

Commit 60c89e4

Browse files
committed
CMR-10569: fixing granule index name bug
1 parent a5300db commit 60c89e4

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

elastic-utils-lib/src/cmr/elastic_utils/search/es_index_name_cache.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
(let [index-names-map (fetch-concept-type-index-names context)
6464
index-names (:index-names index-names-map)
6565
cache (hcache/context->cache context index-names-cache-key)]
66+
(info (str "Refreshing search index-names cache - index-names: " index-names))
6667
(hcache/set-values cache index-names-cache-key index-names)
6768
(hcache/set-value cache
6869
index-names-cache-key

indexer-app/src/cmr/indexer/data/collection_granule_aggregation_cache.clj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,17 @@
245245
(defn refresh-cache
246246
"Refreshes the collection granule aggregates in the cache."
247247
[context granules-updated-in-last-n]
248-
(let [_cache (c/context->cache context coll-gran-aggregate-cache-key)]
248+
(let [_cache (c/context->cache context coll-gran-aggregate-cache-key)
249+
start (System/currentTimeMillis)]
250+
(if granules-updated-in-last-n
251+
(info "Refreshing partial collection granule aggregates cache.")
252+
(info "Refreshing full collection granule aggregates cache."))
249253
(if granules-updated-in-last-n
250254
(partial-cache-refresh context granules-updated-in-last-n)
251-
(full-cache-refresh context))))
255+
(full-cache-refresh context))
256+
(if granules-updated-in-last-n
257+
(info (format "Refreshed partial collection granule aggregates cache took %d ms" (- (System/currentTimeMillis) start)))
258+
(info (format "Refreshed full collection granule aggregates cache took %d ms" (- (System/currentTimeMillis) start))))))
252259

253260
(defn get-coll-gran-aggregates
254261
"Returns the map of granule aggregate information for the collection. Will return nil if the

search-app/src/cmr/search/data/elastic_search_index.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[cmr.common.concepts :as concepts]
66
[cmr.common.config :as cfg :refer [defconfig]]
77
[cmr.common.hash-cache :as hcache]
8+
[cmr.common.util :as util]
89
[cmr.common.services.errors :as e]
910
[cmr.common.services.search.query-model :as qm]
1011
[cmr.elastic-utils.search.es-index :as common-esi]
@@ -40,15 +41,16 @@
4041
rebalancing-collections (hcache/get-value cache cache-key :rebalancing-collections)]
4142
(apply dissoc granule-index-names (map keyword rebalancing-collections))))
4243
(comment
43-
(keyword "word")
44+
(println indexes)
4445
)
4546
(defn- collection-concept-id->index-name
4647
"Return the granule index name for the input collection concept id"
4748
[indexes coll-concept-id]
4849
(def indexes indexes)
4950
(def coll-concept-id coll-concept-id)
5051
(get indexes (keyword coll-concept-id) (if (cfg/provider-granules)
51-
(get indexes (keyword (str "granule_" (concepts/concept-id->provider-id coll-concept-id))))
52+
(get indexes (keyword (str "granules_" (util/safe-lowercase
53+
(concepts/concept-id->provider-id coll-concept-id)))))
5254
(get indexes :small_collections))))
5355

5456
(defn- collection-concept-ids->index-names
@@ -57,6 +59,9 @@
5759
(let [indexes (get-granule-index-names context)]
5860
(distinct (map #(collection-concept-id->index-name indexes %) coll-concept-ids))))
5961

62+
(comment
63+
(println context)
64+
)
6065
(defn- provider-ids->index-names
6166
"Return the granule index names for the input provider-ids"
6267
[context provider-ids]

0 commit comments

Comments
 (0)