Commit 81ed9e0d authored by Nadezhda Ivanova's avatar Nadezhda Ivanova Committed by Ondřej Kuzník
Browse files

ITS#9628 Fix incorrect c_n_ops_executing counter when backend is asynchronous

parent ee7a87b0
......@@ -132,6 +132,7 @@ typedef struct monitor_info_t {
AttributeDescription *mi_ad_monitorUpdateRef;
AttributeDescription *mi_ad_monitorRuntimeConfig;
AttributeDescription *mi_ad_monitorSuperiorDN;
AttributeDescription *mi_ad_monitorConnectionOpsAsync;
/*
* Generic description attribute
......
......@@ -369,6 +369,9 @@ conn_create(
bv.bv_len = snprintf( buf, sizeof( buf ), "%ld", c->c_n_ops_completed );
attr_merge_one( e, mi->mi_ad_monitorConnectionOpsCompleted, &bv, NULL );
bv.bv_len = snprintf( buf, sizeof( buf ), "%ld", c->c_n_ops_async );
attr_merge_one( e, mi->mi_ad_monitorConnectionOpsAsync, &bv, NULL );
bv.bv_len = snprintf( buf, sizeof( buf ), "%ld", c->c_n_get );
attr_merge_one( e, mi->mi_ad_monitorConnectionGet, &bv, NULL );
......
......@@ -1951,6 +1951,13 @@ monitor_back_initialize(
"NO-USER-MODIFICATION "
"USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorSuperiorDN) },
{ "( 1.3.6.1.4.1.4203.666.1.55.31 "
"NAME 'monitorConnectionOpsAsync' "
"DESC 'monitor number of asynchronous operations in execution within the connection' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsAsync) },
{ NULL, 0, -1 }
};
......
......@@ -212,7 +212,7 @@ int connections_timeout_idle(time_t now)
/* Don't timeout a slow-running request or a persistent
* outbound connection.
*/
if(( c->c_n_ops_executing && !c->c_writewaiter)
if((( c->c_n_ops_executing || c->c_n_ops_async ) && !c->c_writewaiter)
|| c->c_conn_state == SLAP_C_CLIENT ) {
continue;
}
......@@ -244,7 +244,7 @@ void connections_drop()
/* Don't close a slow-running request or a persistent
* outbound connection.
*/
if(( c->c_n_ops_executing && !c->c_writewaiter)
if((( c->c_n_ops_executing || c->c_n_ops_async ) && !c->c_writewaiter)
|| c->c_conn_state == SLAP_C_CLIENT ) {
continue;
}
......@@ -428,6 +428,7 @@ Connection * connection_init(
c->c_n_ops_executing = 0;
c->c_n_ops_pending = 0;
c->c_n_ops_completed = 0;
c->c_n_ops_async = 0;
c->c_n_get = 0;
c->c_n_read = 0;
......@@ -1004,7 +1005,7 @@ connection_op_finish( Operation *op, int lock )
LDAP_STAILQ_REMOVE( &conn->c_ops, op, Operation, o_next);
LDAP_STAILQ_NEXT(op, o_next) = NULL;
conn->c_n_ops_executing--;
conn->c_n_ops_async--;
conn->c_n_ops_completed++;
connection_resched( conn );
if ( lock )
......@@ -1122,6 +1123,8 @@ operations_error:
*/
slap_sl_mem_setctx( ctx, NULL );
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
conn->c_n_ops_executing--;
conn->c_n_ops_async++;
connection_resched( conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
return NULL;
......
......@@ -2975,6 +2975,7 @@ struct Connection {
long c_n_ops_executing; /* num of ops currently executing */
long c_n_ops_pending; /* num of ops pending execution */
long c_n_ops_completed; /* num of ops completed */
long c_n_ops_async; /* mum of ops currently executing asynchronously */
long c_n_get; /* num of get calls */
long c_n_read; /* num of read calls */
......
......@@ -233,6 +233,7 @@ slapi_int_connection_init_pb( Slapi_PBlock *pb, ber_tag_t tag )
conn->c_n_ops_executing = 0;
conn->c_n_ops_pending = 0;
conn->c_n_ops_completed = 0;
conn->c_n_ops_async = 0;
conn->c_n_get = 0;
conn->c_n_read = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment