Search in sources :

Example 11 with OLocalPaginatedStorage

use of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage in project orientdb by orientechnologies.

the class WriteAheadLogConcurrencyTest method beforeClass.

@BeforeClass(enabled = false)
public void beforeClass() throws Exception {
    OWALRecordsFactory.INSTANCE.registerNewRecord((byte) 128, WriteAheadLogTest.TestRecord.class);
    String buildDirectory = System.getProperty("buildDirectory");
    if (buildDirectory == null || buildDirectory.isEmpty())
        buildDirectory = ".";
    testDir = new File(buildDirectory, "WriteAheadLogConcurrencyTest");
    if (!testDir.exists())
        testDir.mkdir();
    OLocalPaginatedStorage localPaginatedStorage = mock(OLocalPaginatedStorage.class);
    when(localPaginatedStorage.getStoragePath()).thenReturn(testDir.getAbsolutePath());
    when(localPaginatedStorage.getName()).thenReturn("WriteAheadLogConcurrencyTest");
    writeAheadLog = new ODiskWriteAheadLog(200, 500, OWALPage.PAGE_SIZE * 800, null, true, localPaginatedStorage, 10);
    writerExecutor = Executors.newCachedThreadPool();
}
Also used : OLocalPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Example 12 with OLocalPaginatedStorage

use of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage in project orientdb by orientechnologies.

the class WriteAheadLogTest method createWAL.

private ODiskWriteAheadLog createWAL(int maxPagesCacheSize, int maxSegmentSize) throws IOException {
    OLocalPaginatedStorage paginatedStorage = mock(OLocalPaginatedStorage.class);
    when(paginatedStorage.getName()).thenReturn("WriteAheadLogTest");
    when(paginatedStorage.getStoragePath()).thenReturn(testDir.getAbsolutePath());
    OStorageConfiguration configurationMock = mock(OStorageConfiguration.class);
    when(configurationMock.getLocaleInstance()).thenReturn(Locale.getDefault());
    when(paginatedStorage.getConfiguration()).thenReturn(configurationMock);
    when(paginatedStorage.getPerformanceStatisticManager()).thenReturn(new OPerformanceStatisticManager(paginatedStorage, Long.MAX_VALUE, -1));
    return new ODiskWriteAheadLog(maxPagesCacheSize, -1, maxSegmentSize, null, true, paginatedStorage, 10);
}
Also used : OLocalPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage) OStorageConfiguration(com.orientechnologies.orient.core.config.OStorageConfiguration) OPerformanceStatisticManager(com.orientechnologies.orient.core.storage.impl.local.statistic.OPerformanceStatisticManager)

Example 13 with OLocalPaginatedStorage

use of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage in project orientdb by orientechnologies.

the class OLuceneIndexEngineAbstract method delete.

@Override
public void delete() {
    if (mgrWriter != null && mgrWriter.getIndexWriter() != null) {
        try {
            mgrWriter.getIndexWriter().deleteUnusedFiles();
        } catch (IOException e) {
            e.printStackTrace();
        }
        close();
    }
    final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) storage.getUnderlying();
    if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
        OLocalPaginatedStorage localAbstract = (OLocalPaginatedStorage) storageLocalAbstract;
        deleteIndexFolder(indexName(), localAbstract);
    }
}
Also used : OLocalPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage) IOException(java.io.IOException) OAbstractPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage)

Example 14 with OLocalPaginatedStorage

use of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage in project orientdb by orientechnologies.

the class OLuceneIndexEngineAbstract method internalDelete.

protected void internalDelete(String indexName) {
    if (mgrWriter != null && mgrWriter.getIndexWriter().isOpen()) {
        close();
    }
    final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) storage.getUnderlying();
    if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
        OLocalPaginatedStorage localAbstract = (OLocalPaginatedStorage) storageLocalAbstract;
        deleteIndexFolder(indexName, localAbstract);
    }
}
Also used : OLocalPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage) OAbstractPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage)

Example 15 with OLocalPaginatedStorage

use of com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage in project orientdb by orientechnologies.

the class OServerInfo method getStorages.

public static void getStorages(final OServer server, final OJSONWriter json) throws IOException {
    json.beginCollection(1, true, "storages");
    Collection<OStorage> storages = Orient.instance().getStorages();
    for (OStorage s : storages) {
        json.beginObject(2);
        writeField(json, 2, "name", s.getName());
        writeField(json, 2, "type", s.getClass().getSimpleName());
        writeField(json, 2, "path", s instanceof OLocalPaginatedStorage ? ((OLocalPaginatedStorage) s).getStoragePath().replace('\\', '/') : "");
        writeField(json, 2, "activeUsers", "n.a.");
        json.endObject(2);
    }
    json.endCollection(1, false);
}
Also used : OLocalPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage) OStorage(com.orientechnologies.orient.core.storage.OStorage)

Aggregations

OLocalPaginatedStorage (com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage)15 File (java.io.File)9 OStorage (com.orientechnologies.orient.core.storage.OStorage)4 OAbstractPaginatedStorage (com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage)4 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 ORecordId (com.orientechnologies.orient.core.id.ORecordId)2 IOException (java.io.IOException)2 RandomAccessFile (java.io.RandomAccessFile)2 HazelcastException (com.hazelcast.core.HazelcastException)1 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)1 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)1 OOfflineNodeException (com.orientechnologies.common.concur.OOfflineNodeException)1 ConsoleCommand (com.orientechnologies.common.console.annotation.ConsoleCommand)1 OException (com.orientechnologies.common.exception.OException)1 OSystemException (com.orientechnologies.common.exception.OSystemException)1 OIOException (com.orientechnologies.common.io.OIOException)1 OCallable (com.orientechnologies.common.util.OCallable)1 OStorageConfiguration (com.orientechnologies.orient.core.config.OStorageConfiguration)1 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)1 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)1