ldap/schema/01core389.ldif | 5 -
ldap/servers/plugins/replication/repl5.h | 6 +
ldap/servers/plugins/replication/repl5_agmt.c | 20 ++++++
ldap/servers/plugins/replication/repl5_connection.c | 2
ldap/servers/plugins/replication/repl5_inc_protocol.c | 25 -------
ldap/servers/plugins/replication/repl5_prot_private.h | 1
ldap/servers/plugins/replication/repl5_protocol.c | 60 ++++--------------
ldap/servers/plugins/replication/repl5_replica.c | 12 +++
ldap/servers/plugins/replication/repl5_tot_protocol.c | 5 -
ldap/servers/plugins/replication/repl_globals.c | 1
10 files changed, 64 insertions(+), 73 deletions(-)
New commits:
commit d63ff3de73d894b6f6bfaa3f72d2b3a95ff7b5bd
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Jan 18 16:07:52 2013 -0500
Ticket 558 - Replication - make timeout for protocol shutdown configurable
Bug Description: If you attempt to stop a replica while its under load it will
appear to hang. The "hang" is actually a default timeout
of
20 minutes.
Fix Description: Made the timeout configurable, with a default timeout of 2 minutes.
Also found an issue with the replication connection code where
we needed to check for server shutdown.
Did some code cleanup as well.
https://fedorahosted.org/389/ticket/558
Reviewed by: richm(Thanks Rich!)
diff --git a/ldap/schema/01core389.ldif b/ldap/schema/01core389.ldif
index 7fe8b13..befd3fa 100644
--- a/ldap/schema/01core389.ldif
+++ b/ldap/schema/01core389.ldif
@@ -149,6 +149,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.2148 NAME
'rootdn-deny-host' DESC 'Netsc
attributeTypes: ( 2.16.840.1.113730.3.1.2149 NAME 'rootdn-allow-ip' DESC
'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN
'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2150 NAME 'rootdn-deny-ip' DESC
'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN
'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2151 NAME
'nsslapd-plugin-depends-on-type' DESC 'Netscape defined attribute type'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2152 NAME 'nsds5ReplicaProtocolTimeout'
DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
#
# objectclasses
#
@@ -158,9 +159,9 @@ objectClasses: ( 2.16.840.1.113730.3.2.44 NAME 'nsIndex' DESC
'Netscape defined
objectClasses: ( 2.16.840.1.113730.3.2.109 NAME 'nsBackendInstance' DESC
'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape
Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.110 NAME 'nsMappingTree' DESC
'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape
Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.104 NAME 'nsContainer' DESC 'Netscape
defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server'
)
-objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape
defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $
nsds5ReplicaCleanRUV $ nsds5ReplicaAbortCleanRUV $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $
nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $
nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $
nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer) X-ORIGIN 'Netscape Directory
Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape
defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $
nsds5ReplicaCleanRUV $ nsds5ReplicaAbortCleanRUV $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $
nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $
nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $
nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer $ nsds5ReplicaProtocolTimeout )
X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.113 NAME 'nsTombstone' DESC 'Netscape
defined objectclass' SUP top MAY ( nsParentUniqueId $ nscpEntryDN ) X-ORIGIN
'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC
'Netscape defined objectclass' SUP top MUST ( cn ) MAY (
nsds5ReplicaCleanRUVNotified $ nsDS5ReplicaHost $ nsDS5ReplicaPort $
nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $
nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $
nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh
$ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $
nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $
nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress
$ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $
nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $
nsds5ReplicaStripAttrs $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory
Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC
'Netscape defined objectclass' SUP top MUST ( cn ) MAY (
nsds5ReplicaCleanRUVNotified $ nsDS5ReplicaHost $ nsDS5ReplicaPort $
nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $
nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $
nsDS5ReplicatedAttributeListTotal $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh
$ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $
nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $
nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress
$ nsds5replicaLastInitEnd $ nsds5ReplicaEnabled $ nsds5replicaLastInitStart $
nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $
nsds5ReplicaStripAttrs $ nsds5replicaSessionPauseTime $ nsds5ReplicaProtocolTimeout )
X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.39 NAME 'nsslapdConfig' DESC 'Netscape
defined objectclass' SUP top MAY ( cn ) X-ORIGIN 'Netscape Directory Server'
)
objectClasses: ( 2.16.840.1.113730.3.2.317 NAME 'nsSaslMapping' DESC
'Netscape defined objectclass' SUP top MUST ( cn $ nsSaslMapRegexString $
nsSaslMapBaseDNTemplate $ nsSaslMapFilterTemplate ) MAY ( nsSaslMapPriority ) X-ORIGIN
'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.43 NAME 'nsSNMP' DESC 'Netscape
defined objectclass' SUP top MUST ( cn $ nsSNMPEnabled ) MAY ( nsSNMPOrganization $
nsSNMPLocation $ nsSNMPContact $ nsSNMPDescription $ nsSNMPName $ nsSNMPMasterHost $
nsSNMPMasterPort ) X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/servers/plugins/replication/repl5.h
b/ldap/servers/plugins/replication/repl5.h
index 7b0d6e4..3031c69 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -138,6 +138,8 @@
#define PROTOCOL_STATUS_TOTAL_RELEASING_REPLICA 710
#define PROTOCOL_STATUS_TOTAL_SENDING_DATA 711
+#define DEFAULT_PROTOCOL_TIMEOUT 120
+
/* To Allow Consumer Initialisation when adding an agreement - */
#define STATE_PERFORMING_TOTAL_UPDATE 501
#define STATE_PERFORMING_INCREMENTAL_UPDATE 502
@@ -166,6 +168,7 @@ extern const char *type_nsds5ReplicaSessionPauseTime;
extern const char *type_nsds5ReplicaEnabled;
extern const char *type_nsds5ReplicaStripAttrs;
extern const char *type_nsds5ReplicaCleanRUVnotified;
+extern const char *type_replicaProtocolTimeout;
/* Attribute names for windows replication agreements */
extern const char *type_nsds7WindowsReplicaArea;
@@ -385,6 +388,7 @@ char **agmt_get_attrs_to_strip(Repl_Agmt *ra);
int agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e);
int agmt_set_timeout(Repl_Agmt *ra, long timeout);
void agmt_update_done(Repl_Agmt *ra, int is_total);
+int agmt_get_protocol_timeout(Repl_Agmt *agmt);
typedef struct replica Replica;
@@ -492,6 +496,7 @@ void prot_notify_window_opened (Repl_Protocol *rp);
void prot_notify_window_closed (Repl_Protocol *rp);
Object *prot_get_replica_object(Repl_Protocol *rp);
void prot_replicate_now(Repl_Protocol *rp);
+int prot_get_timeout(Repl_Protocol *rp);
Repl_Protocol *agmt_get_protocol(Repl_Agmt *ra);
@@ -588,6 +593,7 @@ char *replica_get_dn(Replica *r);
void replica_check_for_tasks(Replica*r, Slapi_Entry *e);
void replica_update_state (time_t when, void *arg);
void replica_reset_csn_pl(Replica *r);
+int replica_get_protocol_timeout(Replica *r);
/* The functions below handles the state flag */
/* Current internal state flags */
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c
b/ldap/servers/plugins/replication/repl5_agmt.c
index da68e16..f25b7fb 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -141,6 +141,7 @@ typedef struct repl5agmt {
char **attrs_to_strip; /* for fractional replication, if a "mod" is empty,
strip out these attributes:
* modifiersname, modifytimestamp, internalModifiersname,
internalModifyTimestamp, etc */
int agreement_type;
+ PRUint64 protocol_timeout;
} repl5agmt;
/* Forward declarations */
@@ -337,6 +338,19 @@ agmt_new_from_entry(Slapi_Entry *e)
if (NULL != tmpstr)
{
ra->replarea = slapi_sdn_new_dn_passin(tmpstr);
+
+ /* If this agmt has its own timeout, grab it, otherwise use the replica's protocol
timeout */
+ ra->protocol_timeout = slapi_entry_attr_get_int(e, type_replicaProtocolTimeout);
+ if(ra->protocol_timeout == 0){
+ /* grab the replica protocol timeout */
+ Object *replobj = replica_get_replica_from_dn(ra->replarea);
+ if(replobj){
+ Replica *replica =(Replica*)object_get_data (replobj);
+ ra->protocol_timeout = replica_get_protocol_timeout(replica);
+ } else {
+ ra->protocol_timeout = DEFAULT_PROTOCOL_TIMEOUT;
+ }
+ }
}
/* Replica enabled */
@@ -2631,3 +2645,9 @@ agmt_update_done(Repl_Agmt *agmt, int is_total)
windows_update_done(agmt, is_total);
}
+int
+agmt_get_protocol_timeout(Repl_Agmt *agmt)
+{
+ return (int)agmt->protocol_timeout;
+}
+
diff --git a/ldap/servers/plugins/replication/repl5_connection.c
b/ldap/servers/plugins/replication/repl5_connection.c
index 5efd0e6..76c77c9 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -324,7 +324,7 @@ conn_read_result_ex(Repl_Connection *conn, char **retoidp, struct
berval **retda
* keep getting results quickly then we won't spend much time sleeping.
*/
- while (1)
+ while (!slapi_is_shutting_down())
{
/* we have to make sure the update sending thread does not
attempt to call conn_disconnect while we are reading
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c
b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 743be57..97f273e 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -1199,7 +1199,6 @@ protocol_sleep(Private_Repl_Protocol *prp, PRIntervalTime duration)
PR_Unlock(prp->lock);
}
-
/*
* Notify the protocol about some event. Signal the condition
* variable in case the protocol is sleeping. Multiple occurences
@@ -1216,7 +1215,6 @@ event_notify(Private_Repl_Protocol *prp, PRUint32 event)
PR_Unlock(prp->lock);
}
-
/*
* Test to see if an event occurred. The event is cleared when
* read.
@@ -1242,7 +1240,6 @@ reset_events (Private_Repl_Protocol *prp)
PR_Unlock(prp->lock);
}
-
/*
* Replay the actual update to the consumer. Construct an appropriate LDAP
* operation, attach the baggage LDAPv3 control that contains the CSN, etc.,
@@ -1410,8 +1407,6 @@ is_dummy_operation (const slapi_operation_parameters *op)
return (strcmp (op->target_address.uniqueid, START_ITERATION_ENTRY_UNIQUEID) ==
0);
}
-
-
void
cl5_operation_parameters_done (struct slapi_operation_parameters *sop)
{
@@ -1892,8 +1887,6 @@ send_updates(Private_Repl_Protocol *prp, RUV *remote_update_vector,
PRUint32 *nu
return return_value;
}
-
-
/*
* XXXggood this should probably be in the superclass, since the full update
* protocol is going to need it too.
@@ -1903,9 +1896,8 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
{
int return_value;
PRIntervalTime start, maxwait, now;
- int seconds = 1200;
- maxwait = PR_SecondsToInterval(seconds);
+ maxwait = PR_SecondsToInterval(prp->timeout);
prp->terminate = 1;
event_notify(prp, EVENT_PROTOCOL_SHUTDOWN);
start = PR_IntervalNow();
@@ -1921,7 +1913,7 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
return_value = -1;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"%s: repl5_inc_stop: protocol does not stop after %d seconds\n",
- agmt_get_long_name(prp->agmt), seconds);
+ agmt_get_long_name(prp->agmt), (int)prp->timeout);
}
else
{
@@ -1934,8 +1926,6 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
return return_value;
}
-
-
static int
repl5_inc_status(Private_Repl_Protocol *prp)
{
@@ -1944,22 +1934,18 @@ repl5_inc_status(Private_Repl_Protocol *prp)
return return_value;
}
-
-
static void
repl5_inc_notify_update(Private_Repl_Protocol *prp)
{
event_notify(prp, EVENT_TRIGGERING_CRITERIA_MET);
}
-
static void
repl5_inc_update_now(Private_Repl_Protocol *prp)
{
event_notify(prp, EVENT_REPLICATE_NOW);
}
-
static void
repl5_inc_notify_agmt_changed(Private_Repl_Protocol *prp)
{
@@ -1993,6 +1979,7 @@ Repl_5_Inc_Protocol_new(Repl_Protocol *rp)
prp->notify_window_closed = repl5_inc_notify_window_closed;
prp->update_now = repl5_inc_update_now;
prp->replica_object = prot_get_replica_object(rp);
+ prp->timeout = prot_get_timeout(rp);
if ((prp->lock = PR_NewLock()) == NULL)
{
goto loser;
@@ -2022,9 +2009,6 @@ loser:
return NULL;
}
-
-
-
static void
repl5_inc_backoff_expired(time_t timer_fire_time, void *arg)
{
@@ -2033,8 +2017,6 @@ repl5_inc_backoff_expired(time_t timer_fire_time, void *arg)
event_notify(prp, EVENT_BACKOFF_EXPIRED);
}
-
-
/*
* Examine the update vector and determine our course of action.
* There are 3 different possibilities, plus a catch-all error:
@@ -2098,7 +2080,6 @@ examine_update_vector(Private_Repl_Protocol *prp, RUV *remote_ruv)
return return_value;
}
-
/*
* When we get an error from an LDAP operation, we call this
* function to decide if we should just keep replaying
diff --git a/ldap/servers/plugins/replication/repl5_prot_private.h
b/ldap/servers/plugins/replication/repl5_prot_private.h
index 10aa02b..d4006f7 100644
--- a/ldap/servers/plugins/replication/repl5_prot_private.h
+++ b/ldap/servers/plugins/replication/repl5_prot_private.h
@@ -75,6 +75,7 @@ typedef struct private_repl_protocol
int repl50consumer; /* Flag to tell us if this is a 5.0-style consumer we're talking
to */
int repl71consumer; /* Flag to tell us if this is a 7.1-style consumer we're talking
to */
int repl90consumer; /* Flag to tell us if this is a 9.0-style consumer we're talking
to */
+ PRUint64 timeout;
} Private_Repl_Protocol;
extern Private_Repl_Protocol *Repl_5_Inc_Protocol_new();
diff --git a/ldap/servers/plugins/replication/repl5_protocol.c
b/ldap/servers/plugins/replication/repl5_protocol.c
index c6aaba9..250ce48 100644
--- a/ldap/servers/plugins/replication/repl5_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_protocol.c
@@ -40,7 +40,6 @@
# include <config.h>
#endif
-
/* repl5_protocol.c */
/*
@@ -72,6 +71,7 @@ typedef struct repl_protocol
Object *replica_object; /* Local replica. If non-NULL, replica object is acquired */
int state;
int next_state;
+ PRUint64 protocol_timeout;
PRLock *lock;
} repl_protocol;
@@ -83,9 +83,6 @@ typedef struct repl_protocol
/* Forward declarations */
static Private_Repl_Protocol *private_protocol_factory(Repl_Protocol *rp, int type);
-
-
-
/*
* Create a new protocol instance.
*/
@@ -126,16 +123,17 @@ prot_new(Repl_Agmt *agmt, int protocol_state)
if (get_agmt_agreement_type(agmt) == REPLICA_TYPE_MULTIMASTER)
{
- rp->prp_incremental = private_protocol_factory(rp, PROTOCOL_5_INCREMENTAL);
- rp->prp_total = private_protocol_factory(rp, PROTOCOL_5_TOTAL);
- rp->delete_conn = conn_delete;
+ rp->prp_incremental = private_protocol_factory(rp, PROTOCOL_5_INCREMENTAL);
+ rp->prp_total = private_protocol_factory(rp, PROTOCOL_5_TOTAL);
+ rp->delete_conn = conn_delete;
}
else if (get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS)
{
- rp->prp_incremental = private_protocol_factory(rp, PROTOCOL_WINDOWS_INCREMENTAL);
- rp->prp_total = private_protocol_factory(rp, PROTOCOL_WINDOWS_TOTAL);
- rp->delete_conn = windows_conn_delete;
+ rp->prp_incremental = private_protocol_factory(rp, PROTOCOL_WINDOWS_INCREMENTAL);
+ rp->prp_total = private_protocol_factory(rp, PROTOCOL_WINDOWS_TOTAL);
+ rp->delete_conn = windows_conn_delete;
}
+ rp->protocol_timeout = agmt_get_protocol_timeout(agmt);
/* XXXggood register callback handlers for entries updated, and
schedule window enter/leave. */
@@ -148,10 +146,6 @@ done:
return rp;
}
-
-
-
-
Object *
prot_get_replica_object(Repl_Protocol *rp)
{
@@ -159,10 +153,6 @@ prot_get_replica_object(Repl_Protocol *rp)
return rp->replica_object;
}
-
-
-
-
Repl_Agmt *
prot_get_agreement(Repl_Protocol *rp)
{
@@ -171,8 +161,6 @@ prot_get_agreement(Repl_Protocol *rp)
return rp->agmt;
}
-
-
void
prot_free(Repl_Protocol **rpp)
{
@@ -224,10 +212,6 @@ prot_delete(Repl_Protocol **rpp)
}
}
-
-
-
-
/*
* Get the connection object.
*/
@@ -243,9 +227,6 @@ prot_get_connection(Repl_Protocol *rp)
return return_value;
}
-
-
-
/*
* This function causes the total protocol to start.
* This is accomplished by registering a state transition
@@ -266,10 +247,6 @@ prot_initialize_replica(Repl_Protocol *rp)
PR_Unlock(rp->lock);
}
-
-
-
-
/*
* Main thread for protocol manager.
@@ -286,7 +263,6 @@ total update update complete incremental update
finished (any) finished
*/
-
static void
prot_thread_main(void *arg)
{
@@ -381,7 +357,6 @@ prot_thread_main(void *arg)
}
}
-
/*
* Start a thread to handle the replication protocol.
*/
@@ -413,10 +388,6 @@ prot_start(Repl_Protocol *rp)
}
}
-
-
-
-
/*
* Stop a protocol instance.
*/
@@ -457,10 +428,6 @@ prot_stop(Repl_Protocol *rp)
}
}
-
-
-
-
/*
* Call the notify_update method of the incremental or total update
* protocol, is either is active.
@@ -479,7 +446,6 @@ prot_notify_update(Repl_Protocol *rp)
PR_Unlock(rp->lock);
}
-
/*
* Call the notify_agmt_changed method of the incremental or total update
* protocol, is either is active.
@@ -504,7 +470,6 @@ prot_notify_agmt_changed(Repl_Protocol *rp, char * agmt_name)
PR_Unlock(rp->lock);
}
-
void
prot_notify_window_opened (Repl_Protocol *rp)
{
@@ -519,7 +484,6 @@ prot_notify_window_opened (Repl_Protocol *rp)
PR_Unlock(rp->lock);
}
-
void
prot_notify_window_closed (Repl_Protocol *rp)
{
@@ -534,7 +498,6 @@ prot_notify_window_closed (Repl_Protocol *rp)
PR_Unlock(rp->lock);
}
-
int
prot_status(Repl_Protocol *rp)
{
@@ -553,7 +516,6 @@ prot_status(Repl_Protocol *rp)
return return_status;
}
-
/*
* Start an incremental protocol session, even if we're not
* currently in a schedule window.
@@ -623,3 +585,9 @@ private_protocol_factory(Repl_Protocol *rp, int type)
}
return prp;
}
+
+int
+prot_get_timeout(Repl_Protocol *rp)
+{
+ return (int)rp->protocol_timeout;
+}
diff --git a/ldap/servers/plugins/replication/repl5_replica.c
b/ldap/servers/plugins/replication/repl5_replica.c
index 82362d6..6d8b660 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -87,6 +87,7 @@ struct replica {
PRBool state_update_inprogress; /* replica state is being updated */
PRLock *agmt_lock; /* protects agreement creation, start and stop */
char *locking_purl; /* supplier who has exclusive access */
+ PRUint64 protocol_timeout; /* protocol shutdown timeout */
};
@@ -775,6 +776,12 @@ replica_get_type (const Replica *r)
return r->repl_type;
}
+int
+replica_get_protocol_timeout(Replica *r)
+{
+ return (int)r->protocol_timeout;
+}
+
/*
* Sets the replica type.
*/
@@ -1682,6 +1689,11 @@ _replica_init_from_config (Replica *r, Slapi_Entry *e, char
*errortext)
r->legacy_consumer = PR_FALSE;
}
+ r->protocol_timeout = slapi_entry_attr_get_int(e, type_replicaProtocolTimeout);
+ if(r->protocol_timeout == 0){
+ r->protocol_timeout = DEFAULT_PROTOCOL_TIMEOUT;
+ }
+
/* get replica flags */
r->repl_flags = slapi_entry_attr_get_ulong(e, attr_flags);
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c
b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index b10d2d0..5bb203a 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -564,9 +564,10 @@ Repl_5_Tot_Protocol_new(Repl_Protocol *rp)
prp->status = repl5_tot_status;
prp->notify_update = repl5_tot_noop;
prp->notify_agmt_changed = repl5_tot_noop;
- prp->notify_window_opened = repl5_tot_noop;
- prp->notify_window_closed = repl5_tot_noop;
+ prp->notify_window_opened = repl5_tot_noop;
+ prp->notify_window_closed = repl5_tot_noop;
prp->update_now = repl5_tot_noop;
+ prp->timeout = DEFAULT_PROTOCOL_TIMEOUT;
if ((prp->lock = PR_NewLock()) == NULL)
{
goto loser;
diff --git a/ldap/servers/plugins/replication/repl_globals.c
b/ldap/servers/plugins/replication/repl_globals.c
index f31a476..a8473ab 100644
--- a/ldap/servers/plugins/replication/repl_globals.c
+++ b/ldap/servers/plugins/replication/repl_globals.c
@@ -112,6 +112,7 @@ const char *type_replicaLegacyConsumer =
"nsds5ReplicaLegacyConsumer";
const char *type_ruvElementUpdatetime = "nsruvReplicaLastModified";
const char *type_replicaCleanRUV = "nsds5ReplicaCleanRUV";
const char *type_replicaAbortCleanRUV = "nsds5ReplicaAbortCleanRUV";
+const char *type_replicaProtocolTimeout = "nsds5ReplicaProtocolTimeout";
/* Attribute names for replication agreement attributes */
const char *type_nsds5ReplicaHost = "nsds5ReplicaHost";