[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Work Queues, MDB_NOTLS, MDB_NOLOCK, and Concurrent Map() Over Sub Database
- To: openldap-technical@openldap.org
- Subject: Work Queues, MDB_NOTLS, MDB_NOLOCK, and Concurrent Map() Over Sub Database
- From: A R <arobinson.5000@gmail.com>
- Date: Tue, 16 Feb 2016 20:01:52 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=HTykQAmwglTARUFYiRU7p3JAqQZ0s7HcHhUA9vXzkis=; b=f4ZlEVLgxeVV3U7dh0rclTt90Mne4KN1DD0LEvq4HHLXw4ApRUAXHOmRbof9PtX/Cx egwXve/TnnjNgH/ApL8npnhfyS7sejvJ1fDcOsHKb2XubYR/ztOx6rwgMimUr6fFCktd LB0rnmkMDixgrCM1z3NcY7C6OP3cgG4MT5GdUsdUto4FYCU1lRUmlMb+oimcG2wkfAzk Qi/PtFy8o7FVZjwudl3H17nek+JUZh+ojMwknCIMHldSqs5SCl9yqoCI1i8T9hlIMQjS sHwLU/kHJqFyOr/0FbKbyjo0znrL3KYaadoOZB8JiTZkzmVUaUf4lwdmUF+IaHXs4CZn ipkw==
Hello,
I’m using a work queue to manage concurrency.
Currently jobs manage their own transactions, and barriers are used to enforce exclusive writer access.
Naturally, MDB_NOTLS and MDB_NOLOCK are set on the environment.
However, I need to implement a concurrent map algorithm over a sub database.
The algorithm would be simple: a reader would enqueue worker jobs–each having a strong, immutable reference to the transaction and cursor, and copies of the key and value pointers.
The transaction and cursor would only be destroyed after all of the sibling jobs have completed/canceled/failed.
I’ve read that transactions and cursors should not be shared between threads, but in this use case, the creation and destruction operations are atomic since only 1 thread, or 2 distinct threads, receive the “beginReadTransaction” and “endReadTransaction” jobs at two distinct moments in time, in a guaranteed order.
Are there any caveats in this approach?
Thanks,
A. Robinson