-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 5939 - During an update, if the target entry is reverted in the… #6007
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ find_entry_internal_dn( | |
size_t tries = 0; | ||
int isroot = 0; | ||
int op_type; | ||
int reverted_entry = 0; | ||
|
||
/* get the managedsait ldap message control */ | ||
slapi_pblock_get(pb, SLAPI_MANAGEDSAIT, &managedsait); | ||
|
@@ -141,12 +142,20 @@ find_entry_internal_dn( | |
*/ | ||
slapi_log_err(SLAPI_LOG_ARGS, "find_entry_internal_dn", | ||
" Retrying (%s)\n", slapi_sdn_get_dn(sdn)); | ||
if (cache_is_reverted_entry(&inst->inst_cache, e)) { | ||
reverted_entry = 1; | ||
break; | ||
} | ||
CACHE_RETURN(&inst->inst_cache, &e); | ||
tries++; | ||
} | ||
if (tries >= LDBM_CACHE_RETRY_COUNT) { | ||
slapi_log_err(SLAPI_LOG_ERR, "find_entry_internal_dn", "Retry count exceeded (%s)\n", slapi_sdn_get_dn(sdn)); | ||
} | ||
if (reverted_entry) { | ||
slapi_send_ldap_result(pb, LDAP_BUSY, NULL, "target entry busy because of a canceled operation", 0, NULL); | ||
return (NULL); | ||
} | ||
/* | ||
* there is no such entry in this server. see how far we | ||
* can match, and check if that entry contains a referral. | ||
|
@@ -262,6 +271,7 @@ find_entry_internal_uniqueid( | |
struct backentry *e; | ||
int err; | ||
size_t tries = 0; | ||
int reverted_entry = 0; | ||
|
||
while ((tries < LDBM_CACHE_RETRY_COUNT) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we not reset reverted_entry in the while loop ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A reverted entry may be the target of several requests that started before it got reverted. Those req increased the refcnt and we have to wait that all requests call cache_return. The last cache_return will reset and remove the entry from the cache. |
||
(e = uniqueid2entry(be, uniqueid, txn, &err)) != NULL) { | ||
|
@@ -283,6 +293,10 @@ find_entry_internal_uniqueid( | |
*/ | ||
slapi_log_err(SLAPI_LOG_ARGS, | ||
" find_entry_internal_uniqueid", "Retrying; uniqueid = (%s)\n", uniqueid); | ||
if (cache_is_reverted_entry(&inst->inst_cache, e)) { | ||
reverted_entry = 1; | ||
break; | ||
} | ||
CACHE_RETURN(&inst->inst_cache, &e); | ||
tries++; | ||
} | ||
|
@@ -292,9 +306,14 @@ find_entry_internal_uniqueid( | |
uniqueid); | ||
} | ||
|
||
/* entry not found */ | ||
slapi_send_ldap_result(pb, (0 == err || DBI_RC_NOTFOUND == err) ? LDAP_NO_SUCH_OBJECT : LDAP_OPERATIONS_ERROR, NULL /* matched */, NULL, | ||
0, NULL); | ||
if (reverted_entry) { | ||
slapi_send_ldap_result(pb, LDAP_BUSY, NULL, "target entry busy because of a canceled operation", 0, NULL); | ||
return (NULL); | ||
} else { | ||
/* entry not found */ | ||
slapi_send_ldap_result(pb, (0 == err || DBI_RC_NOTFOUND == err) ? LDAP_NO_SUCH_OBJECT : LDAP_OPERATIONS_ERROR, NULL /* matched */, NULL, | ||
0, NULL); | ||
} | ||
slapi_log_err(SLAPI_LOG_TRACE, | ||
"find_entry_internal_uniqueid", "<= not found; uniqueid = (%s)\n", | ||
uniqueid); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not reset the reverted_entry flag in the while loop ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see response above. In short it is the job of cache_return to reset/free the entry when refcnt==0