Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-16354

Unable to use camelCase table names and columns in cache configuration file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 15.1.0.Dev03, 15.0.8.Final
    • None
    • Core
    • None
    • Hide
      1. Navigate to the Server Management Console
      2. Press the Create Cache button to create a cache
      3. Give the cache a name and select the "Add cache configuration" radio button
      4. Using XML, JSON, or YAML format, attempt to add a cache configuration file which has  sql in the queries section (select-all, select-single, etc.) that has camelCase table names and column names.
      5. Example:  
        "select-all": "select * from sde.\"ProductPlan\";" 

         

      1. You can also try doing this programmatically through the CacheConfigurationBuilder 
      Show
      Navigate to the Server Management Console Press the Create Cache button to create a cache Give the cache a name and select the "Add cache configuration" radio button Using XML, JSON, or YAML format, attempt to add a cache configuration file which has  sql in the queries section (select-all, select-single, etc.) that has camelCase table names and column names. Example:   "select-all" : "select * from sde.\" ProductPlan\ ";"   You can also try doing this programmatically through the CacheConfigurationBuilder 

      I have a remote cache that uses an xml file to define the config properties for a persistent replicated cache. For the persistence component I am using <query-jdbc-store>. The database I am trying to connect to is a Postgres database with camelCase table names. Because the tables and columns are camelCase, the sql that is used for the <queries> section of the config file (like select-single, select-all, size, etc.) needs to use double quotes in the sql syntax. For example: 'SELECT plan."systemAccount", plan."yearMonth" FROM sde."ProductPlan"'; 

      Currently, Infinispan is unable to parse these double quotes even if the parameter value is enclosed in a single quote. Example: `"select-all": 'select c."systemAccount"...`

      This is the error that I get from the Infinispan server (you get this using xml, json, or yaml file formats for the config since these are all converted to xml on runtime): 

      Caused by: org.infinispan.commons.CacheListenerException: ISPN000280: Caught exception [org.infinispan.commons.configuration.io.xml.XmlPullParserException] while invoking method [public java.util.concurrent.CompletionStage org.infinispan.globalstate.impl.GlobalConfigurationStateListener.handleCreate(org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent)] on listener instance: org.infinispan.globalstate.impl.GlobalConfigurationStateListener@4b3206df
              at org.infinispan.notifications.impl.AbstractListenerImpl$ListenerInvocationImpl.lambda$invoke$1(AbstractListenerImpl.java:437)
              at org.infinispan.notifications.impl.AbstractListenerImpl$ListenerInvocationImpl.invoke(AbstractListenerImpl.java:457)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl$BaseCacheEntryListenerInvocation.doRealInvocation(CacheNotifierImpl.java:1793)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl$BaseCacheEntryListenerInvocation.doRealInvocation(CacheNotifierImpl.java:1789)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl$BaseCacheEntryListenerInvocation.invokeNoChecks(CacheNotifierImpl.java:1784)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl$BaseCacheEntryListenerInvocation.invoke(CacheNotifierImpl.java:1757)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl.doNotifyCreated(CacheNotifierImpl.java:428)
              at org.infinispan.notifications.cachelistener.CacheNotifierImpl.notifyCacheEntryCreated(CacheNotifierImpl.java:410)
              at org.infinispan.notifications.cachelistener.NotifyHelper.entryCommitted(NotifyHelper.java:63)
              at org.infinispan.interceptors.locking.ClusteringDependentLogic$ReplicationLogic.commitSingleEntry(ClusteringDependentLogic.java:505)
              at org.infinispan.interceptors.locking.ClusteringDependentLogic$AbstractClusteringDependentLogic.commitEntry(ClusteringDependentLogic.java:239)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntry(EntryWrappingInterceptor.java:611)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitEntryIfNeeded(EntryWrappingInterceptor.java:884)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.commitContextEntries(EntryWrappingInterceptor.java:591)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.applyChanges(EntryWrappingInterceptor.java:685)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.applyAndFixVersion(EntryWrappingInterceptor.java:737)
              at org.infinispan.interceptors.SyncInvocationStage.thenApply(SyncInvocationStage.java:44)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:732)
              at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitPutKeyValueCommand(EntryWrappingInterceptor.java:335)
              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:65)
              at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndFinally(BaseAsyncInterceptor.java:154)
              at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lambda$nonTxLockAndInvokeNext$3(AbstractLockingInterceptor.java:318)
              at org.infinispan.interceptors.SyncInvocationStage.andHandle(SyncInvocationStage.java:69)
              at org.infinispan.interceptors.locking.AbstractLockingInterceptor.nonTxLockAndInvokeNext(AbstractLockingInterceptor.java:313)
              at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitNonTxDataWriteCommand(AbstractLockingInterceptor.java:138)
              at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitDataWriteCommand(NonTransactionalLockingInterceptor.java:41)
              at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand(AbstractLockingInterceptor.java:82)
              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:65)
              at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndHandle(BaseAsyncInterceptor.java:187)
              at org.infinispan.statetransfer.StateTransferInterceptor.handleNonTxWriteCommand(StateTransferInterceptor.java:312)
              at org.infinispan.statetransfer.StateTransferInterceptor.handleWriteCommand(StateTransferInterceptor.java:256)
              at org.infinispan.statetransfer.StateTransferInterceptor.visitPutKeyValueCommand(StateTransferInterceptor.java:96)
              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:65)
              at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext(BaseAsyncInterceptor.java:58)
              at org.infinispan.interceptors.impl.CacheMgmtInterceptor.updateStoreStatistics(CacheMgmtInterceptor.java:233)
              at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitPutKeyValueCommand(CacheMgmtInterceptor.java:196)
              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:65)
              at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext(BaseAsyncInterceptor.java:58)
              at org.infinispan.interceptors.DDAsyncInterceptor.handleDefault(DDAsyncInterceptor.java:54)
              at org.infinispan.interceptors.DDAsyncInterceptor.visitPutKeyValueCommand(DDAsyncInterceptor.java:60)
              at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:65)
              at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndExceptionally(BaseAsyncInterceptor.java:127)
              at org.infinispan.interceptors.impl.InvocationContextInterceptor.visitCommand(InvocationContextInterceptor.java:90)
              at org.infinispan.interceptors.impl.AsyncInterceptorChainImpl.invokeAsync(AsyncInterceptorChainImpl.java:211)
              at org.infinispan.cache.impl.InvocationHelper.doInvokeAsync(InvocationHelper.java:318)
              at org.infinispan.cache.impl.InvocationHelper.invokeAsync(InvocationHelper.java:156)
              at org.infinispan.cache.impl.InvocationHelper.invokeAsync(InvocationHelper.java:139)
              at org.infinispan.cache.impl.CacheImpl.putIfAbsentAsync(CacheImpl.java:1490)
              at org.infinispan.cache.impl.CacheImpl.putIfAbsentAsync(CacheImpl.java:1483)
              at org.infinispan.cache.impl.CacheImpl.putIfAbsentAsync(CacheImpl.java:454)
              at org.infinispan.cache.impl.AbstractDelegatingCache.putIfAbsentAsync(AbstractDelegatingCache.java:211)
              at org.infinispan.cache.impl.AbstractDelegatingCache.putIfAbsentAsync(AbstractDelegatingCache.java:211)
              at org.infinispan.cache.impl.EncoderCache.putIfAbsentAsync(EncoderCache.java:298)
              at org.infinispan.security.impl.SecureCacheImpl.putIfAbsentAsync(SecureCacheImpl.java:281)
              at org.infinispan.globalstate.impl.GlobalConfigurationManagerImpl.createCacheInternal(GlobalConfigurationManagerImpl.java:293)
              at org.infinispan.globalstate.impl.GlobalConfigurationManagerImpl.createCache(GlobalConfigurationManagerImpl.java:274)
              at org.infinispan.globalstate.impl.GlobalConfigurationManagerImpl.getOrCreateCache(GlobalConfigurationManagerImpl.java:238)
              ... 13 more
      Caused by: org.infinispan.commons.configuration.io.xml.XmlPullParserException: expected = after attribute name (position: END_TAG seen ...ect-single="select pl.id as idProviderLimits, c."systemAccount"... @1:707) 
              at org.infinispan.commons.configuration.io.xml.MXParser.parseAttribute(MXParser.java:1756)
              at org.infinispan.commons.configuration.io.xml.MXParser.parseStartTag(MXParser.java:1551)
              at org.infinispan.commons.configuration.io.xml.MXParser.nextImpl(MXParser.java:1029)
              at org.infinispan.commons.configuration.io.xml.MXParser.next(MXParser.java:907)
              at org.infinispan.commons.configuration.io.xml.XmlConfigurationReader.hasNext(XmlConfigurationReader.java:90)
              at org.infinispan.commons.configuration.io.ConfigurationReader.inTag(ConfigurationReader.java:152)
              at org.infinispan.persistence.sql.configuration.SqlStoreConfigurationParser.parseQueryJdbcStore(SqlStoreConfigurationParser.java:85)
              at org.infinispan.persistence.sql.configuration.SqlStoreConfigurationParser.readElement(SqlStoreConfigurationParser.java:38)
              at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:212)
              at org.infinispan.configuration.parsing.ConfigurationBuilderHolder.handleAnyElement(ConfigurationBuilderHolder.java:150)
              at org.infinispan.commons.configuration.io.AbstractConfigurationReader.handleAny(AbstractConfigurationReader.java:66)
              at org.infinispan.configuration.parsing.CacheParser.parsePersistence(CacheParser.java:936)
              at org.infinispan.configuration.parsing.CacheParser.parseCacheElement(CacheParser.java:353)
              at org.infinispan.configuration.parsing.CacheParser.parseSharedStateCacheElement(CacheParser.java:203)
              at org.infinispan.configuration.parsing.CacheParser.parseReplicatedCache(CacheParser.java:779)
              at org.infinispan.configuration.parsing.CacheParser.readElement(CacheParser.java:112)
              at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:212)
              at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:195)
              at org.infinispan.globalstate.impl.GlobalConfigurationManagerImpl.buildConfiguration(GlobalConfigurationManagerImpl.java:338)
              at org.infinispan.globalstate.impl.GlobalConfigurationManagerImpl.createCacheLocally(GlobalConfigurationManagerImpl.java:310)
              at org.infinispan.globalstate.impl.GlobalConfigurationStateListener.handleCreate(GlobalConfigurationStateListener.java:46)
              at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
              at java.base/java.lang.reflect.Method.invoke(Method.java:580)
              at org.infinispan.notifications.impl.AbstractListenerImpl$ListenerInvocationImpl.lambda$invoke$1(AbstractListenerImpl.java:431)
              ... 69 more

      Chat history: https://infinispan.zulipchat.com/#narrow/stream/118645-infinispan/topic/How.20to.20escape.20double.20quotes.20in.20xml.20config.20file

              ttarrant@redhat.com Tristan Tarrant
              eli.lawrence Eli Lawrence (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: