StefanRRichter commented on a change in pull request #8611:
[FLINK-12693][state] Store state per key-group in CopyOnWriteStateTable
URL: https://github.com/apache/flink/pull/8611#discussion_r299437523
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateTableSnapshot.java
##########
@@ -54,242 +37,45 @@
extends AbstractStateTableSnapshot<K, N, S,
CopyOnWriteStateTable<K, N, S>> {
/**
- * Version of the {@link CopyOnWriteStateTable} when this snapshot was
created. This can be used to release the snapshot.
- */
- private final int snapshotVersion;
-
- /**
- * The state table entries, as by the time this snapshot was created.
Objects in this array may or may not be deep
- * copies of the current entries in the {@link CopyOnWriteStateTable}
that created this snapshot. This depends for each entry
- * on whether or not it was subject to copy-on-write operations by the
{@link CopyOnWriteStateTable}.
- */
- @Nonnull
- private final CopyOnWriteStateTable.StateTableEntry<K, N, S>[]
snapshotData;
-
- /** The number of (non-null) entries in snapshotData. */
- @Nonnegative
- private final int numberOfEntriesInSnapshotData;
-
- /**
- * A local duplicate of the table's key serializer.
- */
- @Nonnull
- private final TypeSerializer<K> localKeySerializer;
-
- /**
- * A local duplicate of the table's namespace serializer.
+ * The offset to the contiguous key groups.
*/
- @Nonnull
- private final TypeSerializer<N> localNamespaceSerializer;
+ private final int keyGroupOffset;
/**
- * A local duplicate of the table's state serializer.
+ * Snapshots of state partitioned by key-group.
*/
@Nonnull
- private final TypeSerializer<S> localStateSerializer;
-
- @Nullable
- private final StateSnapshotTransformer<S> stateSnapshotTransformer;
-
- /**
- * Result of partitioning the snapshot by key-group. This is lazily
created in the process of writing this snapshot
- * to an output as part of checkpointing.
- */
- @Nullable
- private StateKeyGroupWriter partitionedStateTableSnapshot;
+ private final CopyOnWriteStateMapSnapshot<K, N, S>[] snapshotStateMap;
Review comment:
At least for not super performance critical code like this, I would almost
always prefer `List<CopyOnWriteStateMapSnapshot<K, N, S>>` (backed by array
list) over pure array for the type safety and better integration with generics.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services