Skip to content

Unify locking logic in AssignImmutableWorkspaceStep #34705

@asodja

Description

@asodja

In

if (lockingStrategy == LockingStrategy.WORKSPACE_LOCK) {
LockingImmutableWorkspace workspace = workspaceProvider.getLockingWorkspace(uniqueId);
return workspace.withWorkspaceLock(() ->
loadImmutableWorkspaceIfExists(work, workspace)
.orElseGet(() -> {
deleteStaleFiles(workspace.getImmutableLocation());
return executeInWorkspace(work, context, workspace.getImmutableLocation());
})
);
} else {
AtomicMoveImmutableWorkspace workspace = workspaceProvider.getAtomicMoveWorkspace(uniqueId);
return loadImmutableWorkspaceIfExists(work, workspace)
.orElseGet(() -> executeInTemporaryWorkspace(work, context, workspace));
}
we now have two strategies to handle locking, one for Unix and one for Windows. Maybe we could unify this, to use the same strategy as for Windows also for Unix, since Unix logic has some issues, e.g.: #34585, #28974

This requires some optimization, since otherwise we would see some performance regression. We probably need to implement logic like:

if (!(cleanup will be scheduled) && workspaceExists()) {
   loadWorkspace()
} else {
   lock (workspace) {
      if (workspaceExists()) {
         loadWorkspace()
      } else {
         execute()
      }
    }
}

The only problem is, that we also have cleanup.

Metadata

Metadata

Assignees

Labels

a:investigationIssues requiring decision or investigationin:execution-engineincremental, up-to-date, overlapping outputs

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions