@@ -12,8 +12,6 @@ import (
1212 "strings"
1313 "testing"
1414
15- "github.com/syndtr/goleveldb/leveldb"
16- "github.com/syndtr/goleveldb/leveldb/util"
1715 "google.golang.org/protobuf/encoding/prototext"
1816 "google.golang.org/protobuf/proto"
1917
@@ -173,25 +171,6 @@ func TestEquivalence_GoVsJava(t *testing.T) {
173171 }
174172 t .Logf ("equivalence: java DbFork output:\n %s" , javaOut )
175173
176- // Normalize physical compaction state before the byte diff. The two
177- // tools produce the same LOGICAL state but different PHYSICAL layouts
178- // of pre-existing data: Go's Apply opens stores via goleveldb
179- // (compaction-on-open, which drops already-deleted DELETE tombstones
180- // and resolves multi-version keys to the newest sequence number)
181- // while java DbFork (leveldbjni) leaves the store less-compacted and
182- // physically retains deleted/obsolete entries. Without normalizing,
183- // the diff fails on those tombstoned/overwritten PRE-EXISTING keys —
184- // not on any mutation. Forcing a full goleveldb CompactRange on every
185- // store on BOTH sides converges them to the canonical live newest-seq
186- // / tombstone-free form, so the diff reflects only logical (mutation)
187- // differences. Verified on a real Nile snapshot (#168): goleveldb
188- // CompactRange of an account-asset store with 51 tombstones converges
189- // it to exactly the 27,799-key live set. Real mutation differences
190- // survive compaction (it changes physical layout, not logical
191- // content), so genuine divergences are still caught.
192- normalizeViaCompaction (t , scratchGo )
193- normalizeViaCompaction (t , scratchJava )
194-
195174 // Diff each of the 8 dbfork stores. Order is deterministic
196175 // (stores.AllStores) so a failing run always reports the same
197176 // store first, making CI bisection easier.
@@ -202,31 +181,6 @@ func TestEquivalence_GoVsJava(t *testing.T) {
202181 }
203182}
204183
205- // normalizeViaCompaction forces a full goleveldb CompactRange of every
206- // dbfork store under root/database, converging differing physical
207- // compaction states of the same logical data to the canonical live,
208- // newest-sequence, tombstone-free form. See the call site + #168.
209- func normalizeViaCompaction (t * testing.T , root string ) {
210- t .Helper ()
211- for _ , store := range stores .AllStores {
212- dir := filepath .Join (root , "database" , store )
213- if _ , err := os .Stat (dir ); err != nil {
214- continue // store legitimately absent (lite snapshot pruning)
215- }
216- ldb , err := leveldb .OpenFile (dir , nil )
217- if err != nil {
218- t .Fatalf ("equivalence: normalize-open %s in %s: %v" , store , root , err )
219- }
220- if err := ldb .CompactRange (util.Range {}); err != nil {
221- ldb .Close ()
222- t .Fatalf ("equivalence: normalize-compact %s in %s: %v" , store , root , err )
223- }
224- if err := ldb .Close (); err != nil {
225- t .Fatalf ("equivalence: normalize-close %s in %s: %v" , store , root , err )
226- }
227- }
228- }
229-
230184// javaHeapFlag returns the JVM `-Xmx<size>` flag for the equivalence
231185// invocation. Defaults to `-Xmx4g` which is enough for Nile lite
232186// snapshots; CI on smaller runners can override via DBFORK_JAVA_HEAP
0 commit comments