9fd0c37b6b
Resolves: RHEL-49811 - 2FA is being enforced after upgrading 2.9.1->2.9.4
148 lines
4.4 KiB
Diff
148 lines
4.4 KiB
Diff
From 13e3d0390b9aaf72a855b857857c3cdd6eb6252a Mon Sep 17 00:00:00 2001
|
|
From: Alexey Tikhonov <atikhono@redhat.com>
|
|
Date: Fri, 21 Jun 2024 19:09:29 +0200
|
|
Subject: [PATCH 5/5] SYSDB: remove index on `dataExpireTimestamp`
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This index was only used in cleanup tasks that don't run often.
|
|
On the other hand, this index is huge and degrades performance of libldb
|
|
in general.
|
|
|
|
Reviewed-by: Alejandro López <allopez@redhat.com>
|
|
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
Reviewed-by: Tomáš Halman <thalman@redhat.com>
|
|
(cherry picked from commit f0d45464cee1d2a6a2719dbffe5bbf6189d0554a)
|
|
---
|
|
src/db/sysdb_init.c | 8 ++++++++
|
|
src/db/sysdb_private.h | 9 +++++----
|
|
src/db/sysdb_upgrade.c | 27 +++++++++++++++++++++++++++
|
|
3 files changed, 40 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/db/sysdb_init.c b/src/db/sysdb_init.c
|
|
index a1d02d49c..68b9744dd 100644
|
|
--- a/src/db/sysdb_init.c
|
|
+++ b/src/db/sysdb_init.c
|
|
@@ -559,6 +559,13 @@ static errno_t sysdb_domain_cache_upgrade(TALLOC_CTX *mem_ctx,
|
|
}
|
|
}
|
|
|
|
+ if (strcmp(version, SYSDB_VERSION_0_24) == 0) {
|
|
+ ret = sysdb_upgrade_24(sysdb, &version);
|
|
+ if (ret != EOK) {
|
|
+ goto done;
|
|
+ }
|
|
+ }
|
|
+
|
|
ret = EOK;
|
|
done:
|
|
sysdb->ldb = save_ldb;
|
|
@@ -765,6 +772,7 @@ static int sysdb_domain_cache_connect(struct sysdb_ctx *sysdb,
|
|
ret = sysdb_domain_cache_upgrade(tmp_ctx, sysdb, upgrade_ctx,
|
|
ldb, domain, version, &version);
|
|
if (ret != EOK) {
|
|
+ DEBUG(SSSDBG_TRACE_FUNC, "sysdb_domain_cache_upgrade() failed\n");
|
|
goto done;
|
|
}
|
|
|
|
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
|
|
index 63f7b5601..b814f97a5 100644
|
|
--- a/src/db/sysdb_private.h
|
|
+++ b/src/db/sysdb_private.h
|
|
@@ -23,6 +23,7 @@
|
|
#ifndef __INT_SYS_DB_H__
|
|
#define __INT_SYS_DB_H__
|
|
|
|
+#define SYSDB_VERSION_0_25 "0.25"
|
|
#define SYSDB_VERSION_0_24 "0.24"
|
|
#define SYSDB_VERSION_0_23 "0.23"
|
|
#define SYSDB_VERSION_0_22 "0.22"
|
|
@@ -48,7 +49,7 @@
|
|
#define SYSDB_VERSION_0_2 "0.2"
|
|
#define SYSDB_VERSION_0_1 "0.1"
|
|
|
|
-#define SYSDB_VERSION SYSDB_VERSION_0_24
|
|
+#define SYSDB_VERSION SYSDB_VERSION_0_25
|
|
|
|
#define SYSDB_BASE_LDIF \
|
|
"dn: @ATTRIBUTES\n" \
|
|
@@ -72,7 +73,6 @@
|
|
"@IDXATTR: uidNumber\n" \
|
|
"@IDXATTR: gidNumber\n" \
|
|
"@IDXATTR: lastUpdate\n" \
|
|
- "@IDXATTR: dataExpireTimestamp\n" \
|
|
"@IDXATTR: originalDN\n" \
|
|
"@IDXATTR: nameAlias\n" \
|
|
"@IDXATTR: servicePort\n" \
|
|
@@ -104,10 +104,11 @@
|
|
"\n"
|
|
|
|
/* The timestamp cache has its own versioning */
|
|
+#define SYSDB_TS_VERSION_0_3 "0.3"
|
|
#define SYSDB_TS_VERSION_0_2 "0.2"
|
|
#define SYSDB_TS_VERSION_0_1 "0.1"
|
|
|
|
-#define SYSDB_TS_VERSION SYSDB_TS_VERSION_0_2
|
|
+#define SYSDB_TS_VERSION SYSDB_TS_VERSION_0_3
|
|
|
|
#define SYSDB_TS_BASE_LDIF \
|
|
"dn: @ATTRIBUTES\n" \
|
|
@@ -115,7 +116,6 @@
|
|
"\n" \
|
|
"dn: @INDEXLIST\n" \
|
|
"@IDXATTR: lastUpdate\n" \
|
|
- "@IDXATTR: dataExpireTimestamp\n" \
|
|
"\n" \
|
|
"dn: cn=sysdb\n" \
|
|
"cn: sysdb\n" \
|
|
@@ -194,6 +194,7 @@ int sysdb_upgrade_20(struct sysdb_ctx *sysdb, const char **ver);
|
|
int sysdb_upgrade_21(struct sysdb_ctx *sysdb, const char **ver);
|
|
int sysdb_upgrade_22(struct sysdb_ctx *sysdb, const char **ver);
|
|
int sysdb_upgrade_23(struct sysdb_ctx *sysdb, const char **ver);
|
|
+int sysdb_upgrade_24(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
|
int sysdb_ts_upgrade_01(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
|
diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c
|
|
index 37c0007cb..b010488ca 100644
|
|
--- a/src/db/sysdb_upgrade.c
|
|
+++ b/src/db/sysdb_upgrade.c
|
|
@@ -2774,6 +2774,33 @@ done:
|
|
return ret;
|
|
}
|
|
|
|
+int sysdb_upgrade_24(struct sysdb_ctx *sysdb, const char **ver)
|
|
+{
|
|
+ struct upgrade_ctx *ctx;
|
|
+ errno_t ret;
|
|
+
|
|
+ ret = commence_upgrade(sysdb, sysdb->ldb, SYSDB_VERSION_0_25, &ctx);
|
|
+ if (ret) {
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ ret = sysdb_ldb_mod_index(sysdb, SYSDB_IDX_DELETE, sysdb->ldb, "dataExpireTimestamp");
|
|
+ if (ret == ENOENT) { /*nothing to delete */
|
|
+ ret = EOK;
|
|
+ }
|
|
+ if (ret != EOK) {
|
|
+ DEBUG(SSSDBG_TRACE_FUNC, "sysdb_ldb_mod_index() failed [%d]: %s\n",
|
|
+ ret, sss_strerror(ret));
|
|
+ goto done;
|
|
+ }
|
|
+
|
|
+ ret = update_version(ctx);
|
|
+
|
|
+done:
|
|
+ ret = finish_upgrade(ret, &ctx, ver);
|
|
+ return ret;
|
|
+}
|
|
+
|
|
/*
|
|
* Example template for future upgrades.
|
|
* Copy and change version numbers as appropriate.
|
|
--
|
|
2.45.2
|
|
|