Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1263,11 +1263,14 @@ public void indexDataClass(ExpDataClassImpl dataClass, SearchService.TaskIndexin
if (table == null)
return;

// Index the data class if it has never been indexed OR it has changed since it was last indexed
indexDataClassData(dataClass, q);

// GitHub Issue 783: Server lockup when updating data class domain design
// Index DataClass after data indexing, to avoid holding locks on exp.DataClass table for too long
SQLFragment sql = new SQLFragment("SELECT * FROM ")
.append(getTinfoDataClass(), "dc")
.append(" WHERE dc.LSID = ?").add(dataClass.getLSID())
.append(" AND (dc.lastIndexed IS NULL OR dc.lastIndexed < ?)")
.append(" AND (dc.lastIndexed IS NULL OR dc.lastIndexed < ?)") // Index the data class if it has never been indexed OR it has changed since it was last indexed
.add(dataClass.getModified());

DataClass dClass = new SqlSelector(getExpSchema().getScope(), sql).getObject(DataClass.class);
Expand All @@ -1276,8 +1279,6 @@ public void indexDataClass(ExpDataClassImpl dataClass, SearchService.TaskIndexin
ExpDataClassImpl impl = new ExpDataClassImpl(dClass);
impl.index(q, table);
}

indexDataClassData(dataClass, q);
});
}

Expand Down Expand Up @@ -8046,7 +8047,7 @@ public ValidationException updateDataClass(@NotNull Container c, @NotNull User u
if (!errors.hasErrors())
{
transaction.addCommitTask(() -> clearDataClassCache(c), DbScope.CommitTaskOption.IMMEDIATE, POSTCOMMIT, POSTROLLBACK);
transaction.addCommitTask(() -> indexDataClass(getDataClass(c, dataClass.getName()), SearchService.get().defaultTask().getQueue(c, SearchService.PRIORITY.modified)), POSTCOMMIT);
transaction.addCommitTask(() -> indexDataClass(dataClass, SearchService.get().defaultTask().getQueue(c, SearchService.PRIORITY.modified)), POSTCOMMIT);
transaction.commit();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ public void indexSampleType(ExpSampleType sampleType, SearchService.TaskIndexing
return;

queue.addRunnable((q) -> {
indexSampleTypeMaterials(sampleType, q);

// GitHub Issue 783: Server lockup when updating data class domain design
// Index MaterialSource after materials indexing, to avoid holding locks on exp.MaterialSource table for too long
// Index all ExpMaterial that have never been indexed OR where either the ExpSampleType definition or ExpMaterial itself has changed since last indexed
SQLFragment sql = new SQLFragment("SELECT * FROM ")
.append(getTinfoMaterialSource(), "ms")
Expand All @@ -345,8 +349,6 @@ public void indexSampleType(ExpSampleType sampleType, SearchService.TaskIndexing
ExpSampleTypeImpl impl = new ExpSampleTypeImpl(materialSource);
impl.index(q, null);
}

indexSampleTypeMaterials(sampleType, q);
});
}

Expand Down