From 01f65bc8727c44cbec7619000059dba730d6e62b Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 2 Feb 2020 02:41:32 +0300 Subject: [PATCH] mdbx: more info about "one threat - one transaction". Change-Id: I070750b081e02113577dac13488d01f9d18e759b --- mdbx.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mdbx.h b/mdbx.h index 69e7f8a4..2d3ffad9 100644 --- a/mdbx.h +++ b/mdbx.h @@ -201,6 +201,14 @@ * necessary) in a child process would be both extreme complicated and so * fragile. * + * Do not start more than one transaction for a one thread. If you think about + * this, it's really strange to do something with two data snapshots at once, + * which may be different. MDBX checks and preventing this by returning + * corresponding error code (MDBX_TXN_OVERLAPPING, MDBX_BAD_RSLOT, MDBX_BUSY) + * unless you using MDBX_NOTLS option on the environment. Nonetheless, with the + * MDBX_NOTLS option, you must know exactly what you are doing, otherwise you + * will get deadlocks or reading an alien data. + * * Also note that a transaction is tied to one thread by default using Thread * Local Storage. If you want to pass read-only transactions across threads, * you can use the MDBX_NOTLS option on the environment. Nevertheless, a write @@ -383,6 +391,14 @@ * belongs to one thread. The MDBX_NOTLS flag changes this for read-only * transactions. See below. * + * Do not start more than one transaction for a one thread. If you think + * about this, it's really strange to do something with two data snapshots + * at once, which may be different. MDBX checks and preventing this by + * returning corresponding error code (MDBX_TXN_OVERLAPPING, MDBX_BAD_RSLOT, + * MDBX_BUSY) unless you using MDBX_NOTLS option on the environment. + * Nonetheless, with the MDBX_NOTLS option, you must know exactly what you + * are doing, otherwise you will get deadlocks or reading an alien data. + * * - Do not have open an MDBX database twice in the same process at the same * time. By default MDBX prevent this in most cases by tracking databases * opening and return MDBX_BUSY if anyone LCK-file is already open.