I'm having some trouble working out where to set the normalized value for ContextCSN in the modlist for the syncrepl refresh consumer (test017-syncreplication-refresh fails).
The assertion backtrace looks like this: #0 0x00007f472879d095 in raise () from /lib/libc.so.6 #1 0x00007f472879eaf0 in abort () from /lib/libc.so.6 #2 0x00007f47287962df in __assert_fail () from /lib/libc.so.6 #3 0x0000000000425903 in attr_valadd (a=0x8fb380, vals=0xc72130, nvals=0x0, nn=1) at attr.c:398 #4 0x000000000046714c in modify_add_values (e=0x41ff5bb0, mod=0x41ff60e0, permissive=0, text=0x41ff6090, textbuf=0x41ff5cb0 "", textlen=256) at mods.c:155 #5 0x000000000048147d in bdb_modify_internal (op=0x41ff6780, tid=0xc71f50, modlist=0x41ff60e0, e=0x41ff5bb0, text=0x41ff6090, textbuf=0x41ff5cb0 "", textlen=256) at modify.c:133 #6 0x0000000000481f6d in bdb_modify (op=0x41ff6780, rs=0x41ff6070) at modify.c:578 #7 0x0000000000477d32 in overlay_op_walk (op=0x41ff6780, rs=0x41ff6070, which=op_modify, oi=0x858990, on=0x0) at backover.c:646 #8 0x00000000004782b3 in over_op_func (op=0x41ff6780, rs=0x41ff6070, which=op_modify) at backover.c:698 #9 0x000000000046dc59 in syncrepl_updateCookie (si=0x858560, op=0x249e, pdn=<value optimized out>, syncCookie=0x41ff6310) at syncrepl.c:2785 #10 0x0000000000472bea in do_syncrep2 (op=0x41ff6780, si=0x858560) at syncrepl.c:961 #11 0x0000000000475072 in do_syncrepl (ctx=0x0, arg=0x8588f0) at syncrepl.c:1276 #12 0x00000000004daa4a in ldap_int_thread_pool_wrapper (xpool=0x82e440) at tpool.c:663 #13 0x00007f47296d03f7 in start_thread () from /lib/libpthread.so.0 #14 0x00007f4728842b2d in clone () from /lib/libc.so.6 #15 0x0000000000000000 in ?? ()
In frame 3 a->a_desc->ad_type->sat_equality has a value but nvals has not been set, which is why the assertion triggers: (gdb) print a->a_desc->ad_type->sat_equality $39 = (MatchingRule *) 0x821be0
Way back in frame 10 do_syncrepl passes a modlist containing an unnormalized contextCSN to do_syncrep2, leading me to believe that I've missed something in syncrepl.c: (gdb) print *op->o_request->oq_modify->rs_mods->rs_modlist $44 = {sml_mod = {sm_desc = 0x824b70, sm_values = 0xc72130, sm_nvalues = 0x0, sm_numvals = 1, sm_op = 2, sm_flags = 0, sm_type = {bv_len = 10, bv_val = 0x824be0 "contextCSN"}}, sml_next = 0x0}
The debug output up to the assertion is: slap_queue_csn: queing 0xc72ae0 20080531010928.580166Z#000000#000#000000 daemon: epoll: listen=10 active_threads=0 tvp=zero => bdb_entry_get: ndn: "dc=example,dc=com" => bdb_entry_get: oc: "(null)", at: "(null)" bdb_dn2entry("dc=example,dc=com") => bdb_entry_get: found entry: "dc=example,dc=com" bdb_entry_get: rc=0 bdb_modify: dc=example,dc=com bdb_dn2entry("dc=example,dc=com") bdb_modify_internal: 0x00000001: dc=example,dc=com <= acl_access_allowed: granted to database root bdb_modify_internal: replace contextCSN slapd: attr.c:398: attr_valadd: Assertion `have_norm == new_nval' failed.