You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix backwards compatibility issues with Obj.referenced (#10218)
While this is a real bug fix, the underlying issue does not affect data correctness.
`Obj.referenced()` was introduced to track when a particular `Obj` was (last) written. This information is crucial when purging unreferenced data in Nessie's persistence backend database.
The current code uses the sentinel value `0` for `Obj.reference()` for accidentally _two_ scenarios: to indicate that the value is not set and needs to be written with the actual timestamp and it is also `0` when old rows that do not have the `referenced` column set (aka `NULL`).
This change updates the code to introduce `-1` for `referenced` as a sentinel for "absent" (NULL).
There is also a bug in the implementations that prevents the "purge unreferenced data" to actually work for rows that do not have a value in the `referenced` column. This change fixes this. Unfortunately not all databases properly (DynamoDB and BigTable) support checking for the absence of a value.
Copy file name to clipboardExpand all lines: versioned/storage/bigtable/src/main/java/org/projectnessie/versioned/storage/bigtable/BigTablePersist.java
Copy file name to clipboardExpand all lines: versioned/storage/cassandra/src/main/java/org/projectnessie/versioned/storage/cassandra/CassandraPersist.java
+29-10
Original file line number
Diff line number
Diff line change
@@ -285,7 +285,8 @@ public <T extends Obj> T[] fetchTypedObjsIfExist(
Copy file name to clipboardExpand all lines: versioned/storage/cassandra2/src/main/java/org/projectnessie/versioned/storage/cassandra2/Cassandra2Persist.java
+29-10
Original file line number
Diff line number
Diff line change
@@ -290,7 +290,8 @@ public <T extends Obj> T[] fetchTypedObjsIfExist(
Copy file name to clipboardExpand all lines: versioned/storage/common-tests/src/main/java/org/projectnessie/versioned/storage/commontests/AbstractBasePersistTests.java
Copy file name to clipboardExpand all lines: versioned/storage/dynamodb/src/main/java/org/projectnessie/versioned/storage/dynamodb/DynamoDBPersist.java
Copy file name to clipboardExpand all lines: versioned/storage/dynamodb2/src/main/java/org/projectnessie/versioned/storage/dynamodb2/DynamoDB2Persist.java
0 commit comments