summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2006-01-16 19:06:03 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2006-01-16 19:06:03 +0000
commit5462a0698e1a2174de908889696c032e581f02b6 (patch)
tree1220751eca7795ae2e2e788fa90dd254f5e6553f
parentbfb309216da9bd5d4ce0d9187594d5f6a2606931 (diff)
downloadds-5462a0698e1a2174de908889696c032e581f02b6.tar.gz
ds-5462a0698e1a2174de908889696c032e581f02b6.tar.xz
ds-5462a0698e1a2174de908889696c032e581f02b6.zip
[176293] repl_chain_on_update() logs a message for every modify operation
Checking in Ulf's proposal; should not get connid from pid if the op is internal. (plus the value is just for debug print which is disabled now)
-rw-r--r--ldap/servers/plugins/replication/replutil.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c
index 55e6e0ef..280aa7e2 100644
--- a/ldap/servers/plugins/replication/replutil.c
+++ b/ldap/servers/plugins/replication/replutil.c
@@ -827,9 +827,19 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
PRBool local_online = PR_FALSE; /* true if the local db is online */
PRBool chain_online = PR_FALSE; /* true if the chain db is online */
int ii;
- int opid, connid;
+ int opid;
+#ifdef DEBUG_CHAIN_ON_UPDATE
+ int connid;
+#endif
+ slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+#ifdef DEBUG_CHAIN_ON_UPDATE
+ if (operation_is_flag_set(op, OP_FLAG_INTERNAL)) {
+ connid=-1; /* -1: internal op in a log msg */
+ } else {
+ slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
+ }
+#endif
- slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
/* first, we have to decide which backend is the local backend
* and which is the chaining one
@@ -854,13 +864,13 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
local_online = PR_TRUE;
}
}
-/*
+#ifdef DEBUG_CHAIN_ON_UPDATE
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d be "
- "%s is the %s backend and is %s\n",
- connid, opid,
- mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
- (mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
-*/
+ "%s is the %s backend and is %s\n",
+ connid, opid,
+ mtn_be_names[ii], (chaining_backend == ii) ? "chaining" : "local",
+ (mtn_be_states[ii] == SLAPI_BE_STATE_ON) ? "online" : "offline");
+#endif
}
/* if no chaining backends are defined, just use the local one */
@@ -868,8 +878,6 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
return local_backend;
}
- slapi_pblock_get(pb, SLAPI_OPERATION, &op);
-
/* All internal operations go to the local backend */
if (operation_is_flag_set(op, OP_FLAG_INTERNAL)) {
return local_backend;
@@ -884,11 +892,11 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
(op_type == SLAPI_OPERATION_BIND) ||
(op_type == SLAPI_OPERATION_UNBIND) ||
(op_type == SLAPI_OPERATION_COMPARE))) {
-/*
+#ifdef DEBUG_CHAIN_ON_UPDATE
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
"%d: using local backend\n",
connid, opid, op_type);
-*/
+#endif
return local_backend;
}
@@ -903,10 +911,10 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
*/
slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &requestor_dn);
if (slapi_dn_isroot(requestor_dn)) {
-/*
+#ifdef DEBUG_CHAIN_ON_UPDATE
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d requestor "
"is root: using local backend\n", connid, opid);
-*/
+#endif
return local_backend;
}
@@ -915,10 +923,10 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
*/
slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op);
if (repl_op) {
-/*
+#ifdef DEBUG_CHAIN_ON_UPDATE
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d op is "
"replicated: using local backend\n", connid, opid);
-*/
+#endif
return local_backend;
}
@@ -926,10 +934,10 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
* or any normal non replicated client operation while local is disabled (import) :
* use the chaining backend
*/
-/*
+#ifdef DEBUG_CHAIN_ON_UPDATE
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "repl_chain_on_update: conn=%d op=%d using "
"chaining backend\n", connid, opid);
-*/
+#endif
return chaining_backend;
}