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

Ignore duplicate client requests #379

Merged
merged 4 commits into from
Apr 16, 2024
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
18 changes: 12 additions & 6 deletions src/DurableTask.Netherite/PartitionState/PrefetchState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,19 @@ public override void Process(WaitRequestReceived waitRequestEvent, EffectTracker
void ProcessClientRequestEventWithPrefetch(ClientRequestEventWithPrefetch clientRequestEvent, EffectTracker effects)
{
if (clientRequestEvent.Phase == ClientRequestEventWithPrefetch.ProcessingPhase.Read)
{
this.Partition.Assert(!this.PendingPrefetches.ContainsKey(clientRequestEvent.EventIdString), "PendingPrefetches.ContainsKey(clientRequestEvent.EventIdString)");

// Issue a read request that fetches the instance state.
// We have to buffer this request in the pending list so we can recover it.
{
if (!this.PendingPrefetches.ContainsKey(clientRequestEvent.EventIdString))
{
// Issue a read request that fetches the instance state.
// We buffer this request in the pending list so we can recover it, and can filter duplicates
// (as long as the duplicates appear soon after the original)

this.PendingPrefetches.Add(clientRequestEvent.EventIdString, clientRequestEvent);
this.PendingPrefetches.Add(clientRequestEvent.EventIdString, clientRequestEvent);
}
else
{
return; // this is a duplicate. Ignore it.
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: given that this is rare - should we log it? Might be helpful to know if EH is acting up and duplicating events a lot.

}
else
{
Expand Down
Loading