This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release17.12
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/release17.12 by this push:
new 87c0907 Fixed: DatabaseUtil.getColumnInfo(...) does not retrieve primary keys due to connection-locks (OFBIZ-11312)
87c0907 is described below
commit 87c0907f88a3a30487112c9392820f193dce285b
Author: Jacques Le Roux <
[hidden email]>
AuthorDate: Wed Feb 26 08:50:56 2020 +0100
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.
jleroux: backport conflict handled by hand
Thanks: Benjamin Jugl
---
.../main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
index cbf4b7b..b8bf752 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
@@ -1161,13 +1161,12 @@ 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);
+ }
}
}