protected void onIndexEngineChange(final int indexId) { while (true) try { storage.callIndexEngine(false, false, indexId, engine -> { engine.init(getName(), getType(), getDefinition(), isAutomatic(), getMetadata()); return null; }); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } }
private void removeValuesContainer() { if (valueContainerAlgorithm.equals(ODefaultIndexFactory.SBTREE_BONSAI_VALUE_CONTAINER)) { final OAtomicOperation atomicOperation = OAtomicOperationsManager.getCurrentOperation(); final OReadCache readCache = storage.getReadCache(); final OWriteCache writeCache = storage.getWriteCache(); if (atomicOperation == null) { try { final String fileName = getName() + OIndexRIDContainer.INDEX_FILE_EXTENSION; if (writeCache.exists(fileName)) { final long fileId = writeCache.loadFile(fileName); readCache.deleteFile(fileId, writeCache); } } catch (IOException e) { OLogManager.instance().error(this, "Cannot delete file for value containers", e); } } else { try { final String fileName = getName() + OIndexRIDContainer.INDEX_FILE_EXTENSION; if (atomicOperation.isFileExists(fileName)) { final long fileId = atomicOperation.loadFile(fileName); atomicOperation.deleteFile(fileId); } } catch (IOException e) { OLogManager.instance().error(this, "Cannot delete file for value containers", e); } } } }
transaction.addIndexEntry(this, super.getName(), OTransactionIndexChanges.OPERATION.PUT, encodeKey(key), singleValue);
@Override public boolean remove(final Object key, final OIdentifiable value) { if (key != null) { OBasicTransaction transaction = getDatabase().getMicroOrRegularTransaction(); if (transaction.isActive()) { transaction.addIndexEntry(this, super.getName(), OTransactionIndexChanges.OPERATION.REMOVE, encodeKey(key), value); OLuceneTxChanges transactionChanges = getTransactionChanges(transaction); transactionChanges.remove(key, value); return true; } else { while (true) { try { return storage.callIndexEngine(false, false, indexId, engine -> { OLuceneIndexEngine indexEngine = (OLuceneIndexEngine) engine; return indexEngine.remove(key, value); }); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } } } return true; }