Full_Name: Hallvard B Furuseth
Version: mdb.master 0cdd9dffddf66c730a35f48db2bb02d8bb3e5731
OS: Linux x86_64
URL:
Submission from: (NULL) (193.69.163.163)
Submitted by: hallvard
If a cursor is at a clean subDB page, and its current item is deleted
by another cursor, then MDB_GET_CURRENT returns the deleted item.
Test program below, run with no args, the "m2/del" output line.
If the page was dirty, I instead got (key = old, data = size 0).
I don't know if it should give MDB_NOTFOUND instead.
…
[View More]That's the test program run with one arg.
I did not check what happens if the other cursor rearranged
the pages, e.g. split the item off to another page.
#include "lmdb.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char *fname = "test.mdb";
MDB_env *env;
MDB_txn *txn;
MDB_dbi dbi;
MDB_cursor *mc, *m2;
MDB_val key, data;
int rc;
# define STR2VAL(s) (&(MDB_val){sizeof(s), s}) /* includes final \0 */
# define SHOW(name) printf("%s:\t%s[%zd] -> %s[%zd]\n", name, \
(char*)key.mv_data, key.mv_size, (char*)data.mv_data, data.mv_size)
# define E(e) { rc = (e); if (rc) { fprintf(stderr, "%s:%d: %s: %s\n",\
__FILE__, __LINE__, #e, mdb_strerror(rc)); abort(); } }
remove(fname);
E(mdb_env_create(&env));
E(mdb_env_open(env, fname, MDB_NOSUBDIR, 0666));
E(mdb_txn_begin(env, NULL, 0, &txn));
E(mdb_dbi_open(txn, NULL, MDB_DUPSORT, &dbi));
E(mdb_cursor_open(txn, dbi, &mc));
E(mdb_cursor_put(mc, STR2VAL("a"), STR2VAL("x"), 0));
E(mdb_cursor_put(mc, STR2VAL("a"), STR2VAL("y"), 0));
if (argc < 2) {
E(mdb_txn_commit(txn));
E(mdb_txn_begin(env, NULL, 0, &txn));
E(mdb_cursor_open(txn, dbi, &mc));
puts("With clean page:");
}
E(mdb_cursor_open(txn, dbi, &m2));
E(mdb_cursor_get(mc, &key, &data, MDB_FIRST));
E(mdb_cursor_get(m2, &key, &data, MDB_FIRST));
SHOW("Name:\tKey -> Data (mv_data[mv_len]):\n" "m2");
E(mdb_cursor_del(mc, 0));
E(mdb_cursor_get(m2, &key, &data, MDB_GET_CURRENT));
SHOW("m2/del"); /* Should output the same as... */
E(mdb_cursor_get(mc, &key, &data, MDB_GET_CURRENT));
SHOW("mc/del"); /* ...this: "a[2] -> [0]". */
mdb_txn_abort(txn);
mdb_env_close(env);
return 0;
}
[View Less]
Another issue: This breaks because liblmdb does not
change the node size when overwriting an overflow page:
mdb_put(txn, dbi, &key, &(MDB_val){9000, val}, 0);
mdb_put(txn, dbi, &key, &(MDB_val){1, val}, 0);
mdb_get(txn, dbi, &key, &data);
assert(data.mv_size != 9000);
Fixed by 0cdd9dffddf66c730a35f48db2bb02d8bb3e5731.
mdb_cursor_put() said:
/* yes, overwrite it. Note in this case we don't
* bother to try shrinking the node if the new data
* is smaller than …
[View More]the overflow threshold.
*/
It's number of pages which does not need to shrink.
--
Hallvard
[View Less]
Juergen.Sprenger(a)swisscom.com wrote:
> tried the fix fb537d747c6fd43e08986e99b1fe7781660feaf3
There was a followup commit also needed. 201ddbe3e4d8eb39830b96eefa559900952bc022
Just get the latest.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Full_Name: Sandeep Singh
Version: openldap-2.4.35
OS: CentOS Linux release 6.0
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (202.137.232.113)
Hello,
We have configured an openldap server with mysql as the backend. It is working
fine as well.
We have a scenario where we feel it is not behaving the way it is required.
We have multiple domains say:-
1) abc.com
2) xyz.com
Have mapped user as:-
1) mail=man1(a)red.com,dc=abc,dc=com with …
[View More]password=man1r
2) mail=man2(a)red.com,dc=abc,dc=com with password=man2r
3) mail=man1(a)sad.com,dc=xyz,dc=com with password=man1s
4) mail=man2(a)sad.com,dc=xyz,dc=com with password=man2s
When we search for result using:-
ldapsearch -x -D "mail=man1(a)red.com,dc=abc,dc=com" -W -b "dc=abc,dc=com"
It gives us output / result shown is of domains abc.com i.e.
mail=man1(a)red.com,dc=abc,dc=com & mail=man1@red.com,dc=abc,dc=com Which is
correct
But when we search for results using:-
ldapsearch -x -D "mail=man1(a)red.com,dc=abc,dc=com" -W -b "dc=xyz,dc=com"
Then the output / result shown is of domain xyz.com i.e.
mail=man1(a)sad.com,dc=xyz,dc=com & mail=man2@sad.com,dc=xyz,dc=com because the
base search is dc=xyz,dc=com Which is not correct as
mail=man1(a)red.com,dc=abc,dc=com does not belong to xyz.com domain
So we want to authenticate and display user along with the list of other users
from the same domain and not from the other domain.
Please suggest how to overcome / solve the issue.
[View Less]
Full_Name: Howard Chu
Version: 2.4.33+
OS:
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (78.155.233.73)
Submitted by: hyc
Already fixed in mdb.master commit 7233bc295bb3e40b2758158ae2de6f42516962f8
In mdb_page_split, if updating the parent's separator triggers a split in the
parent, and the current cursor position happens to point to the split index, the
cursor will be left pointing to the old parent page instead of the correct page.
Full_Name: Jorge Perez Burgos
Version: 2.4.32
OS: SLES 10
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (195.235.15.243)
Right now when sending bulk traffic trough back-meta and killing the slapds
receiving the proxy traffic, it can be seen that a very few modify operations
are not receiving the result of the operations, looking at the code it seems the
same for the add and delete operation. Basically when ldap_modify_ext returns an
errno it seems that is not properly handle afterwards.
I wrote:
> OTOH if you add a bunch of slightly smaller nodes, mdb will put
> most of them in separate pages anyway without MDB_APPEND.
...because mdb_page_split() has been wasteful since 48ef27b6f5c804eca6a9
"ITS#7385 fix mdb_page_split (again)". When a txn put()s ascending
keys with nodes of the same size, the new item goes in the fullest page.
E.g. put data size 1010 with 'int' keys 1,2,3... to an MDB_INTEGERKEY
DB. As the txn progresses, (page: #key #key...) get distributed thus:
…
[View More]Page 2: #1.
Page 2: #1 #2.
Page 2: #1 #2 #3.
Page 2: #1. Page 3: #2 #3 #4.
Page 2: #1. Page 3: #2. Page 5: #3 #4 #5.
Page 2: #1. Page 3: #2. Page 5: #3. Page 6: #4 #5 #6.
2/3 wasted space. Descending put() work better:
Page 2: #6.
Page 2: #5 #6.
Page 2: #4 #5 #6.
Page 2: #3 #4. Page 3: #5 #6.
Page 2: #2 #3 #4. Page 3: #5 #6.
Page 2: #2 #1. Page 3: #5 #6. Page 5: #3 #4.
Ascending put() with datasize 1348, so only 2 nodes fit in a page:
Page 2: #1.
Page 2: #1 #2.
Page 2: #1. Page 3: #2 #3.
Page 2: #1. Page 3: #2. Page 5: #3 #4.
Half of the space is wasted. Descending order does not help.
page_split() cannot know which split is best in this case. But it'll
help to guess that the next put() key sometimes will be near this one,
and ensure that the node with the new key will be the smallest. That
will also avoid touching the old page when the nodes are that large,
since the "split" will keep all old nodes in the old page.
Trying a simpler patch for this one:
> Nodes of size MDB_env.me_nodemax-1 do not go in overflow pages,
> but are too big for two of them to fit in the same page. (...)
Let mdb_env_open2() round me_nodemax down to an odd number:
env->me_nodemax = (((env->me_psize - PAGEHDRSZ) / MDB_MINKEYS) - 1) | 1;
Then a leaf page with just 1 node can always get another one, since
mdb_node_add() will always put too big items in overflow pages.
In a DB newer than this patch, anyway...
Maybe mdb_cursor_put() should use the value from before
'offset += offset & 1;' in next line's compare with me_nodemax:
@@ -5128,5 +5128,6 @@
}
+ i = offset;
offset += offset & 1;
if (NODESIZE + sizeof(indx_t) + NODEKSZ(leaf) + NODEDSZ(leaf) +
- offset >= mc->mc_txn->mt_env->me_nodemax) {
+ i >= mc->mc_txn->mt_env->me_nodemax) {
/* yes, convert it */
This passes 'make test', with or without changing cursor_put().
But I still don't quite know what I'm doing - otherwise my LEAFSIZE
patch would have worked too.
--
Hallvard
[View Less]
Full_Name: Quanah Gibson-Mount
Version: 2.4.35
OS: linux 2.6
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (75.111.58.125)
H3: Overview
The {{bdb}} backend to {{slapd}}(8) is the recommended primary backend for a
normal {{slapd}} database.
Which stopped being true with OpenLDAP 2.3 IIRC, which is when back-hdb was made
the recommended backend.