File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
main/java/org/apache/flink/runtime/checkpoint
test/java/org/apache/flink/runtime/checkpoint Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 19
19
package org .apache .flink .runtime .checkpoint ;
20
20
21
21
import org .apache .flink .annotation .Internal ;
22
+ import org .apache .flink .annotation .VisibleForTesting ;
22
23
import org .apache .flink .api .java .tuple .Tuple2 ;
23
24
import org .apache .flink .runtime .state .OperatorStateHandle ;
24
25
import org .apache .flink .runtime .state .OperatorStreamStateHandle ;
@@ -488,13 +489,16 @@ private static final class GroupByStateNameResults {
488
489
}
489
490
}
490
491
491
- private static final class StateEntry {
492
+ @ VisibleForTesting
493
+ static final class StateEntry {
492
494
final List <Tuple2 <StreamStateHandle , OperatorStateHandle .StateMetaInfo >> entries ;
493
495
final BitSet reportedSubtaskIndices ;
496
+ final int parallelism ;
494
497
495
498
public StateEntry (int estimatedEntrySize , int parallelism ) {
496
499
this .entries = new ArrayList <>(estimatedEntrySize );
497
500
this .reportedSubtaskIndices = new BitSet (parallelism );
501
+ this .parallelism = parallelism ;
498
502
}
499
503
500
504
void addEntry (
@@ -506,7 +510,7 @@ void addEntry(
506
510
507
511
boolean isPartiallyReported () {
508
512
return reportedSubtaskIndices .cardinality () > 0
509
- && reportedSubtaskIndices .cardinality () < reportedSubtaskIndices . size () ;
513
+ && reportedSubtaskIndices .cardinality () < parallelism ;
510
514
}
511
515
}
512
516
}
Original file line number Diff line number Diff line change 47
47
import org .apache .flink .testutils .TestingUtils ;
48
48
import org .apache .flink .testutils .executor .TestExecutorExtension ;
49
49
50
+ import org .junit .jupiter .api .Assertions ;
50
51
import org .junit .jupiter .api .Test ;
51
52
import org .junit .jupiter .api .extension .RegisterExtension ;
52
53
@@ -162,6 +163,23 @@ void testRepartitionUnionState() {
162
163
verifyOneKindPartitionableStateRescale (operatorState , operatorID );
163
164
}
164
165
166
+ @ Test
167
+ public void testPartiallyReported () {
168
+ RoundRobinOperatorStateRepartitioner .StateEntry stateEntry =
169
+ new RoundRobinOperatorStateRepartitioner .StateEntry (0 , 5 );
170
+ stateEntry .addEntry (0 , null );
171
+ stateEntry .addEntry (1 , null );
172
+ stateEntry .addEntry (3 , null );
173
+
174
+ // assert partially report
175
+ Assertions .assertTrue (stateEntry .isPartiallyReported ());
176
+
177
+ // assert fully report
178
+ stateEntry .addEntry (2 , null );
179
+ stateEntry .addEntry (4 , null );
180
+ Assertions .assertFalse (stateEntry .isPartiallyReported ());
181
+ }
182
+
165
183
@ Test
166
184
void testRepartitionBroadcastState () {
167
185
OperatorID operatorID = new OperatorID ();
You can’t perform that action at this time.
0 commit comments