Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track cancellable tasks by parent ID #76186

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Note that items are expected unique
DaveCTurner committed Aug 9, 2021

Verified

This commit was signed with the committer’s verified signature.
GuySartorelli Guy Sartorelli
commit 059c0041639cbfcf119e3b9baf25376680bd5508
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ public CancellableTasksTracker(T[] empty) {
private final Map<TaskId, T[]> byParentTaskId = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extend TaskAssertions.assertAllCancellableTasksAreCancelled and perhaps even ESIntegTestCase to verify that the two maps are in sync after tests have completed (at least that the byParentId map only contains items that are also in the byTaskId map).

We could consider doing it in an assertion too but doing it concurrently while running might be difficult?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I don't think we can express any true invariants very easily; I added an eventually-true assertion in 9554f12.

arteam marked this conversation as resolved.
Show resolved Hide resolved

/**
* Add an item for the given task. Should only be called once for each task.
* Add an item for the given task. Should only be called once for each task, and {@code item} must be unique per task too.
*/
public void put(Task task, T item) {
final long taskId = task.getId();