From: Nadezhda Ivanova Date: Fri, 18 Oct 2024 11:48:35 +0000 (+0300) Subject: ITS#9914 Add OS pagesize to the back-mdb monitor information X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=223a755783bf9320b50c4911db57f216d4097d5f;p=thirdparty%2Fopenldap.git ITS#9914 Add OS pagesize to the back-mdb monitor information Page size is now provided with the olmMDBPageSize attribute. --- diff --git a/servers/slapd/back-mdb/monitor.c b/servers/slapd/back-mdb/monitor.c index e8995dfbe3..00ee0224f4 100644 --- a/servers/slapd/back-mdb/monitor.c +++ b/servers/slapd/back-mdb/monitor.c @@ -50,6 +50,8 @@ static AttributeDescription *ad_olmMDBReadersMax, static AttributeDescription *ad_olmMDBEntries; +static AttributeDescription *ad_olmMDBPageSize; + /* * NOTE: there's some confusion in monitor OID arc; * by now, let's consider: @@ -143,6 +145,14 @@ static struct { "NO-USER-MODIFICATION " "USAGE dSAOperation )", &ad_olmMDBEntries }, + + { "( olmMDBAttributes:7 " + "NAME ( 'olmMDBPageSize' ) " + "DESC 'DB page size' " + "SUP monitorCounter " + "NO-USER-MODIFICATION " + "USAGE dSAOperation )", + &ad_olmMDBPageSize }, { NULL } }; @@ -162,6 +172,7 @@ static struct { #endif /* MDB_MONITOR_IDX */ "$ olmMDBPagesMax $ olmMDBPagesUsed $ olmMDBPagesFree " "$ olmMDBReadersMax $ olmMDBReadersUsed $ olmMDBEntries " + "$ olmMDBPageSize " ") )", &oc_olmMDBDatabase }, @@ -216,6 +227,12 @@ mdb_monitor_update( bv.bv_len = snprintf( buf, sizeof( buf ), "%u", mei.me_numreaders ); ber_bvreplace( &a->a_vals[ 0 ], &bv ); + a = attr_find( e->e_attrs, ad_olmMDBPageSize ); + assert( a != NULL ); + bv.bv_val = buf; + bv.bv_len = snprintf( buf, sizeof( buf ), "%u", mst.ms_psize ); + ber_bvreplace( &a->a_vals[ 0 ], &bv ); + rc = mdb_txn_begin( mdb->mi_dbenv, NULL, MDB_RDONLY, &txn ); if ( !rc ) { MDB_cursor *cursor; @@ -436,7 +453,7 @@ mdb_monitor_db_open( BackendDB *be ) } /* alloc as many as required (plus 1 for objectClass) */ - a = attrs_alloc( 1 + 7 ); + a = attrs_alloc( 1 + 8 ); if ( a == NULL ) { rc = 1; goto cleanup; @@ -472,6 +489,10 @@ mdb_monitor_db_open( BackendDB *be ) next->a_desc = ad_olmMDBEntries; attr_valadd( next, &bv, NULL, 1 ); next = next->a_next; + + next->a_desc = ad_olmMDBPageSize; + attr_valadd( next, &bv, NULL, 1 ); + next = next->a_next; } {