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

Push snapshot diffs before reset, and thread results after #126

Merged
merged 16 commits into from
Jul 13, 2021

Conversation

Shillaker
Copy link
Collaborator

@Shillaker Shillaker commented Jul 5, 2021

When a thread completes on a remote host, we need to do three things: reset the executor, send the snapshot diffs, send the thread's results. Previously sending snapshot diffs was bundled with sending thread results, and done after resetting the executor. However, this doesn't make sense as the resetting may wipe out any changes that should be captured in the diffs.

Therefore, we need to send the diffs, reset the executor, then send the thread results (note that the thread results must always be sent after resetting the executor to ensure it's ready to be reused). There is already a stand-alone snapshot diffs message, so this PR switches to using that and removes the snapshot diffs from the thread results message.

The downside here is that completing a thread on a remote host now requires sending two messages rather than one, but this is unavoidable.

Changes:

  • Rearranged Executor code to push snapshot diffs before calling reset
  • Switched to using dedicated snapshot diffs message rather than thread results message (for diffs)
  • Added missing checks for zero-sized snapshots
  • Added distributed test to catch the original issue (using distributed threads)

@Shillaker Shillaker marked this pull request as draft July 5, 2021 16:59
@Shillaker Shillaker changed the title Fixes for dirty page checking Separate thread results and snapshot diffs Jul 12, 2021
private:
void applyDiffsToSnapshot(
const std::string& snapshotKey,
const flatbuffers::Vector<flatbuffers::Offset<SnapshotDiffChunk>>* diffs);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was never implemented/ used

id,
threadPoolIdx,
executingTaskCount);
oldTaskCount - 1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This logging wasn't thread-safe by accessing executingTaskCount directly.

@Shillaker Shillaker marked this pull request as ready for review July 12, 2021 11:45
@Shillaker Shillaker self-assigned this Jul 12, 2021
@Shillaker Shillaker changed the title Separate thread results and snapshot diffs Push snapshot diffs before reset, and thread results after Jul 12, 2021
Copy link
Collaborator

@csegarragonz csegarragonz left a comment

Choose a reason for hiding this comment

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

LGTM

m.set_snapshotkey(snapshotKey);
}

// Dispatch the message, we expect them all to be executed other hosts
Copy link
Collaborator

Choose a reason for hiding this comment

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

small typo "executed on other hosts"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good spot, will fix in next PR

@Shillaker Shillaker merged commit 4691f18 into master Jul 13, 2021
@Shillaker Shillaker deleted the dirty-page-fix-2 branch July 13, 2021 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants