gnodet-bot commented on code in PR #29479:
URL: https://github.com/apache/camel/pull/29479#discussion_r4515530252


##########
components/camel-state-store/camel-state-store/src/main/java/org/apache/camel/component/statestore/StateStoreComponent.java:
##########
@@ -110,10 +139,24 @@ KeyValueRepository getOrCreateBackend(String storeName, 
KeyValueRepository expli
                             storeName);
                 }
                 backend = new MemoryKeyValueRepository();
+                ServiceHelper.startService(backend);
+                return backend;
             }
-            ServiceHelper.startService(backend);
-            return backend;
         });
+        boolean existingNamespaced = result instanceof 
NamespacedKeyValueRepository;
+        if (existingNamespaced != namespaced && !(result instanceof 
MemoryKeyValueRepository && backendFactory == null)) {
+            LOG.warn("Store '{}' was already initialized with namespaced={}. 
Ignoring namespaced={} for this endpoint.",

Review Comment:
   ⚠️ **Spurious warning on first use of factory-created backends**
   
   When `backendFactory` is configured and creates a dedicated per-store 
backend, `result` is a plain (non-namespaced) `KeyValueRepository`. With 
`namespaced=true` (the default), `existingNamespaced` is `false`, so 
`existingNamespaced != namespaced` is `true`. The guard `!(result instanceof 
MemoryKeyValueRepository && backendFactory == null)` evaluates to `!(false && 
false)` = `true`, so the warning fires on **every first use** of every 
factory-created store — even though factory-backed stores are intentionally 
non-namespaced (documented in the PR description).
   
   The warning is misleading: it implies a configuration conflict when there is 
none.
   
   ```suggestion
           if (existingNamespaced != namespaced && backendFactory == null && 
!(result instanceof MemoryKeyValueRepository)) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to