Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 7890e21bbbcc33587df9cbf1953021a706ca5f80
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Oct 15 10:31:48 2012 -0400
Ticket 488 - Doc: DS error log messages with typo
Bug Description: There was a typo in dblayer_get_home_dir()
Fix Description: Fixed typo.
https://fedorahosted.org/389/ticket/488
Reviewed by: Noriko(Thanks!)
(cherry picked from commit 4d522d34e3a019f6d0af125c33b50cfcd1557f3a)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 5452d6b..02cb3fd 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -414,7 +414,7 @@ dblayer_get_home_dir(struct ldbminfo *li, int *dbhome)
if (NULL == home_dir)
{
LDAPDebug(LDAP_DEBUG_ANY,"Db home directory is not set. "
- "Possibly %s (optinally %s) is missing in the config file.\n",
+ "Possibly %s (optionally %s) is missing in the config file.\n",
CONFIG_DIRECTORY, CONFIG_DB_HOME_DIRECTORY, 0);
}
return home_dir;
11 years, 6 months
ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 4d522d34e3a019f6d0af125c33b50cfcd1557f3a
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Oct 15 10:31:48 2012 -0400
Ticket 488 - Doc: DS error log messages with typo
Bug Description: There was a typo in dblayer_get_home_dir()
Fix Description: Fixed typo.
https://fedorahosted.org/389/ticket/488
Reviewed by: Noriko(Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 3a400bc..ed7d770 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -414,7 +414,7 @@ dblayer_get_home_dir(struct ldbminfo *li, int *dbhome)
if (NULL == home_dir)
{
LDAPDebug(LDAP_DEBUG_ANY,"Db home directory is not set. "
- "Possibly %s (optinally %s) is missing in the config file.\n",
+ "Possibly %s (optionally %s) is missing in the config file.\n",
CONFIG_DIRECTORY, CONFIG_DB_HOME_DIRECTORY, 0);
}
return home_dir;
11 years, 6 months
ldap/admin ldap/servers
by Noriko Hosoi
ldap/admin/src/scripts/template-bak2db.in | 13 ++---
ldap/admin/src/scripts/template-db2bak.in | 14 ++---
ldap/admin/src/scripts/template-db2ldif.in | 2
ldap/admin/src/scripts/template-ldif2db.in | 35 ++++++++++++--
ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c | 12 ++--
ldap/servers/slapd/main.c | 67 ++++++++++++++++++---------
6 files changed, 94 insertions(+), 49 deletions(-)
New commits:
commit da07b507859ae994b4a1828f6815b99e0d301645
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Thu Oct 11 14:36:05 2012 -0700
Trac Ticket #451 - Allow db2ldif to be quiet
https://fedorahosted.org/389/ticket/451
Description: Export utility db2ldif and import utility ldif2db are
always verbose. This patch is adding an option '-q' to suppress
the outputs.
This patch modifies db2bak and bak2db which already supports '-q',
as well. The scripts used to interpret '-q'. If it was not set,
a verbose debug option '-d 524288' was passed to ns-slapd. Instead,
this patch directly passes '-q' to ns-slapd and let it handle it
in the C code.
diff --git a/ldap/admin/src/scripts/template-bak2db.in b/ldap/admin/src/scripts/template-bak2db.in
index b081839..013a9f1 100755
--- a/ldap/admin/src/scripts/template-bak2db.in
+++ b/ldap/admin/src/scripts/template-bak2db.in
@@ -44,13 +44,6 @@ do
d) dlevel=$OPTARG;;
esac
done
-if [ $quiet -eq 0 ]
-then
- if [ $dlevel -ne 524288 ]
- then
- dlevel=`expr $dlevel + 524288`
- fi
-fi
if [ 1 = `expr $archivedir : "\/"` ]
then
@@ -61,4 +54,8 @@ else
fi
cd {{SERVERBIN-DIR}}
-./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir $benameopt -d $dlevel
+if [ $quiet -eq 0 ]; then
+ ./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir $benameopt -d $dlevel
+else
+ ./ns-slapd archive2db -D {{CONFIG-DIR}} -a $archivedir $benameopt -d $dlevel -q
+fi
diff --git a/ldap/admin/src/scripts/template-db2bak.in b/ldap/admin/src/scripts/template-db2bak.in
index d89f6ee..85aac0f 100755
--- a/ldap/admin/src/scripts/template-db2bak.in
+++ b/ldap/admin/src/scripts/template-db2bak.in
@@ -46,14 +46,10 @@ then
esac
done
fi
-# If not quiet, set LDAP_DEBUG_BACKLDBM to debug level
-if [ $quiet -eq 0 ]
-then
- if [ $dlevel -ne 524288 ]
- then
- dlevel=`expr $dlevel + 524288`
- fi
-fi
echo "Back up directory: $bak_dir"
-./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir -d $dlevel
+if [ $quiet -eq 0 ]; then
+ ./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir -d $dlevel
+else
+ ./ns-slapd db2archive -D {{CONFIG-DIR}} -a $bak_dir -d $dlevel -q
+fi
diff --git a/ldap/admin/src/scripts/template-db2ldif.in b/ldap/admin/src/scripts/template-db2ldif.in
index 2989b77..d3a12be 100755
--- a/ldap/admin/src/scripts/template-db2ldif.in
+++ b/ldap/admin/src/scripts/template-db2ldif.in
@@ -69,7 +69,7 @@ if [ "$#" -lt 2 ];
then
echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*"
echo " [{-x excludesuffix}*] [-a outputfile]"
- echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]"
+ echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1] [-q]"
echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required."
exit 1
fi
diff --git a/ldap/admin/src/scripts/template-ldif2db.in b/ldap/admin/src/scripts/template-ldif2db.in
index 8f92acf..ceb0157 100755
--- a/ldap/admin/src/scripts/template-ldif2db.in
+++ b/ldap/admin/src/scripts/template-ldif2db.in
@@ -19,15 +19,40 @@ export LD_LIBRARY_PATH
SHLIB_PATH=$LD_LIBRARY_PATH
export SHLIB_PATH
+usage()
+{
+ echo "Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]"
+ echo " {-i ldiffile}* [-O] [-q]"
+ echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" and \"-i ldiffile\" are required."
+}
+
+handleopts()
+{
+ while [ "$1" != "" ]
+ do
+ if [ "$1" = "-q" ]; then
+ return 1
+ elif [ "$1" = "-h" ]; then
+ usage
+ exit 1
+ fi
+ shift
+ done
+ return 0
+}
+
cd {{SERVERBIN-DIR}}
if [ $# -lt 4 ]
then
- echo "Usage: ldif2db -n backend_instance | {-s includesuffix}* [{-x excludesuffix}*]"
- echo " {-i ldiffile}* [-O]"
- echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" and \"-i ldiffile\" are required."
- exit 1
+ usage
+ exit 1
fi
-echo importing data ...
+handleopts $@
+quiet=$?
+
+if [ $quiet -eq 0 ]; then
+ echo importing data ...
+fi
./ns-slapd ldif2db -D {{CONFIG-DIR}} "$@" 2>&1
exit $?
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index e50b930..82806db 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -259,7 +259,7 @@ entryrdn_index_entry(backend *be,
rc = LDAP_INVALID_DN_SYNTAX;
goto bail;
} else if (rc > 0) {
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"entryrdn_index_entry: %s does not belong to "
"the db\n", slapi_sdn_get_dn(sdn));
rc = DB_NOTFOUND;
@@ -393,7 +393,7 @@ entryrdn_index_read_ext(backend *be,
rc = LDAP_INVALID_DN_SYNTAX;
goto bail;
} else if (rc > 0) {
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"entryrdn_index_read: %s does not belong to the db\n",
slapi_sdn_get_dn(sdn));
rc = DB_NOTFOUND;
@@ -551,7 +551,7 @@ entryrdn_rename_subtree(backend *be,
rc = LDAP_INVALID_DN_SYNTAX;
goto bail;
} else if (rc > 0) {
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"entryrdn_rename_subtree: %s does not belong to "
"the db\n", slapi_sdn_get_dn(oldsdn));
rc = DB_NOTFOUND;
@@ -1020,7 +1020,7 @@ entryrdn_get_subordinates(backend *be,
"\"%s\" to Slapi_RDN\n", slapi_sdn_get_dn(sdn));
rc = LDAP_INVALID_DN_SYNTAX;
} else if (rc > 0) {
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"entryrdn_get_subordinates: %s does not belong to "
"the db\n", slapi_sdn_get_dn(sdn));
rc = DB_NOTFOUND;
@@ -2516,7 +2516,7 @@ _entryrdn_insert_key(backend *be,
} /* if (TMPID == tmpid) */
rc = 0;
} /* if (DB_KEYEXIST == rc) */
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"_entryrdn_insert_key: Suffix %s added: %d\n",
nrdn, rc);
goto bail; /* succeeded or failed, it's done */
@@ -2589,7 +2589,7 @@ _entryrdn_insert_key(backend *be,
adddata.flags = DB_DBT_USERMEM;
rc = _entryrdn_put_data(cursor, &key, &adddata, RDN_INDEX_SELF, db_txn);
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
+ slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"_entryrdn_insert_key: Suffix %s added: %d\n",
slapi_rdn_get_rdn(tmpsrdn), rc);
#ifdef FIX_TXN_DEADLOCKS
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index cf4e2e3..f438fce 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -414,20 +414,20 @@ usage( char *name, char *extraname )
case SLAPD_EXEMODE_DB2LDIF:
usagestr = "usage: %s %s%s-D configdir [-n backend-instance-name] [-d debuglevel] "
"[-N] [-a outputfile] [-r] [-C] [{-s includesuffix}*] "
- "[{-x excludesuffix}*] [-u] [-U] [-m] [-M] [-E]\n"
+ "[{-x excludesuffix}*] [-u] [-U] [-m] [-M] [-E] [-q]\n"
"Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n";
break;
case SLAPD_EXEMODE_LDIF2DB:
usagestr = "usage: %s %s%s-D configdir [-d debuglevel] "
"[-n backend_instance_name] [-O] [-g uniqueid_type] [--namespaceid uniqueID]"
- "[{-s includesuffix}*] [{-x excludesuffix}*] [-E] {-i ldif-file}*\n"
+ "[{-s includesuffix}*] [{-x excludesuffix}*] [-E] [-q] {-i ldif-file}*\n"
"Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n";
break;
case SLAPD_EXEMODE_DB2ARCHIVE:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n";
+ usagestr = "usage: %s %s%s-D configdir [-q] [-d debuglevel] -a archivedir\n";
break;
case SLAPD_EXEMODE_ARCHIVE2DB:
- usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n";
+ usagestr = "usage: %s %s%s-D configdir [-q] [-d debuglevel] -a archivedir\n";
break;
case SLAPD_EXEMODE_DB2INDEX:
usagestr = "usage: %s %s%s-D configdir -n backend-instance-name "
@@ -490,6 +490,7 @@ static char *ldif2db_namespaceid = NULL;
int importexport_encrypt = 0;
static int upgradedb_flags = 0;
static int upgradednformat_dryrun = 0;
+static int is_quiet = 0;
/* taken from idsktune */
#if defined(__sun)
@@ -740,7 +741,7 @@ main( int argc, char **argv)
/* display debugging level if it is anything other than the default */
if ( 0 != ( slapd_ldap_debug & ~LDAP_DEBUG_ANY )) {
- slapd_debug_level_log( slapd_ldap_debug );
+ slapd_debug_level_log( slapd_ldap_debug );
}
#ifndef LDAP_DONT_USE_SMARTHEAP
@@ -1354,7 +1355,7 @@ process_command_line(int argc, char **argv, char *myname,
*
*/
- char *opts_db2ldif = "vd:D:ENa:rs:x:CSut:n:UmMo1";
+ char *opts_db2ldif = "vd:D:ENa:rs:x:CSut:n:UmMo1q";
struct opt_ext long_options_db2ldif[] = {
{"version",ArgNone,'v'},
{"debug",ArgRequired,'d'},
@@ -1373,9 +1374,10 @@ process_command_line(int argc, char **argv, char *myname,
{"oneOutputFile",ArgNone,'o'},
{"multipleOutputFile",ArgNone,'M'},
{"noVersionNum",ArgNone,'1'},
+ {"quiet",ArgNone,'q'},
{0,0,0}};
- char *opts_ldif2db = "vd:i:g:G:n:s:x:NOCc:St:D:E";
+ char *opts_ldif2db = "vd:i:g:G:n:s:x:NOCc:St:D:Eq";
struct opt_ext long_options_ldif2db[] = {
{"version",ArgNone,'v'},
{"debug",ArgRequired,'d'},
@@ -1392,9 +1394,10 @@ process_command_line(int argc, char **argv, char *myname,
{"nostate",ArgNone,'Z'},
{"configDir",ArgRequired,'D'},
{"encrypt",ArgOptional,'E'},
+ {"quiet",ArgNone,'q'},
{0,0,0}};
- char *opts_archive2db = "vd:i:a:n:SD:";
+ char *opts_archive2db = "vd:i:a:n:SD:q";
struct opt_ext long_options_archive2db[] = {
{"version",ArgNone,'v'},
{"debug",ArgRequired,'d'},
@@ -1403,10 +1406,11 @@ process_command_line(int argc, char **argv, char *myname,
{"backEndInstName",ArgRequired,'n'},
{"allowMultipleProcesses",ArgNone,'S'},
{"configDir",ArgRequired,'D'},
+ {"quiet",ArgNone,'q'},
{0,0,0}};
- char *opts_db2archive = "vd:i:a:SD:";
+ char *opts_db2archive = "vd:i:a:SD:q";
struct opt_ext long_options_db2archive[] = {
{"version",ArgNone,'v'},
{"debug",ArgRequired,'d'},
@@ -1414,6 +1418,7 @@ process_command_line(int argc, char **argv, char *myname,
{"archive",ArgRequired,'a'},
{"allowMultipleProcesses",ArgNone,'S'},
{"configDir",ArgRequired,'D'},
+ {"quiet",ArgNone,'q'},
{0,0,0}};
char *opts_db2index = "vd:a:t:T:SD:n:s:x:";
@@ -1913,6 +1918,9 @@ process_command_line(int argc, char **argv, char *myname,
ldif_printkey |= EXPORT_NOVERSION;
break;
+ case 'q': /* quiet option for db2ldif, ldif2db, db2bak, bak2db */
+ is_quiet = 1;
+ break;
default:
usage( myname, *extraname );
exit( 1 );
@@ -2224,7 +2232,12 @@ slapd_exemode_ldif2db()
plugin->plg_name, 0, 0);
return 1;
}
-
+ if (!is_quiet) {
+ slapd_ldap_debug |= LDAP_DEBUG_BACKLDBM;
+ }
+ if (!(slapd_ldap_debug & LDAP_DEBUG_BACKLDBM)) {
+ g_set_detached(1);
+ }
memset( &pb, '\0', sizeof(pb) );
pb.pb_backend = NULL;
pb.pb_plugin = plugin;
@@ -2352,6 +2365,12 @@ slapd_exemode_db2ldif(int argc, char** argv)
return 1;
}
+ if (!is_quiet) {
+ slapd_ldap_debug |= LDAP_DEBUG_BACKLDBM;
+ }
+ if (!(slapd_ldap_debug & LDAP_DEBUG_BACKLDBM)) {
+ g_set_detached(1);
+ }
memset( &pb, '\0', sizeof(pb) );
pb.pb_backend = NULL;
pb.pb_plugin = plugin;
@@ -2411,13 +2430,15 @@ slapd_exemode_db2ldif(int argc, char** argv)
}
}
- fprintf(stderr, "ldiffile: %s\n", my_ldiffile);
+ if (!is_quiet) {
+ fprintf(stderr, "ldiffile: %s\n", my_ldiffile);
+ }
/* just send the filename to the backend and let
* the backend open it (so they can do special
* stuff for 64-bit fs)
*/
pb.pb_ldif_file = my_ldiffile;
- pb.pb_ldif_printkey = ldif_printkey;
+ pb.pb_ldif_printkey = ldif_printkey;
}
return_value = (plugin->plg_db2ldif)( &pb );
@@ -2583,10 +2604,10 @@ slapd_exemode_db2archive()
/* Make sure we aren't going to run slapd in
* a mode that is going to conflict with other
- * slapd processes that are currently running
- */
- if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
- skip_db_protect_check) == -1 ) {
+ * slapd processes that are currently running
+ */
+ if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
+ skip_db_protect_check) == -1 ) {
LDAPDebug( LDAP_DEBUG_ANY,
"Shutting down due to possible conflicts with other slapd processes\n",
0, 0, 0 );
@@ -2596,6 +2617,9 @@ slapd_exemode_db2archive()
LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0);
return 1;
}
+ if (!is_quiet) {
+ slapd_ldap_debug |= LDAP_DEBUG_BACKLDBM;
+ }
if (!(slapd_ldap_debug & LDAP_DEBUG_BACKLDBM)) {
g_set_detached(1);
}
@@ -2636,10 +2660,10 @@ slapd_exemode_archive2db()
/* Make sure we aren't going to run slapd in
* a mode that is going to conflict with other
- * slapd processes that are currently running
- */
- if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
- skip_db_protect_check) == -1 ) {
+ * slapd processes that are currently running
+ */
+ if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
+ skip_db_protect_check) == -1 ) {
LDAPDebug( LDAP_DEBUG_ANY,
"Shutting down due to possible conflicts with other slapd processes\n",
0, 0, 0 );
@@ -2650,6 +2674,9 @@ slapd_exemode_archive2db()
return 1;
}
+ if (!is_quiet) {
+ slapd_ldap_debug |= LDAP_DEBUG_BACKLDBM;
+ }
if (!(slapd_ldap_debug & LDAP_DEBUG_BACKLDBM)) {
g_set_detached(1);
}
11 years, 6 months
ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/repl_extop.c | 59 ++++++++++++++------------
1 file changed, 32 insertions(+), 27 deletions(-)
New commits:
commit bf54018e8ee4b355c66621ad3bfe5e59d4820170
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Oct 11 11:57:24 2012 -0600
Ticket #491 - multimaster_extop_cleanruv returns wrong error codes
https://fedorahosted.org/389/ticket/491
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: multimaster_extop_cleanruv must return with a code of
SLAPI_PLUGIN_EXTENDED_SENT_RESULT to tell the server that the result
has been sent - otherwise, in 1.2.10, the server will attempt to send
the result again. In 1.2.11 the result code has been changed to ignore
a subsequent attempt to send a result for the same operation, but the
function should still return the correct codes.
I also cleaned up the error codes and memory management a bit.
Platforms tested: RHEL6 x86_64, Fedora 16
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index c94ef8f..5aac699 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -1446,19 +1446,20 @@ free_and_return:
int
multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
{
- multimaster_mtnode_extension *mtnode_ext;
+ multimaster_mtnode_extension *mtnode_ext = NULL;
+ int release_it = 0;
PRThread *thread = NULL;
cleanruv_data *data;
Replica *r;
ReplicaId rid;
- CSN *maxcsn;
- struct berval *extop_payload;
+ CSN *maxcsn = NULL;
+ struct berval *extop_payload = NULL;
char *extop_oid;
char *repl_root;
char *payload = NULL;
char *certify_all;
char *iter;
- int rc = 0;
+ int rc = LDAP_SUCCESS;
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_OID, &extop_oid);
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_VALUE, &extop_payload);
@@ -1496,6 +1497,7 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
}
if (mtnode_ext->replica){
object_acquire (mtnode_ext->replica);
+ release_it = 1;
} else {
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Abort cleanAllRUV task: replica is missing from (%s), "
"aborting operation\n",repl_root);
@@ -1519,6 +1521,7 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
goto out;
}
data->repl_obj = mtnode_ext->replica; /* released in replica_abort_task_thread() */
+ release_it = 0; /* thread owns it now */
data->replica = r;
data->task = NULL;
data->payload = slapi_ch_bvdup(extop_payload);
@@ -1540,17 +1543,20 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
(void *)data, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
- if(mtnode_ext->replica){
- object_release(mtnode_ext->replica);
- }
slapi_log_error( SLAPI_LOG_REPL, repl_plugin_name, "Abort cleanAllRUV task: unable to create abort "
"thread. Aborting task.\n");
+ release_it = 1; /* have to release mtnode_ext->replica now */
slapi_ch_free_string(&data->repl_root);
slapi_ch_free_string(&data->certify);
+ ber_bvfree(data->payload);
+ slapi_ch_free((void **)&data);
rc = LDAP_OPERATIONS_ERROR;
}
out:
+ if (release_it && mtnode_ext && mtnode_ext->replica) {
+ object_release(mtnode_ext->replica);
+ }
slapi_ch_free_string(&payload);
return rc;
@@ -1570,7 +1576,7 @@ out:
int
multimaster_extop_cleanruv(Slapi_PBlock *pb)
{
- multimaster_mtnode_extension *mtnode_ext;
+ multimaster_mtnode_extension *mtnode_ext = NULL;
PRThread *thread = NULL;
Replica *r = NULL;
cleanruv_data *data = NULL;
@@ -1585,7 +1591,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
char *iter;
int release_it = 0;
int rid = 0;
- int rc = 0;
+ int rc = LDAP_OPERATIONS_ERROR;
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_OID, &extop_oid);
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_VALUE, &extop_payload);
@@ -1593,7 +1599,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if (NULL == extop_oid || strcmp(extop_oid, REPL_CLEANRUV_OID) != 0 ||
NULL == extop_payload || NULL == extop_payload->bv_val){
/* something is wrong, error out */
- rc = -1;
goto free_and_return;
}
/*
@@ -1601,7 +1606,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
*/
if(decode_cleanruv_payload(extop_payload, &payload)){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to decode payload. Aborting ext op\n");
- rc = -1;
goto free_and_return;
}
rid = atoi(ldap_utf8strtok_r(payload, ":", &iter));
@@ -1614,7 +1618,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
*/
if(is_cleaned_rid(rid)){
csn_free(&maxcsn);
- rc = 1;
+ rc = LDAP_SUCCESS;
goto free_and_return;
}
@@ -1624,25 +1628,21 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if((mtnode_ext = replica_config_get_mtnode_by_dn(repl_root)) == NULL){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to get replication node "
"from (%s), aborting operation\n", repl_root);
- rc = -1;
goto free_and_return;
}
if (mtnode_ext->replica){
object_acquire (mtnode_ext->replica);
release_it = 1;
- }
- if (mtnode_ext->replica == NULL){
+ } else {
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: replica is missing from (%s), "
"aborting operation\n",repl_root);
- rc = LDAP_OPERATIONS_ERROR;
goto free_and_return;
}
r = (Replica*)object_get_data (mtnode_ext->replica);
if(r == NULL){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: replica is NULL, aborting task\n");
- rc = -1;
goto free_and_return;
}
@@ -1657,7 +1657,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if (data == NULL) {
slapi_log_error( SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to allocate "
"cleanruv_Data\n");
- rc = -1;
goto free_and_return;
}
data->repl_obj = mtnode_ext->replica;
@@ -1671,9 +1670,15 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
(void *)data, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
- rc = -1;
slapi_log_error( SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: unable to create cleanAllRUV "
"monitoring thread. Aborting task.\n");
+ ber_bvfree(data->payload);
+ data->payload = NULL;
+ slapi_ch_free((void **)&data);
+ } else {
+ release_it = 0; /* thread will release data->repl_obj == mtnode_ext->replica */
+ maxcsn = NULL; /* thread owns it now */
+ rc = LDAP_SUCCESS;
}
} else { /* this is a read-only consumer */
/*
@@ -1713,24 +1718,20 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
/* free everything */
object_release(ruv_obj);
- csn_free(&maxcsn);
- if (mtnode_ext->replica && release_it)
- object_release (mtnode_ext->replica);
/*
* This read-only replica has no easy way to tell when it's safe to release the rid.
* So we won't release it, not until a server restart.
*/
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: You must restart the server if you want to reuse rid(%d).\n", rid);
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: Successfully cleaned rid(%d).\n", rid);
+ rc = LDAP_SUCCESS;
}
free_and_return:
- if(rc && release_it){
- if (mtnode_ext->replica)
- object_release (mtnode_ext->replica);
+ if(release_it && mtnode_ext && mtnode_ext->replica) {
+ object_release (mtnode_ext->replica);
}
- if(rc)
- csn_free(&maxcsn);
+ csn_free(&maxcsn);
slapi_ch_free_string(&payload);
/*
@@ -1754,6 +1755,10 @@ free_and_return:
{
ber_bvfree(resp_bval);
}
+ /* tell extendop code that we have already sent the result */
+ rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
+ } else {
+ rc = LDAP_OPERATIONS_ERROR;
}
return rc;
11 years, 6 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/repl_extop.c | 59 ++++++++++++++------------
1 file changed, 32 insertions(+), 27 deletions(-)
New commits:
commit 6125990c403d600a048e8d6420236f6acb58e179
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Oct 11 11:57:24 2012 -0600
Ticket #491 - multimaster_extop_cleanruv returns wrong error codes
https://fedorahosted.org/389/ticket/491
Reviewed by: nhosoi (Thanks!)
Branch: 389-ds-base-1.2.11
Fix Description: multimaster_extop_cleanruv must return with a code of
SLAPI_PLUGIN_EXTENDED_SENT_RESULT to tell the server that the result
has been sent - otherwise, in 1.2.10, the server will attempt to send
the result again. In 1.2.11 the result code has been changed to ignore
a subsequent attempt to send a result for the same operation, but the
function should still return the correct codes.
I also cleaned up the error codes and memory management a bit.
Platforms tested: RHEL6 x86_64, Fedora 16
Flag Day: no
Doc impact: no
(cherry picked from commit bf54018e8ee4b355c66621ad3bfe5e59d4820170)
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 1b72dfb..3a6f422 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -1445,19 +1445,20 @@ free_and_return:
int
multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
{
- multimaster_mtnode_extension *mtnode_ext;
+ multimaster_mtnode_extension *mtnode_ext = NULL;
+ int release_it = 0;
PRThread *thread = NULL;
cleanruv_data *data;
Replica *r;
ReplicaId rid;
- CSN *maxcsn;
- struct berval *extop_payload;
+ CSN *maxcsn = NULL;
+ struct berval *extop_payload = NULL;
char *extop_oid;
char *repl_root;
char *payload = NULL;
char *certify_all;
char *iter;
- int rc = 0;
+ int rc = LDAP_SUCCESS;
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_OID, &extop_oid);
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_VALUE, &extop_payload);
@@ -1495,6 +1496,7 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
}
if (mtnode_ext->replica){
object_acquire (mtnode_ext->replica);
+ release_it = 1;
} else {
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Abort cleanAllRUV task: replica is missing from (%s), "
"aborting operation\n",repl_root);
@@ -1518,6 +1520,7 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
goto out;
}
data->repl_obj = mtnode_ext->replica; /* released in replica_abort_task_thread() */
+ release_it = 0; /* thread owns it now */
data->replica = r;
data->task = NULL;
data->payload = slapi_ch_bvdup(extop_payload);
@@ -1539,17 +1542,20 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
(void *)data, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
- if(mtnode_ext->replica){
- object_release(mtnode_ext->replica);
- }
slapi_log_error( SLAPI_LOG_REPL, repl_plugin_name, "Abort cleanAllRUV task: unable to create abort "
"thread. Aborting task.\n");
+ release_it = 1; /* have to release mtnode_ext->replica now */
slapi_ch_free_string(&data->repl_root);
slapi_ch_free_string(&data->certify);
+ ber_bvfree(data->payload);
+ slapi_ch_free((void **)&data);
rc = LDAP_OPERATIONS_ERROR;
}
out:
+ if (release_it && mtnode_ext && mtnode_ext->replica) {
+ object_release(mtnode_ext->replica);
+ }
slapi_ch_free_string(&payload);
return rc;
@@ -1569,7 +1575,7 @@ out:
int
multimaster_extop_cleanruv(Slapi_PBlock *pb)
{
- multimaster_mtnode_extension *mtnode_ext;
+ multimaster_mtnode_extension *mtnode_ext = NULL;
PRThread *thread = NULL;
Replica *r = NULL;
cleanruv_data *data = NULL;
@@ -1584,7 +1590,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
char *iter;
int release_it = 0;
int rid = 0;
- int rc = 0;
+ int rc = LDAP_OPERATIONS_ERROR;
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_OID, &extop_oid);
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_VALUE, &extop_payload);
@@ -1592,7 +1598,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if (NULL == extop_oid || strcmp(extop_oid, REPL_CLEANRUV_OID) != 0 ||
NULL == extop_payload || NULL == extop_payload->bv_val){
/* something is wrong, error out */
- rc = -1;
goto free_and_return;
}
/*
@@ -1600,7 +1605,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
*/
if(decode_cleanruv_payload(extop_payload, &payload)){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to decode payload. Aborting ext op\n");
- rc = -1;
goto free_and_return;
}
rid = atoi(ldap_utf8strtok_r(payload, ":", &iter));
@@ -1613,7 +1617,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
*/
if(is_cleaned_rid(rid)){
csn_free(&maxcsn);
- rc = 1;
+ rc = LDAP_SUCCESS;
goto free_and_return;
}
@@ -1623,25 +1627,21 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if((mtnode_ext = replica_config_get_mtnode_by_dn(repl_root)) == NULL){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to get replication node "
"from (%s), aborting operation\n", repl_root);
- rc = -1;
goto free_and_return;
}
if (mtnode_ext->replica){
object_acquire (mtnode_ext->replica);
release_it = 1;
- }
- if (mtnode_ext->replica == NULL){
+ } else {
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: replica is missing from (%s), "
"aborting operation\n",repl_root);
- rc = LDAP_OPERATIONS_ERROR;
goto free_and_return;
}
r = (Replica*)object_get_data (mtnode_ext->replica);
if(r == NULL){
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: replica is NULL, aborting task\n");
- rc = -1;
goto free_and_return;
}
@@ -1656,7 +1656,6 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
if (data == NULL) {
slapi_log_error( SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: failed to allocate "
"cleanruv_Data\n");
- rc = -1;
goto free_and_return;
}
data->repl_obj = mtnode_ext->replica;
@@ -1670,9 +1669,15 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
(void *)data, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
- rc = -1;
slapi_log_error( SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: unable to create cleanAllRUV "
"monitoring thread. Aborting task.\n");
+ ber_bvfree(data->payload);
+ data->payload = NULL;
+ slapi_ch_free((void **)&data);
+ } else {
+ release_it = 0; /* thread will release data->repl_obj == mtnode_ext->replica */
+ maxcsn = NULL; /* thread owns it now */
+ rc = LDAP_SUCCESS;
}
} else { /* this is a read-only consumer */
/*
@@ -1712,24 +1717,20 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
/* free everything */
object_release(ruv_obj);
- csn_free(&maxcsn);
- if (mtnode_ext->replica && release_it)
- object_release (mtnode_ext->replica);
/*
* This read-only replica has no easy way to tell when it's safe to release the rid.
* So we won't release it, not until a server restart.
*/
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: You must restart the server if you want to reuse rid(%d).\n", rid);
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: Successfully cleaned rid(%d).\n", rid);
+ rc = LDAP_SUCCESS;
}
free_and_return:
- if(rc && release_it){
- if (mtnode_ext->replica)
- object_release (mtnode_ext->replica);
+ if(release_it && mtnode_ext && mtnode_ext->replica) {
+ object_release (mtnode_ext->replica);
}
- if(rc)
- csn_free(&maxcsn);
+ csn_free(&maxcsn);
slapi_ch_free_string(&payload);
/*
@@ -1753,6 +1754,10 @@ free_and_return:
{
ber_bvfree(resp_bval);
}
+ /* tell extendop code that we have already sent the result */
+ rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
+ } else {
+ rc = LDAP_OPERATIONS_ERROR;
}
return rc;
11 years, 6 months