X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-mdb%2Fidl.c;h=2cba7c27590745a9fc66f457589d53eb558c5ede;hb=8102d9d2df0d97b70f9d5d9e54e7a171975a6fee;hp=35623ad624a84476396dcb07fad14135ba5ded00;hpb=ff1839ebe653816679794a8c84ada71009b3314c;p=openldap diff --git a/servers/slapd/back-mdb/idl.c b/servers/slapd/back-mdb/idl.c index 35623ad624..2cba7c2759 100644 --- a/servers/slapd/back-mdb/idl.c +++ b/servers/slapd/back-mdb/idl.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2000-2012 The OpenLDAP Foundation. + * Copyright 2000-2013 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -391,14 +391,16 @@ mdb_idl_fetch_key( int mdb_idl_insert_keys( + BackendDB *be, MDB_cursor *cursor, struct berval *keys, ID id ) { + struct mdb_info *mdb = be->be_private; MDB_val key, data; ID lo, hi, *i; char *err; - int rc, k; + int rc = 0, k; unsigned int flag = MDB_NODUPDATA; #ifndef MISALIGNED_OK int kbuf[2]; @@ -490,8 +492,8 @@ mdb_idl_insert_keys( } } else { /* There's room, just store it */ - if ( slapMode & SLAP_TOOL_QUICK ) - flag |= MDB_APPEND; + if (id == mdb->mi_nextid) + flag |= MDB_APPENDDUP; goto put1; } } else { @@ -518,7 +520,7 @@ mdb_idl_insert_keys( } } } else if ( rc == MDB_NOTFOUND ) { - flag &= ~MDB_APPEND; + flag &= ~MDB_APPENDDUP; put1: data.mv_data = &id; data.mv_size = sizeof(ID); rc = mdb_cursor_put( cursor, &key, &data, flag ); @@ -542,11 +544,12 @@ fail: int mdb_idl_delete_keys( + BackendDB *be, MDB_cursor *cursor, struct berval *keys, ID id ) { - int rc, k; + int rc = 0, k; MDB_val key, data; ID lo, hi, tmp, *i; char *err; @@ -1081,7 +1084,7 @@ mdb_idl_sort( ID *ids, ID *tmp ) /* 8 bit Radix sort + insertion sort * * based on code from http://www.cubic.org/docs/radix.htm - * with improvements by mbackes@symas.com and hyc@symas.com + * with improvements by ebackes@symas.com and hyc@symas.com * * This code is O(n) but has a relatively high constant factor. For lists * up to ~50 Quicksort is slightly faster; up to ~100 they are even.