zeroshade commented on code in PR #1394:
URL: https://github.com/apache/iceberg-go/pull/1394#discussion_r3553539841
##########
table/metadata_builder_internal_test.go:
##########
@@ -923,6 +923,46 @@ func TestV2SequenceNumberCannotDecrease(t *testing.T) {
require.ErrorContains(t, err, "can't add snapshot with sequence number
0, must be > than last sequence number 1")
}
+func TestV3SequenceNumberCannotDecrease(t *testing.T) {
+ builder := builderWithoutChanges(3)
+ schemaID := 0
+ firstRowID := int64(0)
+ addedRows := int64(10)
+
+ snapshot1 := Snapshot{
+ SnapshotID: 1,
+ ParentSnapshotID: nil,
+ SequenceNumber: 0,
+ TimestampMs: builder.base.LastUpdatedMillis() + 1,
+ ManifestList: "/snap-1.avro",
+ Summary: &Summary{Operation: OpAppend},
+ SchemaID: &schemaID,
+ FirstRowID: &firstRowID,
+ AddedRows: &addedRows,
+ }
+
+ require.NoError(t, builder.AddSnapshot(&snapshot1))
+
+ parentSnapshotID := int64(1)
+ snapshot2 := Snapshot{
+ SnapshotID: 2,
+ ParentSnapshotID: &parentSnapshotID,
+ SequenceNumber: 0,
+ TimestampMs: builder.lastUpdatedMS + 1,
+ ManifestList: "/snap-0.avro",
+ Summary: &Summary{
+ Operation: OpAppend,
+ Properties: map[string]string{},
+ },
+ SchemaID: &schemaID,
+ FirstRowID: &firstRowID,
Review Comment:
nit (cosmetic): `snapshot2` reuses the same `&firstRowID` pointer (value 0)
as `snapshot1`, which adds 10 rows — realistically `snapshot2.FirstRowID` would
start at 10. Doesn't affect what this test asserts (the sequence-number guard),
but a distinct value would read more faithfully.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]