#51217 Issue 49481 - remove unused or unnecessary database plugin functions
Closed 2 years ago by spichugi. Opened 2 years ago by mreynolds.
mreynolds/389-ds-base issue49481  into  master

file modified
-1
@@ -1766,7 +1766,6 @@ 

  	ldap/servers/plugins/chainingdb/cb_monitor.c \

  	ldap/servers/plugins/chainingdb/cb_schema.c \

  	ldap/servers/plugins/chainingdb/cb_search.c \

- 	ldap/servers/plugins/chainingdb/cb_size.c \

  	ldap/servers/plugins/chainingdb/cb_start.c \

  	ldap/servers/plugins/chainingdb/cb_temp.c \

  	ldap/servers/plugins/chainingdb/cb_test.c \

@@ -318,6 +318,10 @@ 

  attributeTypes: ( 2.16.840.1.113730.3.1.2368 NAME 'nsslapd-filterrewriter' DESC 'Filter rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN '389 Directory Server' )

  attributeTypes: ( 2.16.840.1.113730.3.1.2369 NAME 'nsslapd-returnedAttrRewriter' DESC 'Returned attribute rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN '389 Directory Server' )

  attributeTypes: ( 2.16.840.1.113730.3.1.2370 NAME 'nsslapd-enable-upgrade-hash' DESC 'Upgrade password hash on bind' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )

+ attributeTypes: ( 2.16.840.1.113730.3.1.602 NAME 'entrydn' DESC 'Internal database attribute for the entry DN' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )

+ attributeTypes: ( 2.16.840.1.113730.3.1.603 NAME 'dncomp' DESC 'Internal database attribute for each DN component' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )

+ attributeTypes: ( 2.16.840.1.113730.3.1.604 NAME 'parentid' DESC 'Internal database attribute for the parent ID of the entry' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )

+ attributeTypes: ( 2.16.840.1.113730.3.1.605 NAME 'entryid' DESC 'Internal database attribute for the ID of the entry' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )

  #

  # objectclasses

  #

@@ -448,7 +448,6 @@ 

  int chainingdb_build_candidate_list(Slapi_PBlock *pb);

  int chainingdb_start(Slapi_PBlock *pb);

  int chainingdb_bind(Slapi_PBlock *pb);

- int cb_db_size(Slapi_PBlock *pb);

  int cb_back_close(Slapi_PBlock *pb);

  int cb_back_cleanup(Slapi_PBlock *pb);

  void chaining_back_search_results_release(void **sr);

@@ -87,8 +87,6 @@ 

                             (void *)chaining_back_modrdn);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_ABANDON_FN,

                             (void *)chaining_back_abandon);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_SIZE_FN,

-                            (void *)cb_db_size);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,

                             (void *)cb_back_close);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_CLEANUP_FN,
@@ -97,8 +95,6 @@ 

      /****

          rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN,

              (void *) chaining_back_entry_release );

-         rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DB_INIT_INSTANCE_FN,

-             (void *) chaining_back_init);

          rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DB_TEST_FN,

              (void *) cb_back_test );

  ****/

@@ -1,29 +0,0 @@ 

- /** BEGIN COPYRIGHT BLOCK

-  * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.

-  * Copyright (C) 2005 Red Hat, Inc.

-  * All rights reserved.

-  *

-  * License: GPL (version 3 or any later version).

-  * See LICENSE for details.

-  * END COPYRIGHT BLOCK **/

- 

- #ifdef HAVE_CONFIG_H

- #include <config.h>

- #endif

- 

- #include "cb.h"

- 

- int

- cb_db_size(Slapi_PBlock *pb)

- {

- 

-     /*

-     ** Return the size in byte of the local database storage

-     ** Size is 0 for a chaining backend

-     */

- 

-     unsigned int size = 0;

- 

-     slapi_pblock_set(pb, SLAPI_DBSIZE, &size);

-     return 0;

- }

@@ -68,7 +68,7 @@ 

          mapping_tree_init();

  

          if (dblayer_setup(li)) {

-             slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_init", "dblayer_setup failed\n");

+             slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_archive2ldbm", "dblayer_setup failed\n");

              return -1;

          }

  
@@ -283,7 +283,7 @@ 

      /* copied here, need better solution */

      /* initialize dblayer  */

          if (dblayer_setup(li)) {

-             slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_init", "dblayer_setup failed\n");

+             slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_ldbm2archive", "dblayer_setup failed\n");

              goto out;

          }

  

@@ -802,14 +802,6 @@ 

  /* Name of attribute type used for binder-based look through simple paged limit */

  #define LDBM_PAGEDALLIDSLIMIT_AT "nsPagedIDListScanLimit"

  

- /* OIDs for attribute types used internally */

- #define LDBM_ENTRYDN_OID  "2.16.840.1.113730.3.1.602"

- #define LDBM_DNCOMP_OID   "2.16.840.1.113730.3.1.603"

- #define LDBM_PARENTID_OID "2.16.840.1.113730.3.1.604"

- #define LDBM_ENTRYID_OID  "2.16.840.1.113730.3.1.605"

- #define LDBM_ENTRYUSN_OID "2.16.840.1.113730.3.1.2096"

I'm going to assume entryusn is already in the schema?

- /* #define LDBM_ENTRYRDN_OID            "2.16.840.1.113730.3.1.2097" */

- 

  #define LDBM_ANCESTORID_STR                "ancestorid"

  #define LDBM_ENTRYDN_STR                   SLAPI_ATTR_ENTRYDN

  #define LDBM_ENTRYRDN_STR                  "entryrdn"

@@ -2235,7 +2235,7 @@ 

  }

  

  /*

-  * ldbm_back_upgradedb -

+  * bdb_upgradedb -

   *

   * functions to convert idl from the old format to the new one

   * (604921) Support a database uprev process any time post-install
@@ -2246,7 +2246,7 @@ 

  int upgradedb_delete_indices_4cmd(ldbm_instance *inst, int flags);

  

  /*

-  * ldbm_back_upgradedb -

+  * bdb_upgradedb -

   *    check the DB version and if it's old idl'ed index,

   *    then reindex using new idl.

   *
@@ -2279,7 +2279,7 @@ 

      PRUint32 dbversion_flags = DBVERSION_ALL;

  

      slapi_pblock_get(pb, SLAPI_SEQ_TYPE, &up_flags);

-     slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_upgradedb", "Reindexing all...\n");

+     slapi_log_err(SLAPI_LOG_TRACE, "bdb_upgradedb", "Reindexing all...\n");

      slapi_pblock_get(pb, SLAPI_TASK_FLAGS, &task_flags);

      slapi_pblock_get(pb, SLAPI_BACKEND_TASK, &task);

      slapi_pblock_get(pb, SLAPI_DB2LDIF_SERVER_RUNNING, &server_running);
@@ -2296,7 +2296,7 @@ 

          ldbm_instance *inst = NULL;

  

          /* server is up -- mark all backends busy */

-         slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_upgradedb",

+         slapi_log_err(SLAPI_LOG_TRACE, "bdb_upgradedb",

                        "server is up -- marking all LDBM backends busy\n");

          for (inst_obj = objset_first_obj(li->li_instance_set); inst_obj;

               inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
@@ -2305,7 +2305,7 @@ 

              /* BUSY flag is cleared at the end of import_main (join thread);

                 it should not cleared in this thread [610347] */

              if (instance_set_busy(inst) != 0) {

-                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+                 slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                                "ldbm: '%s' is already in the middle of "

                                "another task and cannot be disturbed.\n",

                                inst->inst_name);
@@ -2334,7 +2334,7 @@ 

           * DN2RDN option (-r) is given, but subtree-rename is off.

           * Print an error and back off.

           */

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                        "DN2RDN option (-r) is given, but %s is off in "

                        "dse.ldif.  Please change the value to on.\n",

                        CONFIG_ENTRYRDN_SWITCH);
@@ -2359,14 +2359,14 @@ 

                  need_upgrade = (rval & (DBVERSION_UPGRADE_3_4 | DBVERSION_UPGRADE_4_4));

              }

              if (!need_upgrade) {

-                 slapi_log_err(SLAPI_LOG_INFO, "ldbm_back_upgradedb",

+                 slapi_log_err(SLAPI_LOG_INFO, "bdb_upgradedb",

                                "Index version is up-to-date\n");

                  return 0;

              }

          }

      } else {

          slapi_log_err(SLAPI_LOG_WARNING,

-                       "ldbm_back_upgradedb", "No instance to be upgraded\n");

+                       "bdb_upgradedb", "No instance to be upgraded\n");

          return -1;

      }

  
@@ -2413,7 +2413,7 @@ 

                 since dblayer_close is called in upgradedb_core =>

                 bdb_back_ldif2db */

              if (0 != bdb_start(li, DBLAYER_IMPORT_MODE)) {

-                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+                 slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                                "Failed to init database\n");

                  goto fail1;

              }
@@ -2432,7 +2432,7 @@ 

          if (inst_dirp != inst_dir)

              slapi_ch_free_string(&inst_dirp);

          if (backup_rval < 0) {

-             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+             slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                            "Failed to backup index files (instance %s).\n", inst_dirp);

              goto fail1;

          }
@@ -2442,7 +2442,7 @@ 

              rval = upgradedb_delete_indices_4cmd(inst, up_flags);

              if (rval) {

                  upgrade_rval += rval;

-                 slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_upgradedb",

+                 slapi_log_err(SLAPI_LOG_WARNING, "bdb_upgradedb",

                                "Can't clean up indices in %s\n", inst->inst_dir_name);

                  continue; /* Need to make all backups; continue */

              }
@@ -2450,7 +2450,7 @@ 

              rval = dblayer_delete_indices(inst);

              if (rval) {

                  upgrade_rval += rval;

-                 slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_upgradedb",

+                 slapi_log_err(SLAPI_LOG_WARNING, "bdb_upgradedb",

                                "Can't clean up indices in %s\n", inst->inst_dir_name);

                  continue; /* Need to make all backups; continue */

              }
@@ -2459,7 +2459,7 @@ 

          rval = upgradedb_core(pb, inst);

          if (rval) {

              upgrade_rval += rval;

-             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+             slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                            "upgradedb: Failed to upgrade database %s\n",

                            inst->inst_name);

              if (run_from_cmdline) {
@@ -2508,7 +2508,7 @@ 

      /* close the database down again */

      if (run_from_cmdline) {

          if (0 != dblayer_close(li, DBLAYER_IMPORT_MODE)) {

-             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+             slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                            "Failed to close database\n");

              goto fail1;

          }
@@ -2532,7 +2532,7 @@ 

       * We just want not to generate a guardian file...

       */

      if (0 != dblayer_close(li, DBLAYER_ARCHIVE_MODE))

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradedb",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradedb",

                        "Failed to close database\n");

  

      /* restore from the backup, if possible */
@@ -3150,7 +3150,7 @@ 

              return -1;

          }

      } else {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        " Online mode is not supported. "

                        "Shutdown the server and run the tool\n");

          goto bail;
@@ -3159,11 +3159,11 @@ 

      /* Find the instance that the ldif2db will be done on. */

      inst = ldbm_instance_find_by_name(li, instance_name);

      if (NULL == inst) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Unknown ldbm instance %s\n", instance_name);

          goto bail;

      }

-     slapi_log_err(SLAPI_LOG_INFO, "ldbm_back_upgradednformat",

+     slapi_log_err(SLAPI_LOG_INFO, "bdb_upgradednformat",

                    "%s: Start upgrade dn format.\n", inst->inst_name);

  

      slapi_pblock_set(pb, SLAPI_BACKEND, inst->inst_be);
@@ -3172,14 +3172,14 @@ 

  

      prst = PR_GetFileInfo64(rawworkdbdir, &prfinfo);

      if (PR_FAILURE == prst || PR_FILE_DIRECTORY != prfinfo.type) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Working DB instance dir %s is not a directory\n",

                        rawworkdbdir);

          goto bail;

      }

      dirhandle = PR_OpenDir(rawworkdbdir);

      if (!dirhandle) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Failed to open working DB instance dir %s\n",

                        rawworkdbdir);

          goto bail;
@@ -3196,7 +3196,7 @@ 

      PR_CloseDir(dirhandle);

  

      if (!found) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Working DB instance dir %s does not include %s file\n",

                        rawworkdbdir, ID2ENTRY);

          goto bail;
@@ -3231,7 +3231,7 @@ 

                  rc = 3; /* 0: need upgrade (dn norm sp, only) */

              } else {

                  /* DN format already takes care of the multiple spaces */

-                 slapi_log_err(SLAPI_LOG_INFO, "ldbm_back_upgradednformat",

+                 slapi_log_err(SLAPI_LOG_INFO, "bdb_upgradednformat",

                                "Instance %s in %s is up-to-date\n",

                                instance_name, workdbdir);

                  rc = 0; /* 0: up-to-date */
@@ -3244,7 +3244,7 @@ 

              rc = 1; /* 0: need upgrade (both) */

          }

      } else {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Failed to get DBVERSION (Instance name: %s, dir %s)\n",

                        instance_name, workdbdir);

          rc = -1; /* error */
@@ -3253,7 +3253,7 @@ 

  

      sep = PL_strrchr(workdbdir, '/');

      if (!sep) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Working DB instance dir %s does not include %s file\n",

                        workdbdir, ID2ENTRY);

          goto bail;
@@ -3265,7 +3265,7 @@ 

  

      if (run_from_cmdline) {

          if (0 != bdb_start(li, DBLAYER_IMPORT_MODE)) {

-             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+             slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                            "Failed to init database\n");

              goto bail;

          }
@@ -3274,7 +3274,7 @@ 

      /* bdb_instance_start will init the id2entry index. */

      be = inst->inst_be;

      if (0 != bdb_instance_start(be, DBLAYER_IMPORT_MODE)) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                        "Failed to init instance %s\n", inst->inst_name);

          goto bail;

      }
@@ -3288,7 +3288,7 @@ 

      /* close the database */

      if (run_from_cmdline) {

          if (0 != dblayer_close(li, DBLAYER_IMPORT_MODE)) {

-             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_upgradednformat",

+             slapi_log_err(SLAPI_LOG_ERR, "bdb_upgradednformat",

                            "Failed to close database\n");

              goto bail;

          }

@@ -220,16 +220,16 @@ 

      /* Check the values are sane. */

      if ((autosize_percentage > 100) || (import_percentage > 100) || (autosize_db_percentage_split > 100) ||

          ((autosize_percentage > 0) && (import_percentage > 0) && (autosize_percentage + import_percentage > 100))) {

-         slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "Cache autosizing: bad settings, value or sum of values can not larger than 100.\n");

-         slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "You should change nsslapd-cache-autosize + nsslapd-import-cache-autosize in dse.ldif to be less than 100.\n");

-         slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "Reasonable starting values are nsslapd-cache-autosize: 10, nsslapd-import-cache-autosize: -1.\n");

+         slapi_log_err(SLAPI_LOG_CRIT, "bdb_start_autotune", "Cache autosizing: bad settings, value or sum of values can not larger than 100.\n");

+         slapi_log_err(SLAPI_LOG_CRIT, "bdb_start_autotune", "You should change nsslapd-cache-autosize + nsslapd-import-cache-autosize in dse.ldif to be less than 100.\n");

+         slapi_log_err(SLAPI_LOG_CRIT, "bdb_start_autotune", "Reasonable starting values are nsslapd-cache-autosize: 10, nsslapd-import-cache-autosize: -1.\n");

          return SLAPI_FAIL_GENERAL;

      }

  

      /* Get our platform memory values. */

      slapi_pal_meminfo *mi = spal_meminfo_get();

      if (mi == NULL) {

-         slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "Unable to determine system page limits\n");

+         slapi_log_err(SLAPI_LOG_CRIT, "bdb_start_autotune", "Unable to determine system page limits\n");

          return SLAPI_FAIL_GENERAL;

      }

  
@@ -239,8 +239,8 @@ 

      /* In the case it is not, this will *reduce* the allocation */

      issane = util_is_cachesize_sane(mi, &zone_size);

      if (issane == UTIL_CACHESIZE_REDUCED) {

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Your autosized cache values have been reduced. Likely your nsslapd-cache-autosize percentage is too high.\n");

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "%s", msg);

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "Your autosized cache values have been reduced. Likely your nsslapd-cache-autosize percentage is too high.\n");

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "%s", msg);

      }

      /* It's valid, lets divide it up and set according to user prefs */

      db_size = (autosize_db_percentage_split * zone_size) / 100;
@@ -288,8 +288,8 @@ 

          }

      }

  

-     slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %" PRIu64 "k physical memory\n", mi->system_total_bytes / 1024);

-     slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %" PRIu64 "k available\n", mi->system_available_bytes / 1024);

+     slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "found %" PRIu64 "k physical memory\n", mi->system_total_bytes / 1024);

+     slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "found %" PRIu64 "k available\n", mi->system_available_bytes / 1024);

  

      /* We've now calculated the autotuning values. Do we need to apply it?

       * we use the logic of "if size is 0, or autosize is > 0. This way three
@@ -304,7 +304,7 @@ 

  

      /* First, check the dbcache */

      if (li->li_dbcachesize == 0 || li->li_cache_autosize > 0) {

-         slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: db cache: %" PRIu64 "k\n", db_size / 1024);

+         slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "cache autosizing: db cache: %" PRIu64 "k\n", db_size / 1024);

          if (db_size < (500 * MEGABYTE)) {

              db_size = db_size / 1.25;

          }
@@ -334,12 +334,12 @@ 

           * it's highly unlikely.

           */

          if (cache_size == 0 || cache_size == MINCACHESIZE || li->li_cache_autosize > 0) {

-             slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s entry cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, entry_size / 1024);

+             slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "cache autosizing: %s entry cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, entry_size / 1024);

              cache_set_max_entries(&(inst->inst_cache), -1);

              cache_set_max_size(&(inst->inst_cache), li->li_cache_autosize_ec, CACHE_TYPE_ENTRY);

          }

          if (dncache_size == 0 || dncache_size == MINCACHESIZE || li->li_cache_autosize > 0) {

-             slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s dn cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, dn_size / 1024);

+             slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "cache autosizing: %s dn cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, dn_size / 1024);

              cache_set_max_entries(&(inst->inst_dncache), -1);

              cache_set_max_size(&(inst->inst_dncache), li->li_dncache_autosize_ec, CACHE_TYPE_DN);

          }
@@ -347,7 +347,7 @@ 

          cache_size = (PRUint64)cache_get_max_size(&(inst->inst_cache));

          db_size = bdb_get_id2entry_size(inst);

          if (cache_size < db_size) {

-             slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start",

+             slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune",

                            "%s: entry cache size %" PRIu64 " B is "

                            "less than db size %" PRIu64 " B; "

                            "We recommend to increase the entry cache size "
@@ -363,26 +363,26 @@ 

          import_size = (import_percentage * mi->system_total_bytes) / 100;

          issane = util_is_cachesize_sane(mi, &import_size);

          if (issane == UTIL_CACHESIZE_REDUCED) {

-             slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n");

+             slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n");

          }

          /* We just accept the reduced allocation here. */

-         slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: import cache: %" PRIu64 "k\n", import_size / 1024);

+         slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "cache autosizing: import cache: %" PRIu64 "k\n", import_size / 1024);

  

          sprintf(size_to_str, "%" PRIu64, import_size);

          ldbm_config_internal_set(li, CONFIG_IMPORT_CACHESIZE, size_to_str);

      }

  

      /* Finally, lets check that the total result is sane. */

-     slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "total cache size: %" PRIu64 " B; \n", total_cache_size);

+     slapi_log_err(SLAPI_LOG_NOTICE, "bdb_start_autotune", "total cache size: %" PRIu64 " B; \n", total_cache_size);

  

      issane = util_is_cachesize_sane(mi, &total_cache_size);

      if (issane != UTIL_CACHESIZE_VALID) {

          /* Right, it's time to panic */

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "It is highly likely your memory configuration of all backends will EXCEED your systems memory.\n");

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "In a future release this WILL prevent server start up. You MUST alter your configuration.\n");

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Total entry cache size: %" PRIu64 " B; dbcache size: %" PRIu64 " B; available memory size: %" PRIu64 " B; \n",

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "It is highly likely your memory configuration of all backends will EXCEED your systems memory.\n");

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "In a future release this WILL prevent server start up. You MUST alter your configuration.\n");

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "Total entry cache size: %" PRIu64 " B; dbcache size: %" PRIu64 " B; available memory size: %" PRIu64 " B; \n",

                        total_cache_size, (uint64_t)li->li_dbcachesize, mi->system_available_bytes);

-         slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "%s\n", msg);

+         slapi_log_err(SLAPI_LOG_WARNING, "bdb_start_autotune", "%s\n", msg);

          /* WB 2016 - This should be UNCOMMENTED in a future release */

          /* return SLAPI_FAIL_GENERAL; */

      }

@@ -166,7 +166,7 @@ 

      char **instance_names = NULL;

      char *dbdir = NULL;

  

-     slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_dbverify", "Verifying db files...\n");

+     slapi_log_err(SLAPI_LOG_TRACE, "bdb_verify", "Verifying db files...\n");

      slapi_pblock_get(pb, SLAPI_BACKEND_INSTANCE_NAME, &instance_names);

      slapi_pblock_get(pb, SLAPI_SEQ_TYPE, &verbose);

      slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &li);
@@ -176,13 +176,12 @@ 

  

      /* no write needed; choose EXPORT MODE */

      if (0 != bdb_start(li, DBLAYER_EXPORT_MODE)) {

-         slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_dbverify",

-                       "dbverify: Failed to init database\n");

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_verify", "dbverify: Failed to init database\n");

          return rval;

      }

  

      /* server is up */

-     slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_dbverify", "server is up\n");

+     slapi_log_err(SLAPI_LOG_TRACE, "bdb_verify", "server is up\n");

      if (instance_names) /* instance is specified */

      {

          char **inp = NULL;
@@ -207,7 +206,7 @@ 

              /* check if an import/restore is already ongoing... */

              if (instance_set_busy(inst) != 0) {

                  /* standalone, only.  never happens */

-                 slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_dbverify",

+                 slapi_log_err(SLAPI_LOG_WARNING, "bdb_verify",

                                "Backend '%s' is already in the middle of "

                                "another task and cannot be disturbed.\n",

                                inst->inst_name);
@@ -225,8 +224,7 @@ 

      /* close the database down again */

      rval = bdb_post_close(li, DBLAYER_EXPORT_MODE);

      if (0 != rval) {

-         slapi_log_err(SLAPI_LOG_ERR,

-                       "ldbm_back_dbverify", "Failed to close database\n");

+         slapi_log_err(SLAPI_LOG_ERR, "bdb_verify", "Failed to close database\n");

      }

  

      return rval_main;

@@ -19,30 +19,6 @@ 

  static Slapi_PluginDesc pdesc = {"ldbm-backend", VENDOR,

                                   DS_PACKAGE_VERSION, "high-performance LDAP backend database plugin"};

  

- /* pb: not used */

- int

- ldbm_back_add_schema(Slapi_PBlock *pb __attribute__((unused)))

- {

-     int rc = 0;

-     rc = slapi_add_internal_attr_syntax(LDBM_ENTRYDN_STR,

-                                         LDBM_ENTRYDN_OID, DN_SYNTAX_OID, DNMATCH_NAME,

-                                         SLAPI_ATTR_FLAG_SINGLE | SLAPI_ATTR_FLAG_NOUSERMOD);

- 

-     rc |= slapi_add_internal_attr_syntax("dncomp",

-                                          LDBM_DNCOMP_OID, DN_SYNTAX_OID, DNMATCH_NAME,

-                                          SLAPI_ATTR_FLAG_NOUSERMOD);

- 

-     rc |= slapi_add_internal_attr_syntax(LDBM_PARENTID_STR,

-                                          LDBM_PARENTID_OID, INTEGER_SYNTAX_OID, INTEGERMATCH_NAME,

-                                          SLAPI_ATTR_FLAG_SINGLE | SLAPI_ATTR_FLAG_NOUSERMOD);

- 

-     rc |= slapi_add_internal_attr_syntax("entryid",

-                                          LDBM_ENTRYID_OID, DIRSTRING_SYNTAX_OID, CASEIGNOREMATCH_NAME,

-                                          SLAPI_ATTR_FLAG_SINGLE | SLAPI_ATTR_FLAG_NOUSERMOD);

- 

-     return rc;

- }

- 

  int

  ldbm_back_init(Slapi_PBlock *pb)

  {
@@ -81,9 +57,6 @@ 

          goto fail;

      }

  

-     /* add some private attributes */

-     rc = ldbm_back_add_schema(pb);

- 

      /* set plugin private pointer and initialize locks, etc. */

      rc = slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, (void *)li);

  
@@ -158,15 +131,8 @@ 

                             (void *)dblayer_plugin_commit);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_ABORT_FN,

                             (void *)dblayer_plugin_abort);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_SIZE_FN,

-                            (void *)ldbm_db_size);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_INIT_INSTANCE_FN,

-                            (void *)ldbm_back_init); /* register itself so that the secon instance

-                                           can be initialized */

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_WIRE_IMPORT_FN,

                             (void *)ldbm_back_wire_import);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_ADD_SCHEMA_FN,

-                            (void *)ldbm_back_add_schema);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_GET_INFO_FN,

                             (void *)ldbm_back_get_info);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_SET_INFO_FN,

@@ -328,7 +328,7 @@ 

      }

      dblayer_private *priv = (dblayer_private *)li->li_dblayer_private;

  

-     return priv->dblayer_upgradedb_fn(pb);;

+     return priv->dblayer_upgradedb_fn(pb);

  }

  

  #define LOG "log."
@@ -363,5 +363,5 @@ 

      slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &li);

      dblayer_private *priv = (dblayer_private *)li->li_dblayer_private;

  

-     return priv->dblayer_upgradedn_fn(pb);;

+     return priv->dblayer_upgradedn_fn(pb);

  }

@@ -425,18 +425,12 @@ 

      case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:

          *ret_fnptr = be->be_prev_search_results;

          break;

-     case SLAPI_PLUGIN_DB_SIZE_FN:

-         *ret_fnptr = (void *)be->be_dbsize;

-         break;

      case SLAPI_PLUGIN_DB_TEST_FN:

          *ret_fnptr = (void *)be->be_dbtest;

          break;

      case SLAPI_PLUGIN_DB_RMDB_FN:

          *ret_fnptr = (void *)be->be_rmdb;

          break;

-     case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:

-         *ret_fnptr = (void *)be->be_init_instance;

-         break;

      case SLAPI_PLUGIN_DB_SEQ_FN:

          *ret_fnptr = (void *)be->be_seq;

          break;
@@ -534,18 +528,12 @@ 

      case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:

          be->be_prev_search_results = (VFP)ret_fnptr;

          break;

-     case SLAPI_PLUGIN_DB_SIZE_FN:

-         be->be_dbsize = (IFP)ret_fnptr;

-         break;

      case SLAPI_PLUGIN_DB_TEST_FN:

          be->be_dbtest = (IFP)ret_fnptr;

          break;

      case SLAPI_PLUGIN_DB_RMDB_FN:

          be->be_rmdb = (IFP)ret_fnptr;

          break;

-     case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:

-         be->be_init_instance = (IFP)ret_fnptr;

-         break;

      case SLAPI_PLUGIN_DB_SEQ_FN:

          be->be_seq = (IFP)ret_fnptr;

          break;

@@ -863,9 +863,6 @@ 

      case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:

          (*(IFP *)value) = pblock->pb_plugin->plg_wire_import;

          break;

-     case SLAPI_PLUGIN_DB_ADD_SCHEMA_FN:

-         (*(IFP *)value) = pblock->pb_plugin->plg_add_schema;

-         break;

      case SLAPI_PLUGIN_DB_GET_INFO_FN:

          (*(IFP *)value) = pblock->pb_plugin->plg_get_info;

          break;
@@ -899,12 +896,6 @@ 

          }

          (*(IFP *)value) = pblock->pb_plugin->plg_rmdb;

          break;

-     case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:

-         if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

-             return (-1);

-         }

-         (*(IFP *)value) = pblock->pb_plugin->plg_init_instance;

-         break;

      case SLAPI_PLUGIN_DB_LDIF2DB_FN:

          if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

              return (-1);
@@ -971,12 +962,6 @@ 

          }

          (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort;

          break;

-     case SLAPI_PLUGIN_DB_SIZE_FN:

-         if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

-             return (-1);

-         }

-         (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbsize;

-         break;

      case SLAPI_PLUGIN_DB_TEST_FN:

          if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

              return (-1);
@@ -2783,9 +2768,6 @@ 

      case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:

          pblock->pb_plugin->plg_wire_import = (IFP)value;

          break;

-     case SLAPI_PLUGIN_DB_ADD_SCHEMA_FN:

-         pblock->pb_plugin->plg_add_schema = (IFP)value;

-         break;

      case SLAPI_PLUGIN_DB_GET_INFO_FN:

          pblock->pb_plugin->plg_get_info = (IFP)value;

          break;
@@ -2816,13 +2798,6 @@ 

          }

          pblock->pb_plugin->plg_rmdb = (IFP)value;

          break;

-     case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:

-         if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

-             return (-1);

-         }

-         pblock->pb_plugin->plg_init_instance = (IFP)value;

-         break;

- 

      case SLAPI_PLUGIN_DB_LDIF2DB_FN:

          if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

              return (-1);
@@ -2889,12 +2864,6 @@ 

          }

          pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort = (IFP)value;

          break;

-     case SLAPI_PLUGIN_DB_SIZE_FN:

-         if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

-             return (-1);

-         }

-         pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbsize = (IFP)value;

-         break;

      case SLAPI_PLUGIN_DB_TEST_FN:

          if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {

              return (-1);

file modified
+1 -13
@@ -4322,7 +4322,7 @@ 

          /* borrow the task flag space */

          slapi_pblock_set(pb, SLAPI_SCHEMA_FLAGS, (void *)&schema_flags);

  

- /* add the objectclass attribute so we can do some basic schema

+         /* add the objectclass attribute so we can do some basic schema

             checking during initialization; this will be overridden when

             its "real" definition is read from the schema conf files */

  
@@ -4386,19 +4386,7 @@ 

                  be = be_new_internal(*local_pschemadse, "DSE", DSE_SCHEMA, &schema_plugin);

                  be_addsuffix(be, &schema);

              } else { /* schema file reload */

-                 struct slapdplugin *backend_plugin = NULL;

                  be_replace_dse_internal(be, *local_pschemadse);

- 

-                 /* ldbm has some internal attributes to be added */

-                 backend_plugin = plugin_get_by_name("ldbm database");

-                 if (backend_plugin) {

-                     if (backend_plugin->plg_add_schema) {

-                         (backend_plugin->plg_add_schema)(NULL);

-                     } else {

-                         slapi_log_err(SLAPI_LOG_ERR, "init_schema_dse_ext",

-                                       "backend has not set internal schema\n");

-                     }

-                 }

              }

          }

      }

@@ -909,16 +909,13 @@ 

  #define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN             223

  #define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN      224

  #define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN        225

- #define SLAPI_PLUGIN_DB_SIZE_FN                   226

  #define SLAPI_PLUGIN_DB_TEST_FN                   227

  #define SLAPI_PLUGIN_DB_DB2INDEX_FN               228

  #define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN  229

  #define SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN          230

- #define SLAPI_PLUGIN_DB_INIT_INSTANCE_FN          231

  #define SLAPI_PLUGIN_DB_WIRE_IMPORT_FN            234

  #define SLAPI_PLUGIN_DB_UPGRADEDB_FN              235

  #define SLAPI_PLUGIN_DB_DBVERIFY_FN               236

- #define SLAPI_PLUGIN_DB_ADD_SCHEMA_FN             237

  #define SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN 238

  #define SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN    239

  #define SLAPI_PLUGIN_DB_UPGRADEDNFORMAT_FN        240

Description:

Removed some unused database plugin initializations. Also cleaned up some of the logging in the bdb specific code that was not using the correct function name.

Fixes: https://pagure.io/389-ds-base/issue/49481

SLAPI_PLUGIN_DB_INIT_INSTANCE_FN is used nowhere, in chaning backend it is only used in a comment.
SLAPI_PLUGIN_DB_SIZE_FN is set in cb and always returns 0, can't see where it is used. If we remove the function for main backend, we will not need it for cb. So I think all the references to these could be removed, from slapi-private, cb, pblock

SLAPI_PLUGIN_DB_INIT_INSTANCE_FN is used nowhere, in chaning backend it is only used in a comment.
SLAPI_PLUGIN_DB_SIZE_FN is set in cb and always returns 0, can't see where it is used. If we remove the function for main backend, we will not need it for cb. So I think all the references to these could be removed, from slapi-private, cb, pblock

Hi Ludwig!

Yeah when I was working on the other cleanup ticket I realized there was more to do in this one. I will continue to work on it...

rebased onto f0f0c92e7f50014db72de679550e6b940f7f70e8

2 years ago

I'm going to assume entryusn is already in the schema?

I'd still want to @tbordaz or @elkris to have a look as well, but I don't see anything obviously wrong (but I may have missed something too, backend code is not something I'm a complete expert in)

I'm going to assume entryusn is already in the schema?

It is, it's in 01core389.ldif

Nice cleanup. The patch looks good to me. Ack

rebased onto 2b6e9cf4f9724a8d2bedda75fa54b7c8717318de

2 years ago

rebased onto 98d6c7f

2 years ago

Pull-Request has been merged by mreynolds

2 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4270

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

2 years ago