1 Star 0 Fork 43

pojunxing/openldap

forked from src-openEuler/openldap 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-ITS-9858-back-mdb-fix-index-reconfig.patch 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
compile_success 提交于 2022-11-07 12:04 . backport patch
From 395e9b250a1a430e788487f73b292c08fc28540c Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Fri, 3 Jun 2022 00:48:50 +0100
Subject: [PATCH] ITS#9858 back-mdb: fix index reconfig
---
servers/slapd/back-mdb/attr.c | 6 +++++-
servers/slapd/back-mdb/config.c | 24 ++++++++++++------------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/servers/slapd/back-mdb/attr.c b/servers/slapd/back-mdb/attr.c
index 9567fb522..7219705b2 100644
--- a/servers/slapd/back-mdb/attr.c
+++ b/servers/slapd/back-mdb/attr.c
@@ -446,7 +446,11 @@ fail:
/* If this is leftover from a previous add, commit it */
if ( b->ai_newmask )
b->ai_indexmask = b->ai_newmask;
- b->ai_newmask = a->ai_newmask;
+ /* If the mask changed, remember it */
+ if ( b->ai_indexmask != a->ai_newmask )
+ b->ai_newmask = a->ai_newmask;
+ else /* else ignore it */
+ b->ai_newmask = 0;
ch_free( a );
rc = 0;
continue;
diff --git a/servers/slapd/back-mdb/config.c b/servers/slapd/back-mdb/config.c
index 1b3cf98fe..48143ef4d 100644
--- a/servers/slapd/back-mdb/config.c
+++ b/servers/slapd/back-mdb/config.c
@@ -349,7 +349,7 @@ mdb_setup_indexer( struct mdb_info *mdb )
MDB_txn *txn;
MDB_cursor *curs;
MDB_val key, data;
- int i, rc;
+ int i, rc, changed = 0;
unsigned short s;
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &txn );
@@ -364,17 +364,6 @@ mdb_setup_indexer( struct mdb_info *mdb )
key.mv_size = sizeof( s );
key.mv_data = &s;
- /* set indexer task to start at first entry */
- {
- ID id = 0;
- s = 0; /* key 0 records next entryID to index */
- data.mv_size = sizeof( ID );
- data.mv_data = &id;
- rc = mdb_cursor_put( curs, &key, &data, 0 );
- if ( rc )
- goto done;
- }
-
/* record current and new index masks for all new index definitions */
{
slap_mask_t mask[2];
@@ -389,8 +378,19 @@ mdb_setup_indexer( struct mdb_info *mdb )
rc = mdb_cursor_put( curs, &key, &data, 0 );
if ( rc )
goto done;
+ changed = 1;
}
}
+
+ /* set indexer task to start at first entry */
+ if ( changed ) {
+ ID id = 0;
+ s = 0; /* key 0 records next entryID to index */
+ data.mv_size = sizeof( ID );
+ data.mv_data = &id;
+ rc = mdb_cursor_put( curs, &key, &data, 0 );
+ }
+
done:
mdb_cursor_close( curs );
if ( !rc )
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chengyechun/openldap.git
git@gitee.com:chengyechun/openldap.git
chengyechun
openldap
openldap
master

搜索帮助