Commit 9af3f57
committed
fix: preserve manifest min sequence number of 0
ManifestWriter.to_manifest_file() used `self._min_sequence_number or
UNASSIGNED_SEQ`, which treats a legitimate minimum data sequence number of
0 as falsy and collapses it to UNASSIGNED_SEQ (-1). A data sequence number
of 0 is valid for a live file (files from a v1 table, or the initial commit
of a v2 table), so this diverges from the Java reference, which falls back
to UNASSIGNED_SEQ only when the minimum is unset (null).
When such a manifest is produced by a merge/compaction (the added snapshot
id equals the current commit snapshot id), prepare_manifest() interprets the
-1 as "no file had an assigned sequence number" and overwrites it with the
current, higher commit sequence number, silently raising the manifest's min
data sequence number. That in turn affects sequence-number-based delete-file
application and scans.
Use an explicit None check, mirroring the Java ManifestWriter, and add a
regression test that drives a live existing entry with sequence number 0
through to_manifest_file() for both format versions.
Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>1 parent 2c75523 commit 9af3f57
2 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1145 | 1145 | | |
1146 | 1146 | | |
1147 | 1147 | | |
1148 | | - | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
1149 | 1151 | | |
1150 | 1152 | | |
1151 | 1153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
941 | 983 | | |
942 | 984 | | |
943 | 985 | | |
| |||
0 commit comments