|
|
f92ce9 |
From 2566e87a956938a6be3addc586fb2fe53cc8b9f8 Mon Sep 17 00:00:00 2001
|
|
|
f92ce9 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
f92ce9 |
Date: Mon, 8 Sep 2014 14:29:29 -0700
|
|
|
f92ce9 |
Subject: [PATCH 1/7] Ticket #47834 - Tombstone_to_glue: if parents are also
|
|
|
f92ce9 |
converted to glue, the target entry's DN must be adjusted.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Description: Previous fix for the ticket #47834 broke the CI test case
|
|
|
f92ce9 |
47815.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
The fix for 47815 removed the addingentry from the entry cache if
|
|
|
f92ce9 |
SLAPI_PLUGIN_BE_TXN_POST_ADD_FN failed. The #47834 patch accidentally
|
|
|
f92ce9 |
deleted the code.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Instead of adding it back, this patch moves the deletion of the entry
|
|
|
f92ce9 |
from the entry cache to cover both cases SLAPI_PLUGIN_BE_TXN_POST_ADD
|
|
|
f92ce9 |
_FN successes or fails.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
https://fedorahosted.org/389/ticket/47834
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
(cherry picked from commit 7db4fa90caa543b59352046138f453236c0fd652)
|
|
|
f92ce9 |
(cherry picked from commit 78fdd6165cb2c9da4e30452ebdcdcf7aad3d30c7)
|
|
|
f92ce9 |
---
|
|
|
f92ce9 |
ldap/servers/slapd/back-ldbm/ldbm_add.c | 59 ++++++++++++++++++++++++---------
|
|
|
f92ce9 |
1 file changed, 43 insertions(+), 16 deletions(-)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
f92ce9 |
index 2f1b398..b74154a 100644
|
|
|
f92ce9 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
f92ce9 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
|
|
|
f92ce9 |
@@ -1209,21 +1209,6 @@ error_return:
|
|
|
f92ce9 |
{
|
|
|
f92ce9 |
next_id_return( be, addingentry->ep_id );
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
- if ( addingentry )
|
|
|
f92ce9 |
- {
|
|
|
f92ce9 |
- if (inst && cache_is_in_cache(&inst->inst_cache, addingentry)) {
|
|
|
f92ce9 |
- CACHE_REMOVE(&inst->inst_cache, addingentry);
|
|
|
f92ce9 |
- /* tell frontend not to free this entry */
|
|
|
f92ce9 |
- slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
|
|
|
f92ce9 |
- }
|
|
|
f92ce9 |
- else if (!cache_has_otherref(&inst->inst_cache, addingentry))
|
|
|
f92ce9 |
- {
|
|
|
f92ce9 |
- if (!is_resurect_operation) { /* if resurect, tombstoneentry is dupped. */
|
|
|
f92ce9 |
- backentry_clear_entry(addingentry); /* e is released in the frontend */
|
|
|
f92ce9 |
- }
|
|
|
f92ce9 |
- }
|
|
|
f92ce9 |
- CACHE_RETURN( &inst->inst_cache, &addingentry );
|
|
|
f92ce9 |
- }
|
|
|
f92ce9 |
if (rc == DB_RUNRECOVERY) {
|
|
|
f92ce9 |
dblayer_remember_disk_filled(li);
|
|
|
f92ce9 |
ldbm_nasty("Add",80,rc);
|
|
|
f92ce9 |
@@ -1244,6 +1229,20 @@ error_return:
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
diskfull_return:
|
|
|
f92ce9 |
if (disk_full) {
|
|
|
f92ce9 |
+ if ( addingentry ) {
|
|
|
f92ce9 |
+ if (inst && cache_is_in_cache(&inst->inst_cache, addingentry)) {
|
|
|
f92ce9 |
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
|
|
|
f92ce9 |
+ /* tell frontend not to free this entry */
|
|
|
f92ce9 |
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ else if (!cache_has_otherref(&inst->inst_cache, addingentry))
|
|
|
f92ce9 |
+ {
|
|
|
f92ce9 |
+ if (!is_resurect_operation) { /* if resurect, tombstoneentry is dupped. */
|
|
|
f92ce9 |
+ backentry_clear_entry(addingentry); /* e is released in the frontend */
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ CACHE_RETURN( &inst->inst_cache, &addingentry );
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
rc = return_on_disk_full(li);
|
|
|
f92ce9 |
} else {
|
|
|
f92ce9 |
/* It is safer not to abort when the transaction is not started. */
|
|
|
f92ce9 |
@@ -1277,13 +1276,41 @@ diskfull_return:
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
-
|
|
|
f92ce9 |
+ if ( addingentry ) {
|
|
|
f92ce9 |
+ if (inst && cache_is_in_cache(&inst->inst_cache, addingentry)) {
|
|
|
f92ce9 |
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
|
|
|
f92ce9 |
+ /* tell frontend not to free this entry */
|
|
|
f92ce9 |
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ else if (!cache_has_otherref(&inst->inst_cache, addingentry))
|
|
|
f92ce9 |
+ {
|
|
|
f92ce9 |
+ if (!is_resurect_operation) { /* if resurect, tombstoneentry is dupped. */
|
|
|
f92ce9 |
+ backentry_clear_entry(addingentry); /* e is released in the frontend */
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ CACHE_RETURN( &inst->inst_cache, &addingentry );
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
/* Release SERIAL LOCK */
|
|
|
f92ce9 |
if (!noabort) {
|
|
|
f92ce9 |
dblayer_txn_abort(be, &txn); /* abort crashes in case disk full */
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
/* txn is no longer valid - reset the txn pointer to the parent */
|
|
|
f92ce9 |
slapi_pblock_set(pb, SLAPI_TXN, parent_txn);
|
|
|
f92ce9 |
+ } else {
|
|
|
f92ce9 |
+ if ( addingentry ) {
|
|
|
f92ce9 |
+ if (inst && cache_is_in_cache(&inst->inst_cache, addingentry)) {
|
|
|
f92ce9 |
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
|
|
|
f92ce9 |
+ /* tell frontend not to free this entry */
|
|
|
f92ce9 |
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ else if (!cache_has_otherref(&inst->inst_cache, addingentry))
|
|
|
f92ce9 |
+ {
|
|
|
f92ce9 |
+ if (!is_resurect_operation) { /* if resurect, tombstoneentry is dupped. */
|
|
|
f92ce9 |
+ backentry_clear_entry(addingentry); /* e is released in the frontend */
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
+ CACHE_RETURN( &inst->inst_cache, &addingentry );
|
|
|
f92ce9 |
+ }
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
if (!not_an_error) {
|
|
|
f92ce9 |
rc = SLAPI_FAIL_GENERAL;
|
|
|
f92ce9 |
--
|
|
|
f92ce9 |
1.9.3
|
|
|
f92ce9 |
|