Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 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
11 changes: 10 additions & 1 deletion src/Client/Grpc/GrpcDurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,19 @@ public override async Task<IList<HistoryEvent>> GetOrchestrationHistoryAsync(
using AsyncServerStreamingCall<P.HistoryChunk> streamResponse =
this.sidecarClient.StreamInstanceHistory(streamRequest, cancellationToken: cancellation);

Microsoft.DurableTask.ProtoUtils.EntityConversionState? entityConversionState =
this.options.EnableEntitySupport
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this has nothing to do with enableentitysupport, remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 99ee0e7. EntityConversionState is now always created regardless of EnableEntitySupport since history may contain entity events even if the client option is disabled.

? new(insertMissingEntityUnlocks: false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

without orchestration instanceid, it will throw missing parent instance id exception later i think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The orchestration instance ID is automatically set when the ExecutionStarted event is processed during history conversion (see ProtoUtils.cs line 62: conversionState?.SetOrchestrationInstance(instance)). No manual setting is needed.

: null;

Func<P.HistoryEvent, HistoryEvent> converter = entityConversionState is null
? Microsoft.DurableTask.ProtoUtils.ConvertHistoryEvent
: entityConversionState.ConvertFromProto;

List<HistoryEvent> pastEvents = [];
while (await streamResponse.ResponseStream.MoveNext(cancellation))
{
pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(DurableTask.ProtoUtils.ConvertHistoryEvent));
pastEvents.AddRange(streamResponse.ResponseStream.Current.Events.Select(converter));
}

return pastEvents;
Expand Down
8 changes: 6 additions & 2 deletions src/Worker/Grpc/GrpcOrchestrationRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ public static string LoadAndRun(
P.OrchestratorRequest request = P.OrchestratorRequest.Parser.Base64Decode<P.OrchestratorRequest>(
encodedOrchestratorRequest);

List<HistoryEvent> pastEvents = request.PastEvents.Select(ProtoUtils.ConvertHistoryEvent).ToList();
IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(ProtoUtils.ConvertHistoryEvent);
ProtoUtils.EntityConversionState entityConversionState = new(insertMissingEntityUnlocks: false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

dont we need instanceid specified here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The orchestration instance ID is automatically set when the ExecutionStarted event is processed during history conversion (see ProtoUtils.cs line 62: conversionState?.SetOrchestrationInstance(instance)). No manual setting is needed.


Func<P.HistoryEvent, HistoryEvent> converter = entityConversionState.ConvertFromProto;

List<HistoryEvent> pastEvents = request.PastEvents.Select(converter).ToList();
IEnumerable<HistoryEvent> newEvents = request.NewEvents.Select(converter);
Dictionary<string, object?> properties = request.Properties.ToDictionary(
pair => pair.Key,
pair => ProtoUtils.ConvertValueToObject(pair.Value));
Expand Down
Loading