下面列出了org.apache.http.impl.auth.DigestScheme#org.elasticsearch.index.engine.DocumentAlreadyExistsException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること. ※
* DocumentAlreadyExistsExceptionに限らず、初回処理でキャッチ対象でない例外が発生した場合の処理を対象としたテスト
*/
@Test(expected = EsClientException.class)
public void ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、DocumentAlreadyExistsExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
DocumentAlreadyExistsException toBeThrown = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(toBeThrown)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
esTypeObject.create("dummyId", null);
fail("EsClientException should be thrown.");
} finally {
index.delete();
}
}
/**
* ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること. ※
* DocumentAlreadyExistsExceptionに限らず、初回処理でキャッチ対象でない例外が発生した場合の処理を対象としたテスト
*/
@Test(expected = EsClientException.class)
public void ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、DocumentAlreadyExistsExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
DocumentAlreadyExistsException toBeThrown = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(toBeThrown)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
esTypeObject.create("dummyId", null);
fail("EsClientException should be thrown.");
} finally {
index.delete();
}
}
/**
* ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること. ※
* DocumentAlreadyExistsExceptionに限らず、初回処理でキャッチ対象でない例外が発生した場合の処理を対象としたテスト
*/
@Test(expected = EsClientException.class)
public void ドキュメント新規作成時_初回でDocumentAlreadyExistsExceptionが発生した場合にEsClient_EsClientExceptionが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、DocumentAlreadyExistsExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
DocumentAlreadyExistsException toBeThrown = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(toBeThrown)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
esTypeObject.create("dummyId", null);
fail("EsClientException should be thrown.");
} finally {
index.delete();
}
}
private void processEvent(
final Queue<Map<String, Object>> eventMapQueue,
final CountDownLatch genTVGate) {
final Map<String, Object> eventMap = eventMapQueue.poll();
if (eventMap == null) {
genTVGate.countDown();
return;
}
final RequestHandler[] handlers = new RequestHandler[requestHandlers.length + 1];
for (int i = 0; i < requestHandlers.length; i++) {
handlers[i] = requestHandlers[i];
}
handlers[requestHandlers.length] = (params, listener, requestMap,
paramMap, chain) -> processEvent(eventMapQueue, genTVGate);
new RequestHandlerChain(handlers).execute(eventParams, t -> {
if (t.getCause() instanceof DocumentAlreadyExistsException) {
eventMapQueue.offer(eventMap);
if (logger.isDebugEnabled()) {
logger.debug("Re-offer {}", t, eventMap);
}
} else {
logger.error("Failed to store: " + eventMap, t);
}
processEvent(eventMapQueue, genTVGate);
}, eventMap, new HashMap<>());
}
/**
* Returns the cause throwable of a {@link org.elasticsearch.transport.RemoteTransportException}
* and {@link org.elasticsearch.action.search.ReduceSearchPhaseException}.
* Also transform throwable to {@link io.crate.exceptions.CrateException}.
*/
private Throwable esToCrateException(Throwable e) {
e = Exceptions.unwrap(e);
if (e instanceof IllegalArgumentException || e instanceof ParsingException) {
return new SQLParseException(e.getMessage(), (Exception) e);
} else if (e instanceof UnsupportedOperationException) {
return new UnsupportedFeatureException(e.getMessage(), (Exception) e);
} else if (e instanceof DocumentAlreadyExistsException) {
return new DuplicateKeyException(
"A document with the same primary key exists already", e);
} else if (e instanceof IndexAlreadyExistsException) {
return new TableAlreadyExistsException(((IndexAlreadyExistsException) e).getIndex(), e);
} else if ((e instanceof InvalidIndexNameException)) {
if (e.getMessage().contains("already exists as alias")) {
// treat an alias like a table as aliases are not officially supported
return new TableAlreadyExistsException(((InvalidIndexNameException) e).getIndex(),
e);
}
return new InvalidTableNameException(((InvalidIndexNameException) e).getIndex(), e);
} else if (e instanceof InvalidIndexTemplateException) {
PartitionName partitionName = PartitionName.fromIndexOrTemplate(((InvalidIndexTemplateException) e).name());
return new InvalidTableNameException(partitionName.tableIdent().fqn(), e);
} else if (e instanceof IndexNotFoundException) {
return new TableUnknownException(((IndexNotFoundException) e).getIndex(), e);
} else if (e instanceof org.elasticsearch.common.breaker.CircuitBreakingException) {
return new CircuitBreakingException(e.getMessage());
} else if (e instanceof InterruptedException) {
return new JobKilledException();
} else if (e instanceof RepositoryMissingException) {
return new RepositoryUnknownException(((RepositoryMissingException) e).repository());
} else if (e instanceof SnapshotMissingException) {
return new SnapshotUnknownException(((SnapshotMissingException) e).snapshot(), e);
} else if (e instanceof InvalidSnapshotNameException) {
if (((InvalidSnapshotNameException) e).getDetailedMessage().contains("snapshot with such name already exists")) {
return new SnapShotAlreadyExistsExeption(((InvalidSnapshotNameException) e).snapshot());
}
}
return e;
}
protected boolean isConflictException(Throwable e) {
Throwable cause = ExceptionsHelper.unwrapCause(e);
// on version conflict or document missing, it means
// that a new change has crept into the replica, and it's fine
if (cause instanceof VersionConflictEngineException) {
return true;
}
if (cause instanceof DocumentAlreadyExistsException) {
return true;
}
return false;
}
@Override
boolean isParticularError(ElasticsearchException e) {
return e instanceof DocumentAlreadyExistsException
|| e instanceof IndexNotFoundException
|| e.getCause() instanceof IndexNotFoundException
|| e instanceof MapperParsingException;
}
@Override
IndexResponse onParticularError(ElasticsearchException e) {
if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
throw new EsClientException.EsIndexMissingException(e);
}
if (e instanceof MapperParsingException) {
throw new EsClientException.EsSchemaMismatchException(e);
}
// 既知のExceptionの場合はINFOログ
// 新規のExceptionの場合はWARNログ
if (e instanceof DocumentAlreadyExistsException) {
if (e.getClass() != null) {
log.info(e.getClass().getName() + " : " + e.getMessage());
} else {
log.info(e.getMessage());
}
} else {
if (e.getClass() != null) {
log.warn(e.getClass().getName() + " : " + e.getMessage());
} else {
log.warn(e.getMessage());
}
}
// 例外が発生した場合でもドキュメントが登録されている可能性がある。
// そのため、登録チェックを行い、データが登録済の場合は正常なレスポンスを返却する。
return checkDocumentCreated(id, data, e);
}
/**
* ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト
.doThrow(documentAlreadyExists)
// リトライ1回目
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} catch (Exception e){
e.printStackTrace();
} finally {
index.delete();
}
}
/**
* ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト
.doThrow(documentAlreadyExists)
// リトライ1回目
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} catch (Exception e){
e.printStackTrace();
} finally {
index.delete();
}
}
@Override
boolean isParticularError(ElasticsearchException e) {
return e instanceof DocumentAlreadyExistsException
|| e instanceof IndexMissingException
|| e.getCause() instanceof IndexMissingException
|| e instanceof MapperParsingException;
}
@Override
IndexResponse onParticularError(ElasticsearchException e) {
if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
throw new EsClientException.EsIndexMissingException(e);
}
if (e instanceof MapperParsingException) {
throw new EsClientException.EsSchemaMismatchException(e);
}
// 既知のExceptionの場合はINFOログ
// 新規のExceptionの場合はWARNログ
if (e instanceof DocumentAlreadyExistsException) {
if (e.getClass() != null) {
log.info(e.getClass().getName() + " : " + e.getMessage());
} else {
log.info(e.getMessage());
}
} else {
if (e.getClass() != null) {
log.warn(e.getClass().getName() + " : " + e.getMessage());
} else {
log.warn(e.getMessage());
}
}
// 例外が発生した場合でもドキュメントが登録されている可能性がある。
// そのため、登録チェックを行い、データが登録済の場合は正常なレスポンスを返却する。
return checkDocumentCreated(id, data, e);
}
/**
* ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理初回でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト
.doThrow(documentAlreadyExists)
// リトライ1回目
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} finally {
index.delete();
}
}
private void doItemUpdate(final Params params,
final RequestHandler.OnErrorListener listener,
final Map<String, Object> requestMap,
final Map<String, Object> paramMap,
final Map<String, Object> itemMap, final String index,
final String type, final String itemIdField,
final String timestampField, final Long itemId,
final OpType opType, final RequestHandlerChain chain) {
itemMap.put(itemIdField, itemId);
itemMap.put(timestampField, new Date());
final OnResponseListener<IndexResponse> responseListener = response -> {
paramMap.put(itemIdField, itemId);
chain.execute(params, listener, requestMap, paramMap);
};
final OnFailureListener failureListener = t -> {
sleep(t);
if (t instanceof DocumentAlreadyExistsException
|| t instanceof EsRejectedExecutionException) {
execute(params, listener, requestMap, paramMap, chain);
} else {
listener.onError(t);
}
};
client.prepareIndex(index, type, itemId.toString()).setSource(itemMap)
.setRefresh(true).setOpType(opType)
.execute(on(responseListener, failureListener));
}
private void doUserUpdate(final Params params,
final RequestHandler.OnErrorListener listener,
final Map<String, Object> requestMap,
final Map<String, Object> paramMap,
final Map<String, Object> userMap, final String index,
final String type, final String userIdField,
final String timestampField, final Long userId,
final OpType opType, final RequestHandlerChain chain) {
userMap.put(userIdField, userId);
userMap.put(timestampField, new Date());
final OnResponseListener<IndexResponse> responseListener = response -> {
paramMap.put(userIdField, userId);
chain.execute(params, listener, requestMap, paramMap);
};
final OnFailureListener failureListener = t -> {
if (t instanceof DocumentAlreadyExistsException
|| t instanceof EsRejectedExecutionException) {
sleep(t);
execute(params, listener, requestMap, paramMap, chain);
} else {
listener.onError(t);
}
};
client.prepareIndex(index, type, userId.toString()).setSource(userMap)
.setRefresh(true).setOpType(opType)
.execute(on(responseListener, failureListener));
}
/**
* ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
NoNodeAvailableException esNoNodeAvailableException = Mockito.mock(NoNodeAvailableException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト時の例外
.doThrow(esNoNodeAvailableException)
// リトライ1回目
.doThrow(esNoNodeAvailableException)
// リトライ2回目
.doThrow(esNoNodeAvailableException)
// リトライ3回目
.doThrow(esNoNodeAvailableException)
// リトライ4回目
.doThrow(documentAlreadyExists)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} catch(Exception e) {
e.printStackTrace();
} finally {
index.delete();
}
}
/**
* ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
NoNodeAvailableException esNoNodeAvailableException = Mockito.mock(NoNodeAvailableException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト時の例外
.doThrow(esNoNodeAvailableException)
// リトライ1回目
.doThrow(esNoNodeAvailableException)
// リトライ2回目
.doThrow(esNoNodeAvailableException)
// リトライ3回目
.doThrow(esNoNodeAvailableException)
// リトライ4回目
.doThrow(documentAlreadyExists)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} catch(Exception e) {
e.printStackTrace();
} finally {
index.delete();
}
}
/**
* ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistsExceptionが返された場合に正常なIndexResponseが返されること.
*/
@Test
public void ドキュメント新規作成時_リトライ処理の最大回数終了時点でDocumentAlreadyExistExceptionが返された場合に正常なIndexResponseが返されること() {
EsIndex index = esClient.idxUser("index_for_test", EsIndex.CATEGORY_AD);
try {
index.create();
EsType type = esClient.type("index_for_test_" + EsIndex.CATEGORY_AD,
"TypeForTest", "TestRoutingId", 5, 500);
type.create("dummyId", new HashMap<Object, Object>());
EsTypeImpl esTypeObject = (EsTypeImpl) Mockito.spy(type);
// EsType#asyncIndex()が呼ばれた場合に、NodeDisconnectedExceptionを投げる。
// 送出する例外オブジェクトのモックを作成
NodeDisconnectedException esDisconnectedException = Mockito.mock(NodeDisconnectedException.class);
NoNodeAvailableException esNoNodeAvailableException = Mockito.mock(NoNodeAvailableException.class);
DocumentAlreadyExistsException documentAlreadyExists = Mockito.mock(DocumentAlreadyExistsException.class);
Mockito.doThrow(esDisconnectedException)
// 本来のリクエスト時の例外
.doThrow(esNoNodeAvailableException)
// リトライ1回目
.doThrow(esNoNodeAvailableException)
// リトライ2回目
.doThrow(esNoNodeAvailableException)
// リトライ3回目
.doThrow(esNoNodeAvailableException)
// リトライ4回目
.doThrow(documentAlreadyExists)
.when(esTypeObject)
.asyncIndex(Mockito.anyString(), Mockito.anyMapOf(String.class, Object.class),
Mockito.any(OpType.class), Mockito.anyLong());
// メソッド呼び出し
DcIndexResponse response = esTypeObject.create("dummyId", new HashMap<Object, Object>());
assertNotNull(response);
assertEquals("index_for_test_" + EsIndex.CATEGORY_AD, response.getIndex());
assertEquals("dummyId", response.getId());
assertEquals("TypeForTest", response.getType());
assertEquals(1, response.getVersion());
} finally {
index.delete();
}
}