Khepri - a tree-like replicated on-disk database library for Erlang and Elixir (introduction & feedbacks)

Khepri 0.8.0 was published !

For this new release, we mainly focused on bug fixes. Several were in the projections code, the mechanism used to improve the latency of queries. A few more in the code to add a member to a cluster, because of an incorrect use of the Ra library.

Two users, including @zabrane above, reported a problem when trying to use Khepri in an Erlang release. The problem was in Horus, a dependency of Khepri. It was fixed in Horus 0.2.4 and Khepri 0.8.0 depends on it. It turns out that the erts application is not automatically added to an Erlang release. It was a surprise to me, given that modules such as erlang are kind of useful :slight_smile: But I understand now, an application always depends on kernel and stdlib but they still must be added to the app(4) file. It makes sense that erts should be treated the same if an application explicitly uses it.

The only additions to the API in this release are:

  • a function to check if a Khepri store is empty or not:
    case khepri:is_empty(StoreId) of
        true ->
            %% ...
    
  • a function to unregister a previously registered projection:
    khepri:unregister_projection(StoreId, ProjectionName)
    

That’s it for the highlights of Khepri 0.8.0! The release notes will give you more details about other changes as well as how to upgrade from a previous version of Khepri. Feedback is welcome as always :slight_smile:

2 Likes

Following the release of Khepri 0.8.0, the RabbitMQ team is also proud to announce khepri_mnesia_migration 0.1.0 !

As the name hopefully suggests, this is a library to help you migrate between Mnesia and Khepri. In this first release, it only supports migrations from Mnesia to Khepri, not the opposite.

By migration, we mean two separate things:

  • the synchronization of clusters memberships
  • the copy of data from one to the other

khepri_mnesia_migration has some documentation. I need to add more examples though, but here are the basic uses:

To create or synchronize a Khepri cluster so that it has the same members as a Mnesia cluster:

ok = mnesia_to_khepri:sync_cluster_membership(StoreId)

To copy records from Mnesia tables to a Khepri store:

ok = mnesia_to_khepri:copy_tables(StoreId, Tables, ConverterMod).

Beside a list of tables, mnesia_to_khepri:copy_tables/3 takes the name of a module implementing the mnesia_to_khepri_converter behavior. It is responsible for taking a record from Mnesia and write the data however it wants to a Khepri store.

This is the application we use in RabbitMQ to perform the migration at runtime in our ongoing project of integrating Khepri.

You may find it useful if you plan to play with Khepri. If that’s the case, please share any feedback you have!

7 Likes