-
Notifications
You must be signed in to change notification settings - Fork 182
mv fix repair options
- merged to master -
- code complete - April 1, 2016
- development started - April 1, 2016
This is a discussion of changes made to eleveldb, Basho's Erlang to leveldb interface. Tradition is to place changes to either in this wiki.
eleveldb.cc translates Erlang calls to leveldb's C++ calls. The eleveldb_repair() function translates Erlang requests to repair a leveldb database, a Riak vnode, into leveldb's RepairDB calls. This translation function is basically a cookie cutter equivalent of several other functions within eleveldb.cc. Unfortunately, one line of code fell out of the cookie cutting that created eleveldb_repair(). The missing line would normally populate the leveldb Options structure with any essential metadata for the repair. The defaults for the Options structure have been sufficient for non-tiered storage since the original cookie cutter mistake in January 2012. A recent failure when a user attempted to repair a leveldb tiered storage implementation illuminated the problem.
Basho added the tiered storage feature to Google's original leveldb implementation. The feature allows the user to provide higher speed and higher cost storage for leveldb's lower levels, then switch to cheaper storage for the higher levels. The options to operate tiered storage are only contained within the Options structure. The repair feature is unable to properly repair tiered storage using the default values for the Options structure. Tiered storage repair must have the explicit Options entries to function properly. Worse, it is possible for a user to guess repair parameters that are close enough to work against the fast tier but blind leveldb repair to the entire slow tier. leveldb subsequently erases the entire slow tier upon its next regular database open.
Original tiered storage discussion is here
The eleveldb_repair() function is supposed to pass a populated leveldb::Options structure to leveldb's RepairDB function. The Erlang layer already passes the values needed to populate leveldb::Options as argv[1]. The bug is that a fold() operation to convert argv[1] into Options values did not exist. One line of code to call fold() for conversion of argv[1] to leveldb::Options now exists.