This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 58757fe259 [pypaimon] Add filestorecommit may skip middle snapshots
while committing (#6960)
58757fe259 is described below
commit 58757fe259e8273ff89cc1daa8f7a6fe4e42f67b
Author: YeJunHao <[email protected]>
AuthorDate: Wed Jan 7 08:53:10 2026 +0800
[pypaimon] Add filestorecommit may skip middle snapshots while committing
(#6960)
---
paimon-python/pypaimon/write/file_store_commit.py | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/paimon-python/pypaimon/write/file_store_commit.py
b/paimon-python/pypaimon/write/file_store_commit.py
index e30b272e26..a5b9fd9693 100644
--- a/paimon-python/pypaimon/write/file_store_commit.py
+++ b/paimon-python/pypaimon/write/file_store_commit.py
@@ -130,7 +130,8 @@ class FileStoreCommit:
deleted_file_count = 0
delta_record_count = 0
# process snapshot
- new_snapshot_id = self._generate_snapshot_id()
+ latest_snapshot = self.snapshot_manager.get_latest_snapshot()
+ new_snapshot_id = latest_snapshot.id + 1 if latest_snapshot else 1
# Check if row tracking is enabled
row_tracking_enabled = self.table.options.row_tracking_enabled()
@@ -184,7 +185,6 @@ class FileStoreCommit:
self.manifest_list_manager.write(delta_manifest_list,
[new_manifest_list])
# process existing_manifest
- latest_snapshot = self.snapshot_manager.get_latest_snapshot()
total_record_count = 0
if latest_snapshot:
existing_manifest_files =
self.manifest_list_manager.read_all(latest_snapshot)
@@ -196,7 +196,6 @@ class FileStoreCommit:
self.manifest_list_manager.write(base_manifest_list,
existing_manifest_files)
# process snapshot
- new_snapshot_id = self._generate_snapshot_id()
total_record_count += delta_record_count
snapshot_data = Snapshot(
version=3,
@@ -242,14 +241,6 @@ class FileStoreCommit:
if hasattr(self.snapshot_commit, 'close'):
self.snapshot_commit.close()
- def _generate_snapshot_id(self) -> int:
- """Generate the next snapshot ID."""
- latest_snapshot = self.snapshot_manager.get_latest_snapshot()
- if latest_snapshot:
- return latest_snapshot.id + 1
- else:
- return 1
-
def _generate_partition_statistics(self, commit_entries:
List[ManifestEntry]) -> List[PartitionStatistics]:
"""
Generate partition statistics from commit entries.