From 915e5159701b76d923b3f7bd94e600e8d9cacb2c Mon Sep 17 00:00:00 2001 From: Nadezhda Ivanova Date: Tue, 18 May 2021 16:41:08 +0300 Subject: [PATCH] ITS#9555 Introduce a default operations timeout for back-asyncmeta --- doc/man/man5/slapd-asyncmeta.5 | 2 ++ servers/slapd/back-asyncmeta/back-asyncmeta.h | 4 +++- servers/slapd/back-asyncmeta/config.c | 2 +- servers/slapd/back-asyncmeta/init.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/man/man5/slapd-asyncmeta.5 b/doc/man/man5/slapd-asyncmeta.5 index dc6924c5d9..c1474aa90c 100644 --- a/doc/man/man5/slapd-asyncmeta.5 +++ b/doc/man/man5/slapd-asyncmeta.5 @@ -446,6 +446,8 @@ Operations can be \fB ::= bind, add, delete, modrdn, modify, compare, search\fP +By default, the timeout for all operations is 2 seconds. + See .B slapd\-meta(5) for details. diff --git a/servers/slapd/back-asyncmeta/back-asyncmeta.h b/servers/slapd/back-asyncmeta/back-asyncmeta.h index 85437bf262..b860d0c705 100644 --- a/servers/slapd/back-asyncmeta/back-asyncmeta.h +++ b/servers/slapd/back-asyncmeta/back-asyncmeta.h @@ -326,8 +326,10 @@ typedef struct a_metatarget_t { #define META_BACK_TGT_NOREFS(mt) META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOREFS ) #define META_BACK_TGT_NOUNDEFFILTER(mt) META_BACK_TGT_ISSET( (mt), LDAP_BACK_F_NOUNDEFFILTER ) -#define META_BACK_CFG_MAX_PENDING_OPS 0x80 +#define META_BACK_CFG_MAX_PENDING_OPS 0x80 #define META_BACK_CFG_MAX_TARGET_CONNS 0xFF +#define META_BACK_CFG_DEFAULT_OPS_TIMEOUT 0x02 + /* the interval of the timeout checking loop in microseconds * possibly make this configurable? */ #define META_BACK_CFG_MAX_TIMEOUT_LOOP 0x70000 diff --git a/servers/slapd/back-asyncmeta/config.c b/servers/slapd/back-asyncmeta/config.c index c935e22be3..05ec953655 100644 --- a/servers/slapd/back-asyncmeta/config.c +++ b/servers/slapd/back-asyncmeta/config.c @@ -1177,7 +1177,7 @@ asyncmeta_back_cf_gen( ConfigArgs *c ) case LDAP_BACK_CFG_TIMEOUT: for ( i = 0; i < SLAP_OP_LAST; i++ ) { - if ( mc->mc_timeout[ i ] != 0 ) { + if ( mc->mc_timeout[ i ] != META_BACK_CFG_DEFAULT_OPS_TIMEOUT ) { break; } } diff --git a/servers/slapd/back-asyncmeta/init.c b/servers/slapd/back-asyncmeta/init.c index 1b9cc6af4a..a45fc3b66e 100644 --- a/servers/slapd/back-asyncmeta/init.c +++ b/servers/slapd/back-asyncmeta/init.c @@ -149,6 +149,10 @@ asyncmeta_back_db_init( mi->mi_nretries = META_RETRY_DEFAULT; mi->mi_version = LDAP_VERSION3; + for ( i = 0; i < SLAP_OP_LAST; i++ ) { + mi->mi_timeout[ i ] = META_BACK_CFG_DEFAULT_OPS_TIMEOUT; + } + for ( i = LDAP_BACK_PCONN_FIRST; i < LDAP_BACK_PCONN_LAST; i++ ) { mi->mi_conn_priv[ i ].mic_num = 0; LDAP_TAILQ_INIT( &mi->mi_conn_priv[ i ].mic_priv );