|
48 | 48 | import com.uber.m3.util.ImmutableMap; |
49 | 49 | import java.time.Duration; |
50 | 50 | import java.util.ArrayList; |
| 51 | +import java.util.Arrays; |
51 | 52 | import java.util.Iterator; |
52 | 53 | import java.util.List; |
53 | 54 | import java.util.Objects; |
|
59 | 60 | import java.util.function.BiFunction; |
60 | 61 | import java.util.function.Consumer; |
61 | 62 | import org.apache.thrift.TException; |
| 63 | +import org.slf4j.Logger; |
| 64 | +import org.slf4j.LoggerFactory; |
62 | 65 |
|
63 | 66 | /** |
64 | 67 | * Implements decider that relies on replay of a workflow code. An instance of this class is created |
65 | 68 | * per decision. |
66 | 69 | */ |
67 | 70 | class ReplayDecider implements Decider { |
68 | 71 |
|
| 72 | + private static final Logger log = LoggerFactory.getLogger(ReplayDecider.class); |
| 73 | + |
69 | 74 | private static final int MAXIMUM_PAGE_SIZE = 10000; |
70 | 75 |
|
71 | 76 | private final DecisionsHelper decisionsHelper; |
@@ -677,6 +682,14 @@ public HistoryEvent next() { |
677 | 682 | metricsScope.counter(MetricsType.WORKFLOW_GET_HISTORY_FAILED_COUNTER).inc(1); |
678 | 683 | throw new Error(e); |
679 | 684 | } |
| 685 | + if (!current.hasNext()) { |
| 686 | + log.error( |
| 687 | + "GetWorkflowExecutionHistory returns an empty history, maybe a bug in server, workflowID:" |
| 688 | + + request.execution.workflowId+", runID:"+request.execution.runId+", domain:"+request.domain |
| 689 | + +" token:" + Arrays.toString(request.getNextPageToken())); |
| 690 | + throw new Error( |
| 691 | + "GetWorkflowExecutionHistory return empty history, maybe a bug in server"); |
| 692 | + } |
680 | 693 | return current.next(); |
681 | 694 | } |
682 | 695 | }; |
|
0 commit comments