Skip to content

Refactor freelist management & add more dedicated tests #789

@ahrtr

Description

@ahrtr

Backgroud

There are some long standing data corruption issues, which indicate that there might be potential bug(s) in freelist management.

I am not satisfied with the bbolt freelist management for a long time. It's hard to understand and also tightly coupled with bbolt. I have been thinking to refactor it to improve the understandability & testability.

Refactor

The high level idea is to

  • simplify the implementation to improve understandability;
  • and introduce interface and decouple it with the bbolt TXN workflow to improve testability.

What we have done and are going to do:

We also need to continue to refactor & simplify the interface from user (bbolt) perspective, in other words, we should have a clear understanding on how the interface will & should be used by bbolt. The motivation is to improve testablity.

The freelist management is the most sensitive & important part. So let's do it step by step.

Test

Any unit tests are welcome.

But more importantly, we should add dedicated randomized test case to simulate concurrent (multiple) read TXNs and (single) writing TXN.

  • We need to record all the requests or operations sent to the freelist module;
  • We need to set up a list of expected behavior or invariable properties, and verify all the invariable properties are not broken during the test.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions