On 10/23/2014 07:13 AM, leo@yuriev.ru wrote:
Subject: [PATCH 1/2] lmdb: ITS#7974 oomkiller feature. (...) +typedef int (MDB_oomkiller_func)(MDB_env *env, int pid, void* thread_id, size_t txn);
Some thoughts about this:
Instead of trusting the return value, it seems safer to re-check with mdb_reader_pid(). Like mdb_reader_check0() does. Maybe except on Windows, where file locks from dead processes may linger for a while until the OS reclaims them.
Don't call it OOMkiller just because that's how you use it. Others might do something else, like sending a reader a signal which it interprets as "please wake up and finish your txn". Or it might decide this process is the one which should give up.
This feature could make it interesting to let readers and writers tell each other things: Reserve some unused space in the reader table slots for stuff the reader's caller could put there, and some space for an impatient writer to leave a note. Could go in an independent commit if there is any demand for it though.