[
https://issues.redhat.com/browse/ISPN-12323?page=com.atlassian.jira.plugi...
]
Evgenii Balakhonov commented on ISPN-12323:
-------------------------------------------
I attached patch for this problem. It changes the method
getIndexName() in class
org.infinispan.persistence.jdbc.impl.table.
OracleTableManager.
It work fine on production during 2 days ;)
My version of this method:
private static final String SEGMENT_INDEX_PREFIX = "IDX1";
@Override
public String getIndexName(boolean withIdentifier, String indexExt) {
if (indexExt.equals(timestampIndexExt)) {
// Timestamp for Oracle began with IDX, to keep backwards compatible we have to keep
using that
indexExt = TIMESTAMP_INDEX_PREFIX;
}
String plainTableName = tableName.toString().replace(identifierQuoteString,
"");
/* Oracle version 12.1 and below supports index names only 30 characters long.
If cache names have length greater that 15 and starts with same begin it possible
generation identical index names for different caches.
*/
if (metaData.getMajorVersion() * 100 + metaData.getMinorVersion() <= 1201 &&
indexExt.equals(segmentIndexExt) &&
plainTableName.length() + indexExt.length() + 1 > MAX_INDEX_IDENTIFIER_SIZE) {
indexExt = SEGMENT_INDEX_PREFIX;
}
int maxNameSize = MAX_INDEX_IDENTIFIER_SIZE - indexExt.length() - 1;
String truncatedName = plainTableName.length() > maxNameSize ?
plainTableName.substring(0, maxNameSize) : plainTableName;
String indexName = indexExt + "_" + truncatedName;
if (withIdentifier) {
return identifierQuoteString + indexName + identifierQuoteString;
}
return indexName;
}
Index creation error in Oracle 12.1 and below
---------------------------------------------
Key: ISPN-12323
URL:
https://issues.redhat.com/browse/ISPN-12323
Project: Infinispan
Issue Type: Bug
Components: Loaders and Stores
Affects Versions: 11.0.3.Final
Reporter: Evgenii Balakhonov
Priority: Major
Labels: infinispan-cachestore-jdbc
Attachments: 0030-ISPN-12323-Index-creation-error-in-Oracle-12.1-and-b.patch
I use JDBC cache store in Oracle 11.2. It works fine with Infinispan 9.4, but isn't
work with Infinispan 11. Infinispan can't create appropriate indexes because
they's names has dublicates during creation stage.
Reason of this problem is the code which don't generate properly names of indexes. In
the Oracle database version 12.1 and below maximum length of table or index name is 30
characters.
The constant segmentIndexExt which exists in the class
org.infinispan.persistence.jdbc.impl.table.AbstractTableManager has value
"segment_index" which is already 13 characters long.
Method getIndexName() of class
org.infinispan.persistence.jdbc.impl.table.OracleTableManager generates index name using
concatenation this constant and table name. If index name is longer that 30 characters
then method cuts it at the end.
Table name equals name of cache.
In case when somebody need create two caches which names are mostly same and longer that
15 characters, Infinispan tries to create indexes with same name.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)