#13 Issue 4765 - database suffix unexpectdly changed from .db to .db4 (#4766)
Opened 4 months ago by cheimes. Modified 4 months ago
rpms/ cheimes/389-ds-base issue4765-f34  into  f34

@@ -0,0 +1,182 @@ 

+ From bbdf47a9252040a5e42e015cb636380b88e9caa8 Mon Sep 17 00:00:00 2001

+ From: Thierry Bordaz <tbordaz@redhat.com>

+ Date: Tue, 18 May 2021 19:16:30 +0200

+ Subject: [PATCH] Issue 4765 - database suffix unexpectdly changed from .db to

+  .db4 (#4766)

+ 

+ * Issue 4765 - database suffix unexpectdly changed from .db to .db4

+ 

+ * Issue 4765 - database suffix unexpectdly changed from .db to .db4 - fix some compilation warnings

+ ---

+  ldap/servers/slapd/back-ldbm/back-ldbm.h         |  9 ---------

+  ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c |  1 +

+  ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c  |  5 +++++

+  ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h  | 11 +++++++++++

+  ldap/servers/slapd/back-ldbm/dblayer.c           |  9 +++++++++

+  ldap/servers/slapd/back-ldbm/dblayer.h           |  3 +++

+  ldap/servers/slapd/back-ldbm/proto-back-ldbm.h   |  2 ++

+  ldap/servers/slapd/back-ldbm/vlv_srch.c          |  2 +-

+  8 files changed, 32 insertions(+), 10 deletions(-)

+ 

+ diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h

+ index ddac99541..50b0996cb 100644

+ --- a/ldap/servers/slapd/back-ldbm/back-ldbm.h

+ +++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h

+ @@ -66,14 +66,6 @@ typedef unsigned short u_int16_t;

+  

+  #define ID2ENTRY "id2entry" /* main db file name: ID2ENTRY+LDBM_SUFFIX */

+  

+ -#if 1000 * DB_VERSION_MAJOR + 100 * DB_VERSION_MINOR >= 5000

+ -#define LDBM_SUFFIX_OLD ".db4"

+ -#define LDBM_SUFFIX     ".db"

+ -#else

+ -#define LDBM_SUFFIX_OLD ".db3"

+ -#define LDBM_SUFFIX     ".db4"

+ -#endif

+ -

+  #define MEGABYTE (1024 * 1024)

+  #define GIGABYTE (1024 * MEGABYTE)

+  

+ @@ -143,7 +135,6 @@ typedef unsigned short u_int16_t;

+  #define LDBM_VERSION_40   "Netscape-ldbm/4.0"

+  #define LDBM_VERSION_30   "Netscape-ldbm/3.0"

+  #define LDBM_VERSION_31   "Netscape-ldbm/3.1"

+ -#define LDBM_FILENAME_SUFFIX LDBM_SUFFIX

+  #define DBVERSION_FILENAME "DBVERSION"

+  /* 0 here means to let the autotuning reset the value on first run */

+  /* cache can't get any smaller than this (in bytes) */

+ diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c

+ index 65a2405d8..11a65e806 100644

+ --- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c

+ +++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c

+ @@ -125,6 +125,7 @@ int bdb_init(struct ldbminfo *li, config_info *config_array)

+      priv->dblayer_dbi_txn_abort_fn = &bdb_dbi_txn_abort;

+      priv->dblayer_get_entries_count_fn = &bdb_get_entries_count;

+      priv->dblayer_cursor_get_count_fn = &bdb_public_cursor_get_count;

+ +    priv->dblayer_get_db_suffix_fn = &bdb_public_get_db_suffix;

+  

+      bdb_fake_priv = *priv; /* Copy the callbaks for bdb_be() */

+      return 0;

+ diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c

+ index 186c11cc3..455596a92 100644

+ --- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c

+ +++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c

+ @@ -6713,3 +6713,8 @@ bdb_public_cursor_get_count(dbi_cursor_t *cursor, dbi_recno_t *count)

+      int rc = cur->c_count(cur, count, 0);

+      return bdb_map_error(__FUNCTION__, rc);

+  }

+ +

+ +const char *bdb_public_get_db_suffix(void)

+ +{

+ +    return LDBM_FILENAME_SUFFIX;

+ +}

+ diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h

+ index 32430e2af..924656998 100644

+ --- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h

+ +++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h

+ @@ -13,6 +13,16 @@

+  

+  #define BDB_CONFIG(li) ((bdb_config *)(li)->li_dblayer_config)

+  

+ +#if 1000 * DB_VERSION_MAJOR + 100 * DB_VERSION_MINOR >= 5000

+ +#define LDBM_SUFFIX_OLD ".db4"

+ +#define LDBM_SUFFIX     ".db"

+ +#else

+ +#define LDBM_SUFFIX_OLD ".db3"

+ +#define LDBM_SUFFIX     ".db4"

+ +#endif

+ +

+ +#define LDBM_FILENAME_SUFFIX LDBM_SUFFIX

+ +

+  typedef struct bdb_db_env

+  {

+      DB_ENV *bdb_DB_ENV;

+ @@ -133,6 +143,7 @@ dblayer_dbi_txn_commit_fn_t bdb_dbi_txn_commit;

+  dblayer_dbi_txn_abort_fn_t bdb_dbi_txn_abort;

+  dblayer_get_entries_count_fn_t bdb_get_entries_count;

+  dblayer_cursor_get_count_fn_t bdb_public_cursor_get_count;

+ +dblayer_get_db_suffix_fn_t bdb_public_get_db_suffix;

+  

+  /* instance functions */

+  int bdb_instance_cleanup(struct ldbm_instance *inst);

+ diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c

+ index c5ff6cba9..bf56df42a 100644

+ --- a/ldap/servers/slapd/back-ldbm/dblayer.c

+ +++ b/ldap/servers/slapd/back-ldbm/dblayer.c

+ @@ -1370,3 +1370,12 @@ dblayer_pop_pvt_txn(void)

+      }

+      return;

+  }

+ +

+ +const char *

+ +dblayer_get_db_suffix(Slapi_Backend *be)

+ +{

+ +    struct ldbminfo *li = be ? (struct ldbminfo *)be->be_database->plg_private : NULL;

+ +    dblayer_private *prv = li ? (dblayer_private *)li->li_dblayer_private : NULL;

+ +

+ +    return  prv ? prv->dblayer_get_db_suffix_fn() : NULL;

+ +}

+ diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h

+ index 99acfd1ab..051035f3f 100644

+ --- a/ldap/servers/slapd/back-ldbm/dblayer.h

+ +++ b/ldap/servers/slapd/back-ldbm/dblayer.h

+ @@ -109,6 +109,7 @@ typedef int dblayer_dbi_txn_commit_fn_t(dbi_txn_t *txn);

+  typedef int dblayer_dbi_txn_abort_fn_t(dbi_txn_t *txn);

+  typedef int dblayer_get_entries_count_fn_t(dbi_db_t *db, int *count);

+  typedef int dblayer_cursor_get_count_fn_t(dbi_cursor_t *cursor, dbi_recno_t *count);

+ +typedef const char *dblayer_get_db_suffix_fn_t(void);

+  

+  struct dblayer_private

+  {

+ @@ -178,6 +179,7 @@ struct dblayer_private

+      dblayer_dbi_txn_abort_fn_t *dblayer_dbi_txn_abort_fn;

+      dblayer_get_entries_count_fn_t *dblayer_get_entries_count_fn;

+      dblayer_cursor_get_count_fn_t *dblayer_cursor_get_count_fn;

+ +    dblayer_get_db_suffix_fn_t *dblayer_get_db_suffix_fn;

+  };

+  

+  #define DBLAYER_PRIV_SET_DATA_DIR 0x1

+ @@ -188,6 +190,7 @@ back_txn *dblayer_get_pvt_txn(void);

+  void dblayer_pop_pvt_txn(void);

+  

+  int dblayer_delete_indices(ldbm_instance *inst);

+ +const char *dblayer_get_db_suffix(Slapi_Backend *be);

+  

+  

+  /* Return the last four characters of a string; used for comparing extensions. */

+ diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h

+ index 22f2d1103..dbe5dca73 100644

+ --- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h

+ +++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h

+ @@ -142,6 +142,8 @@ void dblayer_restore_file_update(struct ldbminfo *li, char *directory);

+  int dblayer_import_file_init(ldbm_instance *inst);

+  void dblayer_import_file_update(ldbm_instance *inst);

+  int dblayer_import_file_check(ldbm_instance *inst);

+ +const char *dblayer_get_db_suffix(Slapi_Backend *be);

+ +

+  

+  /*

+   * dn2entry.c

+ diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c

+ index 4dd3804c9..6fd1b3880 100644

+ --- a/ldap/servers/slapd/back-ldbm/vlv_srch.c

+ +++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c

+ @@ -30,7 +30,6 @@ char *const type_vlvEnabled = "vlvEnabled";

+  char *const type_vlvUses = "vlvUses";

+  

+  static const char *file_prefix = "vlv#"; /* '#' used to avoid collision with real attributes */

+ -static const char *file_suffix = LDBM_FILENAME_SUFFIX;

+  

+  static int vlvIndex_createfilename(struct vlvIndex *pIndex, char **ppc);

+  

+ @@ -514,6 +513,7 @@ void

+  vlvIndex_init(struct vlvIndex *p, backend *be, struct vlvSearch *pSearch, const Slapi_Entry *e)

+  {

+      struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private;

+ +    const char *file_suffix = dblayer_get_db_suffix(be);

+      char *filename = NULL;

+  

+      if (NULL == p)

+ -- 

+ 2.30.2

+ 

file modified
+6 -2
@@ -47,7 +47,7 @@ 

  Summary:          389 Directory Server (base)

  Name:             389-ds-base

  Version:          2.0.4

- Release:          %{?relprefix}3%{?prerel}%{?dist}

+ Release:          %{?relprefix}4%{?prerel}%{?dist}

  License:          GPLv3+ and (ASL 2.0 or MIT) and MIT and (ASL 2.0 or Boost) and MPLv2.0 and ASL 2.0 and BSD and (ASL 2.0 with exceptions or ASL 2.0 or MIT) and (Unlicense or MIT)

  URL:              https://www.port389.org

  Conflicts:        selinux-policy-base < 3.9.8
@@ -254,6 +254,8 @@ 

  Obsoletes:        %{name} <= 1.3.5.4

  

  Source0:          https://releases.pagure.org/389-ds-base/%{name}-%{version}%{?prerel}.tar.bz2

+ Patch0:           0000-Issue-4765-database-suffix-on-2-0-4.patch

+ Patch1:           0001-dna_enable_interval.patch

  # 389-ds-git.sh should be used to generate the source tarball from git

  Source1:          %{name}-git.sh

  Source2:          %{name}-devel.README
@@ -359,7 +361,6 @@ 

  

  %prep

  %autosetup -p1 -v -n %{name}-%{version}%{?prerel}

- %setup -q -n %{name}-%{version}%{?prerel}

  

  %if %{bundle_jemalloc}

  %setup -q -n %{name}-%{version}%{?prerel} -T -D -b 3
@@ -704,6 +705,9 @@ 

  %endif

  

  %changelog

+ * Fri May 21 2021 Christian Heimes <cheimes@redhat.com> - 2.0.4-4

+ - Issue 4765 - database suffix unexpectdly changed from .db to .db4 (#4766)

+ 

  * Thu May 20 2021 Christian Heimes <cheimes@redhat.com> - 2.0.4-3

  - Enable interval feature of DNA plugin (resolves: rhbz#1962671)

  

Thanks @cheimes . I have a concern regarding the bug fixed in which version.
In F35, 2.0.4-3 fixes DB and 2.0.4-4 fixes DNA
In F34 it is the opposite.

Is that okay ?

AFAIK that's ok. Release 2.0.4-4 has fixes for both issues and 2.0.4-3.fc34 was never released.