Bug: Iterator inside a transaction

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/amd64

What operating system are you using?

macOS Big Sur 11.4

What version of Badger are you using?

v3.2103.0

Does this issue reproduce with the latest master?

Yes

Steps to Reproduce the issue

You can find a runnable test here. The same test running on badger v2 succeeds (find it here).

What Badger options were set?

Default options.

What did you do?

I started a transaction and set 2 keys in that transaction. Before committing it, I try to iterate through the keys but the iterator does not return them. The same thing works on Badger v2.

What did you expect to see?

I expected the iterator to return the keys that were written before in the same transaction.

What did you see instead?

Iterator returned nothing.

1 Like

Thanks @lmazgon , I have verified this bug. Thanks to the tests that your provided.

This should be fixed by fix(pendingWrites): don't skip the pending entries with version=0 by NamanJain8 · Pull Request #1721 · dgraph-io/badger · GitHub

1 Like

I have merged the PR and the change is there in v3.2103.1 release. :slight_smile:

1 Like