mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
ITS#10308 Implement cn=monitor for back-asyncmeta
Provide some target connection statistics such as target connections status and target status
This commit is contained in:
parent
0ff74659c0
commit
4fbdbf388b
4 changed files with 1249 additions and 8 deletions
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
SRCS = init.c config.c search.c message_queue.c bind.c add.c compare.c \
|
||||
delete.c modify.c modrdn.c map.c \
|
||||
conn.c candidates.c dncache.c meta_result.c
|
||||
conn.c candidates.c dncache.c meta_result.c monitor.c
|
||||
OBJS = init.lo config.lo search.lo message_queue.lo bind.lo add.lo compare.lo \
|
||||
delete.lo modify.lo modrdn.lo map.lo \
|
||||
conn.lo candidates.lo dncache.lo meta_result.lo
|
||||
conn.lo candidates.lo dncache.lo meta_result.lo monitor.lo
|
||||
|
||||
LDAP_INCDIR= ../../../include
|
||||
LDAP_LIBDIR= ../../../libraries
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ typedef struct a_metaconn_t {
|
|||
struct a_metainfo_t *mc_info;
|
||||
|
||||
int pending_ops;
|
||||
/* numeric id for logging and testing purposes */
|
||||
int mc_id;
|
||||
ldap_pvt_thread_mutex_t mc_om_mutex;
|
||||
/* queue for pending operations */
|
||||
LDAP_STAILQ_HEAD(BCList, bm_context_t) mc_om_list;
|
||||
|
|
@ -358,6 +360,15 @@ typedef int (*asyncmeta_quarantine_f)( struct a_metainfo_t *, int target, void *
|
|||
|
||||
struct meta_out_message_t;
|
||||
|
||||
/* data for cn=monitor */
|
||||
typedef struct asyncmeta_monitor_info_t {
|
||||
monitor_subsys_t *mi_conn_mss;
|
||||
monitor_subsys_t *mi_targets_mss;
|
||||
struct berval mi_ndn;
|
||||
struct berval mi_conn_rdn;
|
||||
struct berval mi_targets_rdn;
|
||||
} asycnmeta_monitor_info_t;
|
||||
|
||||
typedef struct a_metainfo_t {
|
||||
int mi_ntargets;
|
||||
int mi_defaulttarget;
|
||||
|
|
@ -420,6 +431,8 @@ typedef struct a_metainfo_t {
|
|||
int mi_max_timeout_ops;
|
||||
int mi_max_pending_ops;
|
||||
int mi_max_target_conns;
|
||||
|
||||
asycnmeta_monitor_info_t mi_monitor_info;
|
||||
/* mutex for access to the connection structures */
|
||||
ldap_pvt_thread_mutex_t mi_mc_mutex;
|
||||
int mi_num_conns;
|
||||
|
|
@ -784,6 +797,19 @@ asyncmeta_target_free(a_metatarget_t *mt);
|
|||
void
|
||||
asyncmeta_back_clear_miconns(a_metainfo_t *mi);
|
||||
|
||||
/* cn=monitor */
|
||||
int
|
||||
asyncmeta_back_monitor_db_init( BackendDB *be );
|
||||
|
||||
int
|
||||
asyncmeta_back_monitor_db_open( BackendDB *be );
|
||||
|
||||
int
|
||||
asyncmeta_back_monitor_db_close( BackendDB *be );
|
||||
|
||||
int
|
||||
asyncmeta_back_monitor_db_destroy( BackendDB *be );
|
||||
|
||||
/* The the maximum time in seconds after a result has been received on a connection,
|
||||
* after which it can be reset if a sender error occurs. Should this be configurable? */
|
||||
#define META_BACK_RESULT_INTERVAL (2)
|
||||
|
|
|
|||
|
|
@ -160,12 +160,15 @@ asyncmeta_back_db_init(
|
|||
mi->mi_conn_priv_max = LDAP_BACK_CONN_PRIV_DEFAULT;
|
||||
|
||||
mi->mi_ldap_extra = (ldap_extra_t *)bi->bi_extra;
|
||||
/* only so that the first chosen connection is the first in the
|
||||
array, for test purposes */
|
||||
mi->mi_next_conn = -1;
|
||||
ldap_pvt_thread_mutex_init( &mi->mi_mc_mutex);
|
||||
|
||||
be->be_private = mi;
|
||||
be->be_cf_ocs = be->bd_info->bi_cf_ocs;
|
||||
|
||||
return 0;
|
||||
return asyncmeta_back_monitor_db_init( be );
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -262,6 +265,7 @@ asyncmeta_back_db_open(
|
|||
for (i = 0; i < mi->mi_num_conns; i++) {
|
||||
a_metaconn_t *mc = &mi->mi_conns[i];
|
||||
ldap_pvt_thread_mutex_init( &mc->mc_om_mutex);
|
||||
mc->mc_id = i+1;
|
||||
mc->mc_authz_target = META_BOUND_NONE;
|
||||
|
||||
if ( mi->mi_ntargets > 0 ) {
|
||||
|
|
@ -284,7 +288,8 @@ asyncmeta_back_db_open(
|
|||
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return asyncmeta_back_monitor_db_open( be );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -410,7 +415,7 @@ asyncmeta_back_db_close(
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return asyncmeta_back_monitor_db_close( be );
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -419,7 +424,7 @@ asyncmeta_back_db_destroy(
|
|||
ConfigReply *cr )
|
||||
{
|
||||
a_metainfo_t *mi;
|
||||
|
||||
int rc = 0;
|
||||
if ( be->be_private ) {
|
||||
int i;
|
||||
|
||||
|
|
@ -467,10 +472,10 @@ asyncmeta_back_db_destroy(
|
|||
asyncmeta_back_clear_miconns(mi);
|
||||
ldap_pvt_thread_mutex_unlock( &mi->mi_mc_mutex );
|
||||
ldap_pvt_thread_mutex_destroy( &mi->mi_mc_mutex );
|
||||
|
||||
rc = asyncmeta_back_monitor_db_destroy( be );
|
||||
free( be->be_private );
|
||||
}
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if SLAPD_ASYNCMETA == SLAPD_MOD_DYNAMIC
|
||||
|
|
|
|||
1210
servers/slapd/back-asyncmeta/monitor.c
Normal file
1210
servers/slapd/back-asyncmeta/monitor.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue