NewIterator search bug, cannot retrieve the key within range
Author: spidemen2024Created Jan 17, 2025Updated Jan 17, 2025
the target key is accept_event_time_1737076247294351463
the start key is accept_event_time_1737076245000000000.
the end key is accept_event_time_1737076249000000000,
but the result still not get accept_event_time_1737076247294351463 to return. when you try to get accept_event_time_1737076247294351463, it does return.
// Convert startTime and endTime to big.Int
startBigInt := big.NewInt(startTime)
endBigInt := big.NewInt(endTime)
// 1 second = 1000000000 ns
startBigInt.Mul(startBigInt, big.NewInt(1000000000))
endBigInt.Mul(endBigInt, big.NewInt(1000000000))
// 1 second = 1000000000 ns
startKey := []byte(AcceptRequestEventTimeKey + "_" + startBigInt.String())
endKey := []byte(AcceptRequestEventTimeKey + "_" + endBigInt.String())
var events []utils.Event
iter := c.WorkerDB.NewIterator(&util.Range{Start: startKey, Limit: endKey}, &opt.ReadOptions{})Source: syndtr/goleveldb