]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9914 Add OS pagesize to the back-mdb monitor information
authorNadezhda Ivanova <nivanova@symas.com>
Fri, 18 Oct 2024 11:48:35 +0000 (14:48 +0300)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 25 Oct 2024 18:53:32 +0000 (18:53 +0000)
Page size is now provided with the olmMDBPageSize attribute.

servers/slapd/back-mdb/monitor.c

index e8995dfbe35653522796f4f14da2d4fd31b64056..00ee0224f4d6cb8663c6aa7d848e74792094af00 100644 (file)
@@ -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;
        }
 
        {