Skip to content

Conversation

@StefanRRichter
Copy link
Contributor

What is the purpose of the change

This PR generalizes and unifies the de/serialization of state meta information in backends. We replace the snapshots and reader/writers of the individual state types with a general StateMetaInfoSnapshot and the corresponding StateMetaInfoSnapshotReadersWriters. Backwards compatibility is maintained.

Verifying this change

This change is already covered by existing tests.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

@StefanRRichter
Copy link
Contributor Author

CC @azagrebin

Copy link
Contributor

@sihuazhou sihuazhou left a comment

Choose a reason for hiding this comment

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

Looks good from my side.

public int[] getCompatibleVersions() {
// we are compatible with version 3 (Flink 1.3.x) and version 1 & 2 (Flink 1.2.x)
return new int[] {VERSION, 3, 2, 1};
return new int[]{VERSION, 4, 3, 2, 1};
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: miss a ' ' between '[]' and '{'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both styles are ok and used in Flink, so I will stick to this.

@StefanRRichter StefanRRichter force-pushed the FLINK-9799-generalize-state-meta-pr branch from 5e44f75 to dcf7756 Compare July 12, 2018 08:47
Copy link
Contributor

@azagrebin azagrebin left a comment

Choose a reason for hiding this comment

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

Nice simplification, LGTM 👍
I left couple of suggestions to consider before merge.


@Override
public int[] getCompatibleVersions() {
// we are compatible with version 3 (Flink 1.5.x), 2 (Flink 1.4.x, Flink 1.3.x) and version 1 (Flink 1.2.x)
Copy link
Contributor

Choose a reason for hiding this comment

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

was this comment redundant?

throw new IllegalArgumentException("Unsupported read version for state meta info: " + readVersion);
}

switch (stateTypeHint) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One small suggestion here is to move all the legacy stuff into separate package/class and leave here only call to legacy reader factory. That would unload this class a bit and simplify cleaning of legacy stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Assert.assertTrue(meta.getStateSerializer() instanceof UnloadableDummyTypeSerializer);
Assert.assertEquals(namespaceSerializer.snapshotConfiguration(), meta.getNamespaceSerializerConfigSnapshot());
Assert.assertEquals(stateSerializer.snapshotConfiguration(), meta.getStateSerializerConfigSnapshot());
for (StateMetaInfoSnapshot meta : serializationProxy.getStateMetaInfoSnapshots()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change like
RegisteredKeyedBackendStateMetaInfo.Snapshot<?, ?> meta -> RegisteredKeyedBackendStateMetaInfo(StateMetaInfoSnapshot)
and then using original assertions might be more complete version of test.
Also for other meta wrappers in further tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Good point

@StefanRRichter
Copy link
Contributor Author

@sihuazhou @azagrebin thanks guys for the fast reviews! Will address the comments and merge.

@asfgit asfgit closed this in f1ac0f2 Jul 12, 2018
sampathBhat pushed a commit to sampathBhat/flink that referenced this pull request Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants