sentry-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergio Peña (JIRA) <>
Subject [jira] [Reopened] (SENTRY-2011) Oracle does not allow creating more than one index on the same column
Date Fri, 08 Dec 2017 16:38:00 GMT


Sergio Peña reopened SENTRY-2011:

> Oracle does not allow creating more than one index on the same column
> ---------------------------------------------------------------------
>                 Key: SENTRY-2011
>                 URL:
>             Project: Sentry
>          Issue Type: Bug
>          Components: Sentry
>    Affects Versions: 2.0.0
>            Reporter: Na Li
>            Assignee: Na Li
>             Fix For: 2.0.0
>         Attachments: SENTRY-2011.001.patch
> When running sentry on Oracle DB with dataNucleus 4, we see a lot of exceptions that
the column list already indexed when adding unique index.
> I suspect the oracle sql command failure is caused by the fact that
> 1) Oracle does not allow indexing the same column twice. "Cause: You tried to create
an index on a set of columns in a table, but you've already indexed this set of columns."
based on However, MySql allows this
> 2) Sentry defined the unique index for column "USER_NAME" in table "SENTRY_USER" at sentry-oracle-2.0.0.sql,
so a unique index will be created when this sql runs
> 3) Sentry specifies the field "roleName" as unique in table "MSentryRole" (which corresponds
to DB column "USER_NAME" in DB table "SENTRY_USER" in dataNucleus configuration package.jdo.
Therefore datanucleus tries to add another unique index to column "USER_NAME" in table "SENTRY_USER"
when dataNucleus runs. Oracle throws exception since a unique index is already created by
sql script.
> The reason it does not show in previous sentry version is because sentry was using datanucleus
3 before. Now, in sentry 2.0, sentry moves up to dataNucleus 4, and dataNucleus 4 verifies
the data and creates indexes, and therefore triggers the issue above.
> The fix is to remove the unique index in datanucleus.
> call stack below--------------
> {code}
> sentry has serious issue with database when creating unique index
Error Msg = ORA-01408: such column list already indexed
> 8:52:07.632 AM	ERROR	Datastore	
> An exception was thrown while adding/validating class(es) : ORA-01408: such column list
already indexed
> java.sql.SQLException: ORA-01408: such column list already indexed
> at oracle.jdbc.driver.T4CTTIoer11.processError(
> at oracle.jdbc.driver.T4CTTIoer11.processError(
> at oracle.jdbc.driver.T4C8Oall.processError(
> at oracle.jdbc.driver.T4CTTIfun.receive(
> at oracle.jdbc.driver.T4CTTIfun.doRPC(
> at oracle.jdbc.driver.T4C8Oall.doOALL(
> at oracle.jdbc.driver.T4CStatement.doOall8(
> at oracle.jdbc.driver.T4CStatement.doOall8(
> at oracle.jdbc.driver.T4CStatement.executeForRows(
> at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
> at oracle.jdbc.driver.OracleStatement.executeInternal(
> at oracle.jdbc.driver.OracleStatement.execute(
> at oracle.jdbc.driver.OracleStatementWrapper.execute(
> at com.jolbox.bonecp.StatementHandle.execute(
> at
> at
> at
> at
> at
> at$ClassAdder.performTablesValidation(
> at$
> at
> at
> at
> at
> at
> at
> at
> at
> at
> at org.datanucleus.api.jdo.JDOQuery.executeInternal(
> at org.datanucleus.api.jdo.JDOQuery.execute(
> at org.apache.sentry.provider.db.service.persistent.SentryStore.getAllRoles(
> at org.apache.sentry.provider.db.service.persistent.SentryStore.access$1600(
> at org.apache.sentry.provider.db.service.persistent.SentryStore$33.execute(
> at org.apache.sentry.provider.db.service.persistent.SentryStore$33.execute(
> {code}
> Many of the index names in package.jdo for dataNucleus are different from the corresponding
index names in sql script. 
> If dataNucleus is configured to add schema info into DB, it will result in creating additional
index for the same purpose in some DB (like MySql), or cause exception for other DB (like
Oracle). It is better to keep the index name in package.jdo the same as what's in sql script.
So only one index is created in DB. 

This message was sent by Atlassian JIRA

View raw message