From 9aa796a24744e184808c5980e4d0d5c20abdbd0f Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Wed, 7 Mar 2018 15:05:19 +0100 Subject: [PATCH] Do not skip change when retrying aborted transaction If the deadlock detection aborts the operation to get c chaneg from the changlog it can be retried, but it has to take care to retry the same csn. If the cl was read with a DB_SET/DB_NEXT combibation and the second one is aborted the flag has to be changed. --- ldap/servers/plugins/replication/cl5_clcache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c index a8477a8..14c5ee5 100644 --- a/ldap/servers/plugins/replication/cl5_clcache.c +++ b/ldap/servers/plugins/replication/cl5_clcache.c @@ -436,6 +436,11 @@ retry: */ if (0 == rc || DB_BUFFER_SMALL == rc) { rc = clcache_cursor_get(cursor, buf, use_flag); + if (rc == DB_LOCK_DEADLOCK && use_flag == DB_NEXT) { + /* we will prpbably retry this, but should not move + * to NEXT again */ + use_flag = DB_SET; + } } } @@ -451,13 +456,12 @@ retry: PRIntervalTime interval; tries++; - slapi_log_err(SLAPI_LOG_TRACE, buf->buf_agmt_name, "clcache_load_buffer_bulk - " + slapi_log_err(SLAPI_LOG_REPL, buf->buf_agmt_name, "clcache_load_buffer_bulk - " "deadlock number [%d] - retrying\n", tries); /* back off */ interval = PR_MillisecondsToInterval(slapi_rand() % 100); DS_Sleep(interval); - use_flag = flag; goto retry; } if ((rc == DB_LOCK_DEADLOCK) && (tries >= MAX_TRIALS)) { -- 2.9.5