CACHE_NOT_INITIALIZED error while using LOOKUP in Druid SQL

Hi,

I am trying to test the LOOKUP feature in druid. I have loaded the “Wikipedia edits” data available in Druid. Here are the steps I have followed

  1. Added the below configurations to all druid services

druid.lookup.lookupTierIsDatasource=false

druid.lookup.lookupTier=_default_tier

``

  1. Created a simple lookup file “lookup2.json” json as below

{“true”: 1}

{“false”: 2}

``

  1. Created lookup spec as below

{

“_default_tier”: {

“lookup2”: {

“version”: “v1”,

“lookupExtractorFactory”: {

“type”: “cachedNamespace”,

“extractionNamespace”: {

“type”: “uri”,

“uri”: “file:/home/druid/lookup2.json”,

“namespaceParseSpec”: {

“format”: “simpleJson”

},

“pollPeriod”: “PT30S”

},

“firstCacheTimeout”: 0

}

}

}

}

``

  1. Loaded the lookup from co-ordinator

[druid@pai-druid-master-01 ~]$ curl -H “Content-Type: application/json” --data @lookup_spec.json http://localhost:8081/druid/coordinator/v1/lookups/config

{"_default_tier":{“lookup2”:{“version”:“v1”,“lookupExtractorFactory”:{“type”:“cachedNamespace”,“extractionNamespace”:{“type”:“uri”,“uri”:“file:/home/druid/lookup2.json”,“namespaceParseSpec”:{“format”:“simpleJson”},“pollPeriod”:“PT30S”},“firstCacheTimeout”:0}}}}[druid@pai-druid-master-01 ~]$

``

  1. Checked the status of lookup in co-ordinator

[druid@pai-druid-master-01 ~]$ curl -X GET http://localhost:8081/druid/coordinator/v1/lookups/status/_default_tier

{“lookup2”:{“loaded”:true}}[druid@pai-druid-master-01 ~]$

``

  1. Checked the status of lookup in broker

[druid@pai-druid-query-01 broker]$ curl -X GET http://localhost:8082/druid/listen/v1/lookups

{“current”:{“lookup2”:{“version”:“v1”,“lookupExtractorFactory”:{“type”:“cachedNamespace”,“extractionNamespace”:{“type”:“uri”,“uri”:“file:/home/druid/lookup2.json”,“uriPrefix”:null,“fileRegex”:null,“namespaceParseSpec”:{“format”:“simpleJson”},“pollPeriod”:“PT30S”},“firstCacheTimeout”:0,“injective”:false}}},“toLoad”:{},“toDrop”:}[druid@pai-druid-query-01 broker]$

``

  1. Executed the below query

SELECT LOOKUP(isNew, ‘lookup2’), COUNT(*) FROM wikipedia GROUP BY 1;

``

Expected result : Succesful query execution.

Actual result:

Unknown exception / namespace [UriExtractionNamespace{uri=file:/home/druid/lookup2.json, uriPrefix=null, namespaceParseSpec=ObjectMapperFlatDataParser{}, fileRegex=‘null’, pollPeriod=PT30S}] : org.apache.druid.server.lookup.namespace.cache.CacheScheduler$EntryImpl@36c7900d: CACHE_NOT_INITIALIZED, extractorID = namespace-factory-UriExtractionNamespace{uri=file:/home/druid/lookup2.json, uriPrefix=null, namespaceParseSpec=ObjectMapperFlatDataParser{}, fileRegex=‘null’, pollPeriod=PT30S}-b3f88bbc-c420-4f1a-b146-0b221adbca68 / org.apache.druid.java.util.common.ISE

``

I have also enabled the cache in the broker by adding below settings to broker runtime.properties but even then, the same error happens

druid.broker.cache.useCache=true

druid.broker.cache.populateCache=true

druid.broker.cache.useResultLevelCache=true

druid.broker.cache.populateResultLevelCache=true

``

Can anyone help to resolve this?

Thanks!

Manu

Hi all,

Checking again. Does anyone have any idea what could be the failure described here ?

Thanks!

Manu

Hi Manu,

From the docs, “If you have NEVER configured lookups before, you MUST post an empty json object {} to /druid/coordinator/v1/lookups/config to initialize the configuration”. Can you try POSTing an empty json ?

Thanks,

Sashi

Also using unified console you can initialize the lookup by single click though the UI

Sorry to come back to this thread a little late.

@Sashi, I have tried posting an empty JSON to the coordinator and then tried posting the lookup. Post worked without any issues but while trying to use the lookup in SQL query, I am still getting the cache not initialized error.

Thanks!

Manu

I was able to fix this issue by adding the cache configurations to the common configuration file on all nodes.