Skip to content

[core] Introduce properties field in Snapshot#5703

Merged
JingsongLi merged 3 commits intoapache:masterfrom
luoyuxia:add-properties-in-snapshot
Jun 11, 2025
Merged

[core] Introduce properties field in Snapshot#5703
JingsongLi merged 3 commits intoapache:masterfrom
luoyuxia:add-properties-in-snapshot

Conversation

@luoyuxia
Copy link
Contributor

@luoyuxia luoyuxia commented Jun 6, 2025

Purpose

Linked issue: close #5649

Introduce properties field in Snapshot

Tests

testCommitManifestWithProperties

API and Format

Documentation

@luoyuxia luoyuxia changed the title [core] Add properties field in Snapshot [core] Introduce properties field in Snapshot Jun 6, 2025
@yuzelin
Copy link
Contributor

yuzelin commented Jun 6, 2025

Left minor comments, please take a look and fix failed tests.

protected final String statistics;

// properties
// null for paimon <= 1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

What about empty? We don't want to include empty map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, I modified it to be null when empty map

logOffsets.put(bucket, newOffset);
}

public void addProperty(String key, String value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you show the example? How to add property? Add what property.

Copy link
Contributor Author

@luoyuxia luoyuxia Jun 6, 2025

Choose a reason for hiding this comment

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

Maybe something like:

ManifestCommittable committable = new ManifestCommittable(COMMIT_IDENTIFIER);
committable. addProperty("fluss_offset_partition_1_bucket1", "14")
committable. addProperty("fluss_offset_partition_2_bucket2", "15")

@luoyuxia luoyuxia force-pushed the add-properties-in-snapshot branch 2 times, most recently from 9128e0e to 3a84f8d Compare June 6, 2025 13:01
@luoyuxia
Copy link
Contributor Author

luoyuxia commented Jun 9, 2025

@JingsongLi @yuzelin Thanks for reviewing. Comments has been addressed.

@@ -104,7 +104,7 @@ public void testCompatibilityToV3CommitV7() throws IOException {

ManifestCommittableSerializer serializer = new ManifestCommittableSerializer();
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a new test for current version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

ManifestCommittableSerializer serializer = new ManifestCommittableSerializer();
byte[] bytes = serializer.serialize(manifestCommittable);
ManifestCommittable deserialized = serializer.deserialize(3, bytes);
ManifestCommittable deserialized = serializer.deserialize(serializer.getVersion(), bytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't change this.

Copy link
Contributor Author

@luoyuxia luoyuxia Jun 9, 2025

Choose a reason for hiding this comment

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

After look in deep again, maybe we still need to change to use serializer.getVersion() which is v4 to deserialize it.

According to java doc, the version is for in which the data was serialized in here, the data is serialized with v4.
And in v4, we will serialize properties into the bytes, it deserialize with v3, it'll skip the properties bytes and try to deserialize it as commitMessages and throw BufferUnderflowException.

@luoyuxia
Copy link
Contributor Author

luoyuxia commented Jun 9, 2025

@JingsongLi Thanks for review. Add the test now.

@luoyuxia luoyuxia force-pushed the add-properties-in-snapshot branch 6 times, most recently from 1bac840 to 287b1d2 Compare June 10, 2025 02:59
@luoyuxia luoyuxia force-pushed the add-properties-in-snapshot branch from 287b1d2 to 5c1f4d4 Compare June 10, 2025 06:48
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit b13100d into apache:master Jun 11, 2025
21 checks passed
yuzelin pushed a commit to yuzelin/paimon that referenced this pull request Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Paimon's snapshot should support store summary property

3 participants

Comments