From 09bc45b1b94dad21572ba75b07ffe05baba103df Mon Sep 17 00:00:00 2001
From: Fabio Pistolesi <fabio.pistolesi@forgerock.com>
Date: Thu, 28 Apr 2016 12:20:07 +0000
Subject: [PATCH] OPENDJ-2973 Changing index entry limit should un-trust the index when the new value is bigger
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
index fb8e8b4..00fd5bb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -939,10 +939,17 @@
entryContainer.unlock();
}
- for (Index updatedIndex : updatedIndexes.values())
+ entryContainer.getRootContainer().getStorage().write(new WriteOperation()
{
- updateIndex(updatedIndex, newConfiguration, ccr);
- }
+ @Override
+ public void run(WriteableTransaction txn) throws Exception
+ {
+ for (final Index updatedIndex : updatedIndexes.values())
+ {
+ updateIndex(updatedIndex, newConfiguration, ccr, txn);
+ }
+ }
+ });
}
catch (Exception e)
{
@@ -963,19 +970,27 @@
}
}
- private static void updateIndex(Index updatedIndex, BackendIndexCfg newConfig, ConfigChangeResult ccr)
+ private static void updateIndex(Index updatedIndex, BackendIndexCfg newConfig, ConfigChangeResult ccr,
+ WriteableTransaction txn)
{
// This index could still be used since a new smaller index size limit doesn't impact validity of the results.
- if (updatedIndex.setIndexEntryLimit(newConfig.getIndexEntryLimit()))
+ boolean newLimitRequiresRebuild = updatedIndex.setIndexEntryLimit(newConfig.getIndexEntryLimit());
+ if (newLimitRequiresRebuild)
{
ccr.setAdminActionRequired(true);
ccr.addMessage(NOTE_CONFIG_INDEX_ENTRY_LIMIT_REQUIRES_REBUILD.get(updatedIndex.getName()));
}
- if (updatedIndex.setProtected(newConfig.isConfidentialityEnabled()))
+ // This index could still be used when disabling confidentiality.
+ boolean newConfidentialityRequiresRebuild = updatedIndex.setConfidential(newConfig.isConfidentialityEnabled());
+ if (newConfidentialityRequiresRebuild)
{
ccr.setAdminActionRequired(true);
ccr.addMessage(NOTE_CONFIG_INDEX_CONFIDENTIALITY_REQUIRES_REBUILD.get(updatedIndex.getName()));
}
+ if (newLimitRequiresRebuild || newConfidentialityRequiresRebuild)
+ {
+ updatedIndex.setTrusted(txn, false);
+ }
}
private static void deleteIndex(WriteableTransaction txn, EntryContainer entryContainer, Index index)
--
Gitblit v1.10.0