From 3e7410b2ec4ceeef110ed4864d86cd56993512fe Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Sat, 26 Sep 2009 18:33:49 +0000
Subject: [PATCH] Rebuild index using new import engine.
---
opends/src/server/org/opends/server/tools/RebuildIndex.java | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/RebuildIndex.java b/opends/src/server/org/opends/server/tools/RebuildIndex.java
index a408db0..c26b30f 100644
--- a/opends/src/server/org/opends/server/tools/RebuildIndex.java
+++ b/opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -80,6 +80,8 @@
private StringArgument configFile = null;
private StringArgument baseDNString = null;
private StringArgument indexList = null;
+ private StringArgument tmpDirectory = null;
+ private BooleanArgument rebuildAll = null;
/**
* Processes the command-line arguments and invokes the rebuild process.
@@ -140,7 +142,7 @@
}
// Define the command-line arguments that may be used with this program.
- BooleanArgument displayUsage = null;
+ BooleanArgument displayUsage ;
// Create the command-line argument parser for use with this program.
@@ -187,6 +189,19 @@
argParser.addArgument(indexList);
+ rebuildAll =
+ new BooleanArgument("rebuildAll", null, "rebuildAll",
+ INFO_REBUILDINDEX_DESCRIPTION_REBUILD_ALL.get());
+ argParser.addArgument(rebuildAll);
+
+
+ tmpDirectory =
+ new StringArgument("tmpdirectory", null, "tmpdirectory", false,
+ false, true, INFO_REBUILDINDEX_TEMP_DIR_PLACEHOLDER.get(),
+ "import-tmp",
+ null, INFO_REBUILDINDEX_DESCRIPTION_TEMP_DIRECTORY.get());
+ argParser.addArgument(tmpDirectory);
+
displayUsage =
new BooleanArgument("help", 'H', "help",
INFO_DESCRIPTION_USAGE.get());
@@ -236,7 +251,7 @@
}
- if (indexList.getValues().size() <= 0)
+ if (indexList.getValues().size() <= 0 && !rebuildAll.isPresent())
{
Message message = ERR_REBUILDINDEX_REQUIRES_AT_LEAST_ONE_INDEX.get();
@@ -245,6 +260,13 @@
return 1;
}
+ if(rebuildAll.isPresent() && indexList.isPresent())
+ {
+ Message msg = ERR_REBUILDINDEX_REBUILD_ALL_ERROR.get();
+ err.println(wrapText(msg, MAX_LINE_WIDTH));
+ out.println(argParser.getUsage());
+ return 1;
+ }
return process(argParser, initializeServer, out, err);
}
@@ -424,7 +446,7 @@
ArrayList<Backend> backendList = new ArrayList<Backend>();
ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>();
ArrayList<List<DN>> dnList = new ArrayList<List<DN>>();
- int code = BackendToolUtils.getBackends(backendList, entryList, dnList);
+ BackendToolUtils.getBackends(backendList, entryList, dnList);
int numBackends = backendList.size();
for (int i=0; i < numBackends; i++)
@@ -498,6 +520,9 @@
return 1;
}
+ rebuildConfig.setRebuildAll(rebuildAll.isPresent());
+ rebuildConfig.setTmpDirectory(tmpDirectory.getValue());
+
// Launch the rebuild process.
int returnCode = 0;
try
@@ -567,6 +592,25 @@
values.add(ByteString.valueOf(s));
}
attributes.add(new LDAPAttribute(ATTR_REBUILD_INDEX, values));
+
+
+ if (tmpDirectory.getValue() != null &&
+ !tmpDirectory.getValue().equals(
+ tmpDirectory.getDefaultValue())) {
+ values = new ArrayList<ByteString>(1);
+ values.add(ByteString.valueOf(tmpDirectory.getValue()));
+ attributes.add(new LDAPAttribute(ATTR_REBUILD_TMP_DIRECTORY, values));
+ }
+
+
+ if (rebuildAll.getValue() != null &&
+ !rebuildAll.getValue().equals(
+ rebuildAll.getDefaultValue())) {
+ values = new ArrayList<ByteString>(1);
+ values.add(ByteString.valueOf(REBUILD_ALL));
+ attributes.add(
+ new LDAPAttribute(ATTR_REBUILD_INDEX, values));
+ }
}
/**
--
Gitblit v1.10.0