Skip to content

z.NewFile error on badger.Open() #2207

@balena-kentik

Description

@balena-kentik

Describe the bug

Sometimes a simple badger.Open() with default options returns error z.NewFile.

To Reproduce

Keep writing data, closing, reopening, writing data, etc...

A second look gave me the way to reproduce it:

  • Just leave the dir state containing .mem files.

In this case, badger.Open() always return z.NewFile.

Expected behavior

No error. In fact, a second call to badger.Open() returns no error.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

  • OS: macOS, Linux
  • Language: Go
  • Version: v4.7.0

Additional context

This portion of code here seems to be the root cause. So openMemTable can return mt, z.NewFile as per ref. But mt != nil in this case.

Other portions of the code make sense of it, like here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions