foundationdb icon indicating copy to clipboard operation
foundationdb copied to clipboard

Go bindings bug, same code returns different keys on macOS and Ubuntu

Open davidsky opened this issue 11 months ago • 0 comments

Tested with: FDB 7.1.61 and 7.3.57 Go 1.22.2 and 1..23.5 Multiple Ubuntu (Including WSL), and macOS.

To replicate, run:

package main

import (
	"log"
	"github.com/apple/foundationdb/bindings/go/src/fdb"
)

func main() {
	fdb.MustAPIVersion(730)
	db := fdb.MustOpenDefault()

	key := fdb.Key("hello")
	_, _ = db.Transact(func(tr fdb.Transaction) (any, error) {
		tr.Set(key, []byte("world"))
		return nil, nil
	})

	_, _ = db.Transact(func(tr fdb.Transaction) (any, error) {
		keySelector := fdb.KeySelector{Key: key, OrEqual: true, Offset: 2}
		nextKey := tr.GetKey(keySelector).MustGet()
		log.Println("nextKey: ", nextKey)
		return nil, nil
	})
}

macOS prints nextKey: \xfe\x01\x14\x00\x14\x02system\x00 Ubuntu prints nextKey: \xff

davidsky avatar Feb 03 '25 11:02 davidsky