a710ab4b85
Resolves: RHEL-52400 - SYSDB: remove index on dataExpireTimestamp [rhel-10] Resolves: RHEL-50243 - Please install sssd-polkit-rules by default
147 lines
4.3 KiB
Diff
147 lines
4.3 KiB
Diff
From f0d45464cee1d2a6a2719dbffe5bbf6189d0554a Mon Sep 17 00:00:00 2001
|
|
From: Alexey Tikhonov <atikhono@redhat.com>
|
|
Date: Fri, 21 Jun 2024 19:09:29 +0200
|
|
Subject: [PATCH 3/3] 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>
|
|
---
|
|
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 ecf16fd11..507a97f63 100644
|
|
--- a/src/db/sysdb_init.c
|
|
+++ b/src/db/sysdb_init.c
|
|
@@ -531,6 +531,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;
|
|
@@ -737,6 +744,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 2d7d6f62d..32d3f1c7e 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" \
|
|
@@ -73,7 +74,6 @@
|
|
"@IDXATTR: uidNumber\n" \
|
|
"@IDXATTR: gidNumber\n" \
|
|
"@IDXATTR: lastUpdate\n" \
|
|
- "@IDXATTR: dataExpireTimestamp\n" \
|
|
"@IDXATTR: originalDN\n" \
|
|
"@IDXATTR: nameAlias\n" \
|
|
"@IDXATTR: servicePort\n" \
|
|
@@ -106,10 +106,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" \
|
|
@@ -117,7 +118,6 @@
|
|
"\n" \
|
|
"dn: @INDEXLIST\n" \
|
|
"@IDXATTR: lastUpdate\n" \
|
|
- "@IDXATTR: dataExpireTimestamp\n" \
|
|
"\n" \
|
|
"dn: cn=sysdb\n" \
|
|
"cn: sysdb\n" \
|
|
@@ -196,6 +196,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 05142d972..c0c8e13ee 100644
|
|
--- a/src/db/sysdb_upgrade.c
|
|
+++ b/src/db/sysdb_upgrade.c
|
|
@@ -2820,6 +2820,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
|
|
|