You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Shravya Nethula <sh...@aline-consulting.com> on 2019/01/07 07:42:46 UTC

Failing to create index on Ignite table column

Hi,

I successfully created an Ignite table named User. Now I want to create 3
indexes on id, cityId, age columns in User table. Indexes were successfully
created on id and cityId columns. But I am getting the following "duplicate
index found" error though I am trying to create index for the first time for
age column:

>>>>> Generated sql : CREATE INDEX  ON User (id asc)
>>>>> Successfully created index on id column

>>>>> Generated sql : CREATE INDEX  ON User (cityId asc)
>>>>> Successfully created index on cityId column

>>>>> Generated sql : CREATE INDEX  ON User (age asc)
>>>>> Failed to create index on age column
>>>>> Invalid schema state (duplicate index found): null

[12:34:52] (err) DDL operation failureSchemaOperationException [code=0,
msg=Invalid schema state (duplicate index found): null]
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.prepareChangeOnNotStartedCache(GridQueryProcessor.java:1104)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.startSchemaChange(GridQueryProcessor.java:627)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.onSchemaPropose(GridQueryProcessor.java:488)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.processCustomExchangeTask(GridCacheProcessor.java:378)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.processCustomTask(GridCachePartitionExchangeManager.java:2475)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2620)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2539)
	at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
	at java.lang.Thread.run(Thread.java:748)
javax.cache.CacheException: Invalid schema state (duplicate index found):
null
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:697)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:636)
	at
org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:388)
	at
net.aline.cloudedh.base.database.IgniteTable._createIndex(IgniteTable.java:99)
	at net.aline.cloudedh.base.database.BigTable.createIndex(BigTable.java:234)
	at net.aline.cloudedh.base.database.BigTable.createIndex(BigTable.java:246)
	at
net.aline.cloudedh.base.framework.DACEngine.createIndexOnTable(DACEngine.java:502)
	at
net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:24)
Caused by: class
org.apache.ignite.internal.processors.query.IgniteSQLException: Invalid
schema state (duplicate index found): null
	at
org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor.convert(DdlStatementsProcessor.java:644)
	at
org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor.runDdlStatement(DdlStatementsProcessor.java:505)
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2293)
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2209)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2135)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2130)
	at
org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2707)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2144)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:685)
	... 7 more

How can i resolve this issue?

Thanks.

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failing to create index on Ignite table column

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi,

Previously I used the following query: 
CREATE INDEX  ON User (age asc) 
In the above query, I explicitly didn't give the index name as I was
expecting Ignite to take its auto-generated index name. And it was throwing
"Invalid schema state (duplicate index found): null " exception.

Now I have explicitly given the index name and executed the following query:
CREATE INDEX User_age_asc_IDX ON User (age asc)
And it worked successfully.

Now I am able to create multiple indexes on columns one after the other
successfully (which wasn't the case previously). 

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: Failing to create index on Ignite table column

Posted by Stanislav Lukyanov <st...@gmail.com>.
Don’t think there is any Ignite API for that yet.

Stan

From: Shravya Nethula
Sent: 16 января 2019 г. 12:42
To: user@ignite.apache.org
Subject: RE: Failing to create index on Ignite table column

Hi Stan,

Thank you! This information is helpful.

Do you know any Ignite API through which I can get the indexes of a
particular table?

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


RE: Failing to create index on Ignite table column

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi Stan,

Thank you! This information is helpful.

Do you know any Ignite API through which I can get the indexes of a
particular table?

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: Failing to create index on Ignite table column

Posted by Stanislav Lukyanov <st...@gmail.com>.
I know one way to do that – connect via SQLLine and execute !indexes command.
Check out this doc https://apacheignite-sql.readme.io/docs/sqlline

Stan

From: Shravya Nethula
Sent: 7 января 2019 г. 13:49
To: user@ignite.apache.org
Subject: Re: Failing to create index on Ignite table column

Hi,

Is there any way to check the list of column names on which index has been
created for a particular table?

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Failing to create index on Ignite table column

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi,

Is there any way to check the list of column names on which index has been
created for a particular table?

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failing to create index on Ignite table column

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi,

We are using Ignite 2.7.0 version. Yes this issue is coming up each time I
try to create a new table and create indexes on some columns of the table.

The creation of indexes code occurs just after the table creation code. The
table is successfully created and indexes are created successfully on 1 or 2
columns. But for rest of the columns creation of index fails.

There were no exceptions during creation of table. 

Regards,
Shravya Nethula.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failing to create index on Ignite table column

Posted by Mikael <mi...@telia.com>.
Hi!

It does look very strange because it has null value for the index name, 
and it looks like it does a "x = map.put( indexname, entry)" in the code 
and if x is not null (index already exists) you will get that exception, 
but if the name of the index is null it's a bit strange that the map 
returns a non null value, but maybe I am looking at the wrong place in 
the source.

Does this happen every time you do it ? is this code executed just after 
you create the cache ? what version of Ignite ?

Have you checked that you did not get any exception when you created 
that cache ? the only things I can think of is if the binary marshaller 
did complain about your column names, it does not store the names, just 
a hash code so in theory you could get a name collision but if that was 
the case I think Ignite would complain when you created the cache.

Mikael

Den 2019-01-07 kl. 08:42, skrev Shravya Nethula:
> Hi,
>
> I successfully created an Ignite table named User. Now I want to create 3
> indexes on id, cityId, age columns in User table. Indexes were successfully
> created on id and cityId columns. But I am getting the following "duplicate
> index found" error though I am trying to create index for the first time for
> age column:
>
>>>>>> Generated sql : CREATE INDEX  ON User (id asc)
>>>>>> Successfully created index on id column
>>>>>> Generated sql : CREATE INDEX  ON User (cityId asc)
>>>>>> Successfully created index on cityId column
>>>>>> Generated sql : CREATE INDEX  ON User (age asc)
>>>>>> Failed to create index on age column
>>>>>> Invalid schema state (duplicate index found): null
> [12:34:52] (err) DDL operation failureSchemaOperationException [code=0,
> msg=Invalid schema state (duplicate index found): null]
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.prepareChangeOnNotStartedCache(GridQueryProcessor.java:1104)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.startSchemaChange(GridQueryProcessor.java:627)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.onSchemaPropose(GridQueryProcessor.java:488)
> 	at
> org.apache.ignite.internal.processors.cache.GridCacheProcessor.processCustomExchangeTask(GridCacheProcessor.java:378)
> 	at
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.processCustomTask(GridCachePartitionExchangeManager.java:2475)
> 	at
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2620)
> 	at
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2539)
> 	at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
> 	at java.lang.Thread.run(Thread.java:748)
> javax.cache.CacheException: Invalid schema state (duplicate index found):
> null
> 	at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:697)
> 	at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:636)
> 	at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:388)
> 	at
> net.aline.cloudedh.base.database.IgniteTable._createIndex(IgniteTable.java:99)
> 	at net.aline.cloudedh.base.database.BigTable.createIndex(BigTable.java:234)
> 	at net.aline.cloudedh.base.database.BigTable.createIndex(BigTable.java:246)
> 	at
> net.aline.cloudedh.base.framework.DACEngine.createIndexOnTable(DACEngine.java:502)
> 	at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:24)
> Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: Invalid
> schema state (duplicate index found): null
> 	at
> org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor.convert(DdlStatementsProcessor.java:644)
> 	at
> org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor.runDdlStatement(DdlStatementsProcessor.java:505)
> 	at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2293)
> 	at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2209)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2135)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2130)
> 	at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2707)
> 	at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2144)
> 	at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:685)
> 	... 7 more
>
> How can i resolve this issue?
>
> Thanks.
>
> Regards,
> Shravya Nethula.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>