Commit 76df30a8 authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount

ITS#9394 syncprov: ignore duplicate sessionlog entries

parent 8f1ec67f
......@@ -1594,6 +1594,7 @@ syncprov_add_slog( Operation *op )
syncprov_info_t *si = on->on_bi.bi_private;
sessionlog *sl;
slog_entry *se;
char uuidstr[40];
int rc;
sl = si->si_logs;
......@@ -1632,12 +1633,11 @@ syncprov_add_slog( Operation *op )
ldap_pvt_thread_rdwr_wlock( &sl->sl_mutex );
if ( LogTest( LDAP_DEBUG_SYNC ) ) {
char uuidstr[40] = {};
uuidstr[0] = 0;
if ( !BER_BVISEMPTY( &opc->suuid ) ) {
lutil_uuidstr_from_normalized( opc->suuid.bv_val, opc->suuid.bv_len,
uuidstr, 40 );
}
Debug( LDAP_DEBUG_SYNC, "%s syncprov_add_slog: "
"adding csn=%s to sessionlog, uuid=%s\n",
op->o_log_prefix, se->se_csn.bv_val, uuidstr );
......@@ -1653,7 +1653,13 @@ syncprov_add_slog( Operation *op )
}
}
rc = tavl_insert( &sl->sl_entries, se, syncprov_sessionlog_cmp, avl_dup_error );
assert( rc == LDAP_SUCCESS );
if ( rc ) {
Debug( LDAP_DEBUG_SYNC, "%s syncprov_add_slog: "
"duplicate sessionlog entry ignored: csn=%s, uuid=%s\n",
op->o_log_prefix, se->se_csn.bv_val, uuidstr );
ch_free( se );
goto leave;
}
sl->sl_num++;
if ( !sl->sl_playing && sl->sl_num > sl->sl_size ) {
Avlnode *edge = tavl_end( sl->sl_entries, TAVL_DIR_LEFT );
......@@ -1685,6 +1691,7 @@ syncprov_add_slog( Operation *op )
sl->sl_num--;
}
}
leave:
ldap_pvt_thread_rdwr_wunlock( &sl->sl_mutex );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment