Fixed: DatabaseUtil.getColumnInfo(...) does not retrieve primary keys due to

connection-locks
(OFBIZ-11312)

The method DatabaseUtil.getColumnInfo(...) uses an elaborate algorithm using a
List<Future<AbstractCountingCallable>> object. This does not work properly as it
runs into connection-locks. When debugging the error does not occur. I assume
that the slower pace of debugging prevents the error.

Thanks: Benjamin Jugl

# Conflicts:
#	framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
This commit is contained in:
Jacques Le Roux
2020-02-26 08:41:37 +01:00
parent f4d96deeca
commit d2128ffeaa
@@ -1157,13 +1157,13 @@ public class DatabaseUtil {
}
if (pkCount == 0) {
Debug.logInfo("Searching in " + tableNames.size() + " tables for primary key fields ...", module);
List<Future<AbstractCountingCallable>> pkFetcherFutures = new LinkedList<Future<AbstractCountingCallable>>();
for (String curTable: tableNames) {
curTable = curTable.substring(curTable.indexOf('.') + 1); //cut off schema name
pkFetcherFutures.add(executor.submit(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable)));
}
for (AbstractCountingCallable pkFetcherCallable: ExecutionPool.getAllFutures(pkFetcherFutures)) {
pkCount += pkFetcherCallable.updateData(messages);
try (ResultSet rsPks = dbData.getPrimaryKeys(null, lookupSchemaName, curTable)) {
pkCount += checkPrimaryKeyInfo(rsPks, lookupSchemaName, needsUpperCase, colInfo, messages);
} catch (Exception e1) {
Debug.logInfo("Error getting primary key info from database with % tableName." + e1.toString(), module);
}
}
}