Skip to content

Commit 94c4a0a

Browse files
authored
Merge pull request #423 from IBM/Albert-Master-New2
issue #396 fix for derby dead lock issue
2 parents fc39c3d + 200a037 commit 94c4a0a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fhir-persistence-schema/src/main/java/com/ibm/fhir/schema/control/FhirResourceGroup.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ public void addLogicalResources(List<IDatabaseObject> group, String prefix) {
159159
.setTablespace(fhirTablespace)
160160
.addPrivileges(resourceTablePrivileges)
161161
.enableAccessControl(this.sessionVariable)
162+
// Add indexes to avoid dead lock issue of derby, and improve Db2 performance
163+
// Derby requires all columns used in where clause to be indexed, otherwise whole table lock will be
164+
// used instead of row lock, which can cause dead lock issue frequently during concurrent accesses.
165+
.addIndex(IDX + tableName + CURRENT_RESOURCE_ID, CURRENT_RESOURCE_ID)
166+
.addIndex(IDX + tableName + LOGICAL_ID, LOGICAL_ID)
162167
.build(model);
163168

164169
group.add(tbl);

0 commit comments

Comments
 (0)