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/backends/jeb/BackendImpl.java | 72 +++++++++++++++++++++++++++---------
1 files changed, 54 insertions(+), 18 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index 4408b56..67652d2 100644
--- a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -1136,8 +1136,7 @@
envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false");
envConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY, "false");
envConfig.setConfigParam(EnvironmentConfig.EVICTOR_NODES_PER_SCAN, "128");
- Importer importer = new Importer(importConfig, cfg);
- importer.initialize(envConfig);
+ Importer importer = Importer.getInstance(importConfig, cfg, envConfig);
rootContainer = initializeRootContainer(envConfig);
return importer.processImport(rootContainer);
}
@@ -1337,35 +1336,73 @@
* @throws DirectoryException If a Directory Server error occurs.
*/
public void rebuildBackend(RebuildConfig rebuildConfig)
- throws InitializationException, ConfigException, DirectoryException
+ throws InitializationException, ConfigException, DirectoryException
{
// If the backend already has the root container open, we must use the same
// underlying root container
boolean openRootContainer = rootContainer == null;
- // If the rootContainer is open, the backend is initialized by something
- // else.
- // We can't do any rebuild of system indexes while others are using this
- // backend. Throw error. TODO: Need to make baseDNs disablable.
+ /*
+ If the rootContainer is open, the backend is initialized by something
+ else. We can't do any rebuild of system indexes while others are using
+ this backend.
+ */
if(!openRootContainer && rebuildConfig.includesSystemIndex())
{
Message message = ERR_JEB_REBUILD_BACKEND_ONLINE.get();
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
- message);
+ message);
}
-
+ Importer importer;
try
{
+ EnvironmentConfig envConfig =
+ ConfigurableEnvironment.parseConfigEntry(cfg);
+ importer = Importer.getInstance(rebuildConfig, cfg, envConfig);
if (openRootContainer)
{
- EnvironmentConfig envConfig =
- ConfigurableEnvironment.parseConfigEntry(cfg);
-
rootContainer = initializeRootContainer(envConfig);
}
-
- RebuildJob rebuildJob = new RebuildJob(rebuildConfig);
- rebuildJob.rebuildBackend(rootContainer);
+ importer.rebuildIndexes(rootContainer);
+ }
+ catch (ExecutionException execEx)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, execEx);
+ }
+ Message message = ERR_EXECUTION_ERROR.get(execEx.getMessage());
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ message);
+ }
+ catch (InterruptedException intEx)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, intEx);
+ }
+ Message message = ERR_INTERRUPTED_ERROR.get(intEx.getMessage());
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ message);
+ }
+ catch (IOException ioe)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, ioe);
+ }
+ Message message = ERR_JEB_IO_ERROR.get(ioe.getMessage());
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ message);
+ }
+ catch (ConfigException ce)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, ce);
+ }
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ ce.getMessageObject());
}
catch (DatabaseException e)
{
@@ -1382,7 +1419,7 @@
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
- e.getMessageObject());
+ e.getMessageObject());
}
finally
{
@@ -1407,7 +1444,6 @@
}
-
/**
* {@inheritDoc}
*/
@@ -1652,7 +1688,7 @@
*/
DirectoryException createDirectoryException(DatabaseException e) {
ResultCode resultCode = DirectoryServer.getServerErrorResultCode();
- Message message = null;
+ Message message;
if (e instanceof RunRecoveryException) {
message = NOTE_BACKEND_ENVIRONMENT_UNUSABLE.get(getBackendID());
logError(message);
--
Gitblit v1.10.0