commit 64ca6e81024bb4b608e026b2e2e0e90aabe97596 Author: Alberto Bertogli Date: Sun Oct 10 19:28:45 2010 -0300 Version 0.23 Signed-off-by: Alberto Bertogli commit 981770d6ff4caa49c701bc1c2404c80e007b2dd6 Author: Alberto Bertogli Date: Thu Oct 7 00:48:05 2010 -0300 libnmdb: Remove redundant _ENABLE_X constants There is no need to pass -DENABLE_X when building, the constants are readily available in internal.h, but as _ENABLE_X. This patch removes the redundancy by turning the internal.h constants into ENABLE_X form, and not passing the -D when building. The code then gets the constants from internal.h. Thanks to Jay Sprenkle for the report. Signed-off-by: Alberto Bertogli commit 46515f4949f35220cb9c8edc29205d80b78f6421 Author: Alberto Bertogli Date: Wed Oct 6 13:41:11 2010 -0300 nmdb: Use the appropriate type for storing send() return value Caught by the clang-analyzer tool. Signed-off-by: Alberto Bertogli commit 075f69192a36e39ebb3be1b6a624fab0b4c41ed5 Author: Alberto Bertogli Date: Wed Oct 6 13:37:41 2010 -0300 nmdb: Improve check for broken values in cache_incr() The code did not check that we do not give strtoll() a NULL value. We know it should never happen, but it's better to check. This patch modifies the previous test for 0-terminated strings (which actually did check for val != NULL before accessing it), making it also return in the case where val == NULL. Caught by the clang-analyzer tool. Signed-off-by: Alberto Bertogli commit b60037201816ecebef83f4dd5023efe82a1dbc62 Author: Alberto Bertogli Date: Wed Oct 6 13:36:29 2010 -0300 Remove unused assignments The assignments in this patch were unused or not really needed, so they were removed to improve clarity. They were caught by the clang-analyzer tool. Signed-off-by: Alberto Bertogli commit de84b542a8feae6eb3c770631858746a056d8361 Author: Alberto Bertogli Date: Wed Oct 6 12:17:40 2010 -0300 doc: Fix the version field in the request diagram The version field is 4 bits, but the diagram showed it as being 8. Thanks to Jay Sprenkle for the report. Signed-off-by: Alberto Bertogli commit 7c3ef8cfd248dce772304091e946071f26c8f294 Author: Alberto Bertogli Date: Tue May 25 21:00:11 2010 -0300 libnmdb: Add missing includes These were missing, but only showed up when building without any network protocol. Signed-off-by: Alberto Bertogli commit 92436bfcc1156e9828da75412fac89b17c5e35c7 Author: Alberto Bertogli Date: Mon May 3 15:55:30 2010 -0300 nmdb: Improve handling of string options This patch simplifies the handling of the string options, by using strdup() instead of malloc()+strcpy(), and free()ing when appropriate instead of leaking memory when the same option is passed more than once. Signed-off-by: Alberto Bertogli commit dfed7a8d45a31b76c874d3ec4436a4d78ea50475 Author: Alberto Bertogli Date: Mon May 3 04:33:52 2010 -0300 nmdb: Add an option to save the pidfile Signed-off-by: Alberto Bertogli commit 12ad5b5a7c8f6e292c095623eccb7d28e437bca8 Author: Alberto Bertogli Date: Mon May 3 03:44:41 2010 -0300 nmdb: Log the filename and the backend used after opening the database Signed-off-by: Alberto Bertogli commit 7a9df926c59558f2b17b46cd163d5ec81040ba58 Author: Alberto Bertogli Date: Mon May 3 01:45:10 2010 -0300 doc: Add missing requests to the network reference Signed-off-by: Alberto Bertogli commit 18874eeaa69888c7b37108071de690dacb6120e0 Author: Alberto Bertogli Date: Mon May 3 01:44:51 2010 -0300 nmdb: Add a signal handler to change to read-only mode This patch adds a new signal handler that can be used to change to read-only mode. As SIGUSR1 is a nice signal to assign to this, but it is taken by the log reopening. Since SIGHUP is the one traditionally used for that purpose, we reassign them so now we have: - SIGHUP: reopen log file - SIGUSR1: switch to read-only mode - SIGUSR2: toggle passive mode Signed-off-by: Alberto Bertogli commit 81777f85eb0e6f4c3db6f8301911c0fb057da143 Author: Alberto Bertogli Date: Mon Apr 26 15:34:44 2010 -0300 tests/python: Add a test that walks through all the keys in a server It can be used to test firstkey()/nextkey(). It has also been added to the coverage test. Signed-off-by: Alberto Bertogli commit ffe4fc48d12f63ae921e95994dedafb2cdf50b04 Author: Alberto Bertogli Date: Mon Apr 26 15:22:50 2010 -0300 bindings/python: Unify Python 2 and 3 bindings The differences among both bindings are really not worth the trouble of having the two versions apart. This patch unifies both into a single binding, that can be built and installed using either version. Signed-off-by: Alberto Bertogli commit 69ac3b2861a62b2448cd98f2238ebb4b447cd574 Author: Alberto Bertogli Date: Mon Apr 26 03:46:58 2010 -0300 Add methods to iterate through all the keys in a server This patch adds two functions, nmdb_firstkey() and nmdb_nextkey(), that can be used to iterate through all the keys in a server. It has some limitations (one server only, concurrent sets can cause trouble, etc.), but it is needed for the replication utilities. Only Python 2 bindings are included, the rest, along with the documentation, will come in future patches. Signed-off-by: Alberto Bertogli commit ba6c6296958c9e4dc89bed26bf7d83f184a30212 Author: Alberto Bertogli Date: Sun Apr 25 03:43:13 2010 -0300 nmdb: Cast to avoid known const violation warnings in tdb and bdb backends tdb and bdb APIs make it difficult to maintain const warranties, although they do not modify the buffers. This causes the compiler to emit a warning, which is distracting since it is a known but harmless issue. This patch adds casts to avoid the warnings. It was tested with gcc 4.4.3 and clang 1.1 (svn rev 98154). Signed-off-by: Alberto Bertogli commit fe6f45bb8e5916df6787a99d58d797c74d42fb08 Author: Alberto Bertogli Date: Sun Apr 25 03:22:57 2010 -0300 nmdb: Try to auto-detect Berkeley DB Not as reliable as the other tests, but good enough. Signed-off-by: Alberto Bertogli commit 64fa6fbf77c30c7ec3247143670d06ff0b99fc03 Author: Alberto Bertogli Date: Sun Apr 25 03:20:44 2010 -0300 Add coverage tests This patch adds a script that uses the other tests in an attempt to maximize code coverage. It is mostly useful to check which code is not covered by the other tests, although the output is saved for manual inspection. Scripts for generating nice reports with lcov are also included. Signed-off-by: Alberto Bertogli commit 1ca5dc7c8474af20df8eb2211811a4be50e85b56 Author: Alberto Bertogli Date: Tue Apr 20 22:47:28 2010 -0300 nmdb: Simplify make_queue_long_entry()'s error handling Signed-off-by: Alberto Bertogli commit 017c68e2294df3076b1d811239a4289df8a62192 Author: Alberto Bertogli Date: Tue Apr 20 14:48:21 2010 -0300 nmdb: Fix minor build issues in the bdb and tc backends Commit 8578ddf (Support building with multiple backends, 2010-04-17) introduced minor build issues in the bdb and tc backends, due to an undetected problem during testing (they were not being built, even though they should have been). This patch fixes those issues, which are all minor typos or omissions. Signed-off-by: Alberto Bertogli commit e54a300c3712418f55ce6c6da64ae79c92d87886 Author: Alberto Bertogli Date: Mon Apr 19 01:47:25 2010 -0300 nmdb: Implement read-only mode This patch implements a read-only mode in the server, selectable via command-line only (at the moment). It will become more useful in the future, for replication purposes. Signed-off-by: Alberto Bertogli commit d8f7901063552dcc433414fe35b3365e51036417 Author: Alberto Bertogli Date: Sun Apr 18 12:40:04 2010 -0300 libnmdb: Add Doxygen documentation to the public API This patch adds Doxygen documentation to the library's public API. To do that, it moves some structures and defines that were internal to the internal header (which now needs to be generated at build time, so it was renamed to internal.h.in). Now the public header contains only the public API, and does not need to be generated automatically anymore. Signed-off-by: Alberto Bertogli commit b55affe6214f3d91ac9588c8ddf2444a48ad2e21 Author: Alberto Bertogli Date: Sat Apr 17 18:53:21 2010 -0300 Minor documentation updates Signed-off-by: Alberto Bertogli commit 2df81c3beafda57ec3cd5dfb3812a7d7549973f2 Author: Alberto Bertogli Date: Sat Apr 17 18:30:45 2010 -0300 Auto-detect TIPC and SCTP availability This patch changes the Makefile to auto-detect TIPC and SCTP availability, by attempting to use their corresponding headers. It's not the most accurate way of testing, but it's really good enough, and on weird cases it can always be overriden manually as it used to be. Signed-off-by: Alberto Bertogli commit 8578ddfcd66783b6370c05d99ccfa4453ab9a393 Author: Alberto Bertogli Date: Sat Apr 17 17:42:29 2010 -0300 Support building with multiple backends This patch makes nmdb build with support with several backends, and lets the user select which one to use at runtime. This includes major changes to the internal database API, but luckily it never goes outside the dbloop.c, and most changes are simple. The Makefile has been extended to auto-detect available backends at build time, so the user no longer needs to select which ones to use (although it is still possible). Signed-off-by: Alberto Bertogli commit 244188082f180a9fdd4cff9a02cf0106e3971fc1 Author: Alberto Bertogli Date: Fri Apr 16 02:40:37 2010 -0300 Add a tdb backend tdb (http://tdb.samba.org/) is a nice gdbm-alike database, from the Samba project. This patch adds support for it. Signed-off-by: Alberto Bertogli commit 2471150926fb4ab0956b864715dbee2dbda7e297 Author: Alberto Bertogli Date: Thu Apr 15 19:22:17 2010 -0300 Change nmdb's license to BOLA (Public domain) and update the license version This commits re-licenses nmdb under the BOLA license (public domain). Since I'm the sole copyright owner at the moment, it is OK to do the change. Now the whole project is licensed under the same terms. It also updates the other sub-projects to a more recent version of the license. Signed-off-by: Alberto Bertogli commit cf06a74bd037a5255728b72da75e0e4e4f2bad69 Author: Alberto Bertogli Date: Thu Apr 15 18:13:23 2010 -0300 nmdb: Change the cache hash function to Austin Appleby's MurmurHash2 After testing several hash functions, the one used in the cache was changed to Austin Appleby's MurmurHash2. MurmurHash2 is much faster than the one we use (10-25% in our benchmarks), has nice and clean code, and is in the public domain. We keep the old Jenkins' one-at-a-time function, and also add FNV and Paul Hsieh's SuperFastHash, so the tests can be redone in the future if needed. Signed-off-by: Alberto Bertogli commit 8b4ab9201633c17412bd96cabb5c25c311489628 Author: Alberto Bertogli Date: Thu Apr 15 03:36:20 2010 -0300 nmdb: Put cache entries statically into the cache chain they belong to Instead of handling the cache entries with malloc() and free() all the time, and having the chain length as a member of the cache structure, make the length a constant (which already was) and place a statically-allocated array of entries inside each chain. That reduces the costs of allocation, and makes it more cache-friendly. It has a small but noticeable impact on performance. Signed-off-by: Alberto Bertogli commit 6f5c01f4ad8df208fbb05bb651a28057575d0a49 Author: Alberto Bertogli Date: Wed Apr 14 19:27:05 2010 -0300 tests/python: Unify db and cache tests This patch merges the db and cache tests into a single one. Signed-off-by: Alberto Bertogli commit e2e8928c925be605261cd3918e1c5dc87253ca29 Author: Alberto Bertogli Date: Wed Apr 14 18:27:49 2010 -0300 tests/python*: Make a single version of the tests, compatible with 2 and 3 This patch unifies python 2 and 3 tests into one directory with both tests being compatible with both versions. Signed-off-by: Alberto Bertogli commit e3bc3600b620556541c8058a363877c40770eda1 Author: Alberto Bertogli Date: Wed Apr 14 18:07:16 2010 -0300 tests/python*: Fix random operation count calculation The operation count is half of the number of keys, but in the cache-only tests, the number of available keys to operate on can be less than that due to cache pressure. This can be reproduced by running the server with a small cache (e.g. -c 1) and the tests with a large number of operations (e.g. 5000). This patch fixes it by checking that we still have keys in the cache to operate on. Signed-off-by: Alberto Bertogli commit d7d5711ad5ba7c0b72083174452d0044b6e99182 Author: Alberto Bertogli Date: Wed Apr 14 17:14:56 2010 -0300 nmdb: Make cache_set(), cache_cas() and cache_incr() return 0 on success cache_set() and cache_cas() return different values according to the result. One of them is always success, the rest are different errors. A traditional C convention is to encode that using 0 for success, and < 0 for errors. This patch updates their APIs to follow that convention. While at it, it also simplifies some of the error paths, to make them return directly instead of performing unnecessary gotos. Signed-off-by: Alberto Bertogli commit 57a94ccd56a05cc2e8b03da3ab30523bf821a362 Author: Alberto Bertogli Date: Wed Apr 14 15:43:38 2010 -0300 nmdb/cache.c: Reuse entries and key/value buffers when possible Some code paths can reuse cache entry structures and key/value buffers: - When adding an entry on a full entry list, we drop the last entry and replace it with the new one. The entry structure can be reused. - When adding an entry on a full entry list, if the key and/or value sizes match the ones in the reused entry structure, we can reuse the buffer as well. - When setting a value for an already-existing key, if the size of the value matches the old one, we can reuse its buffer. - When doing a CAS, if the size of the value matches the old one, we can reuse its buffer. This patch makes the code do all those tricks. The performance gain on Linux/glibc is small but noticeable, platforms with worse memory allocations will probably benefit the most by this. Signed-off-by: Alberto Bertogli commit db199aab5e1418b5784fbacdd3061c506801e33a Author: Alberto Bertogli Date: Sun Apr 11 04:35:35 2010 -0300 nmdb: Fix sparse annotations New sparse releases disable the exact_context attribute because it was broken. We just change the sparse annotation back to the regular context attribute, which is also useful. Signed-off-by: Alberto Bertogli commit 7af1ac69fd6582d85a048acdcd95ede3386e2d3b Author: Alberto Bertogli Date: Fri Apr 9 12:44:07 2010 -0300 nmdb: Properly limit the cache chain length cache_set() was using a wrong comparison operator (<= instead of <), and it made the chain length one more than it should. Luckily it didn't cause crashes or misbehaviour. Bug reported and patch provided by 刘知言 . Signed-off-by: Alberto Bertogli commit 2bf5811c9ba1c4b291e5fa7871d07fec4fa7ddb5 Author: Alberto Bertogli Date: Tue Jun 16 13:50:18 2009 -0300 Fix more typos in nmdb and libnmdb's manpages Signed-off-by: Alberto Bertogli commit 7c806d850f0e1e5910f3dd146d1d2a3f3ab5c5a2 Author: Alberto Bertogli Date: Tue Jun 16 13:04:55 2009 -0300 Fix typos in nmdb's manpage Signed-off-by: Alberto Bertogli commit deb39b8b1ba4c6812e4febc9a177878fd38c3a12 Author: Alberto Bertogli Date: Sat Mar 21 14:50:50 2009 -0300 tests/perf: Allow to specify which runs to compare in aggregated graphs Signed-off-by: Alberto Bertogli