Search in sources :

Example 6 with OIntentMassiveInsert

use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.

the class LocalPaginatedStorageRestoreFromWAL method testSimpleRestore.

public void testSimpleRestore() throws Exception {
    List<Future<Void>> futures = new ArrayList<Future<Void>>();
    baseDocumentTx.declareIntent(new OIntentMassiveInsert());
    for (int i = 0; i < 8; i++) futures.add(executorService.submit(new DataPropagationTask()));
    for (Future<Void> future : futures) future.get();
    Thread.sleep(1500);
    copyDataFromTestWithoutClose();
    OStorage baseStorage = baseDocumentTx.getStorage();
    baseDocumentTx.close();
    baseStorage.close();
    testDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDir.getAbsolutePath() + "/testLocalPaginatedStorageRestoreFromWAL");
    testDocumentTx.open("admin", "admin");
    testDocumentTx.close();
    ODatabaseCompare databaseCompare = new ODatabaseCompare(testDocumentTx.getURL(), baseDocumentTx.getURL(), "admin", "admin", new OCommandOutputListener() {

        @Override
        public void onMessage(String text) {
            System.out.println(text);
        }
    });
    databaseCompare.setCompareIndexMetadata(true);
    Assert.assertTrue(databaseCompare.compare());
}
Also used : ODatabaseCompare(com.orientechnologies.orient.core.db.tool.ODatabaseCompare) ArrayList(java.util.ArrayList) OStorage(com.orientechnologies.orient.core.storage.OStorage) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OIntentMassiveInsert(com.orientechnologies.orient.core.intent.OIntentMassiveInsert) Future(java.util.concurrent.Future) OCommandOutputListener(com.orientechnologies.orient.core.command.OCommandOutputListener)

Example 7 with OIntentMassiveInsert

use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.

the class LocalPaginatedStorageRestoreFromWALAndAddAdditionalRecords method testRestoreAndAddNewItems.

public void testRestoreAndAddNewItems() throws Exception {
    List<Future<Void>> futures = new ArrayList<Future<Void>>();
    baseDocumentTx.declareIntent(new OIntentMassiveInsert());
    Random random = new Random();
    long[] seeds = new long[5];
    for (int i = 0; i < 5; i++) {
        seeds[i] = random.nextLong();
        System.out.println("Seed [" + i + "] = " + seeds[i]);
    }
    for (long seed : seeds) futures.add(executorService.submit(new DataPropagationTask(seed)));
    for (Future<Void> future : futures) future.get();
    futures.clear();
    Thread.sleep(1500);
    copyDataFromTestWithoutClose();
    OStorage storage = baseDocumentTx.getStorage();
    baseDocumentTx.close();
    storage.close();
    testDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDir.getAbsolutePath() + "/testLocalPaginatedStorageRestoreFromWALAndAddAdditionalRecords");
    testDocumentTx.open("admin", "admin");
    testDocumentTx.close();
    long dataAddSeed = random.nextLong();
    System.out.println("Data add seed = " + dataAddSeed);
    for (int i = 0; i < 1; i++) futures.add(executorService.submit(new DataPropagationTask(dataAddSeed)));
    for (Future<Void> future : futures) future.get();
    ODatabaseCompare databaseCompare = new ODatabaseCompare(testDocumentTx.getURL(), baseDocumentTx.getURL(), "admin", "admin", new OCommandOutputListener() {

        @Override
        public void onMessage(String text) {
            System.out.println(text);
        }
    });
    databaseCompare.setCompareIndexMetadata(true);
    Assert.assertTrue(databaseCompare.compare());
}
Also used : ODatabaseCompare(com.orientechnologies.orient.core.db.tool.ODatabaseCompare) ArrayList(java.util.ArrayList) OStorage(com.orientechnologies.orient.core.storage.OStorage) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OIntentMassiveInsert(com.orientechnologies.orient.core.intent.OIntentMassiveInsert) Random(java.util.Random) Future(java.util.concurrent.Future) OCommandOutputListener(com.orientechnologies.orient.core.command.OCommandOutputListener)

Example 8 with OIntentMassiveInsert

use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.

the class OOrientDBLoader method beginLoader.

public void beginLoader(OETLPipeline pipeline) {
    synchronized (this) {
        ODatabaseDocument documentDatabase = null;
        OrientBaseGraph graphDatabase = null;
        final OrientGraphFactory factory = new OrientGraphFactory(dbURL, dbUser, dbPassword);
        graphDatabase = tx ? factory.getTx() : factory.getNoTx();
        graphDatabase.setUseLightweightEdges(useLightweightEdges);
        graphDatabase.setStandardElementConstraints(standardElementConstraints);
        documentDatabase = graphDatabase.getRawGraph();
        pipeline.setDocumentDatabase(documentDatabase);
        pipeline.setGraphDatabase(graphDatabase);
        createSchema(pipeline, documentDatabase);
        documentDatabase.getMetadata().getSchema().reload();
        documentDatabase.declareIntent(new OIntentMassiveInsert());
    }
}
Also used : ODatabaseDocument(com.orientechnologies.orient.core.db.document.ODatabaseDocument) OrientGraphFactory(com.tinkerpop.blueprints.impls.orient.OrientGraphFactory) OrientBaseGraph(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph) OIntentMassiveInsert(com.orientechnologies.orient.core.intent.OIntentMassiveInsert)

Example 9 with OIntentMassiveInsert

use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.

the class LocalCreateIndexedDocumentSpeedTest method init.

@Override
public void init() {
    Orient.instance().getProfiler().startRecording();
    database = new ODatabaseDocumentTx(System.getProperty("url")).open("admin", "admin");
    record = database.newInstance();
    // REMOVE THE INDEX
    System.out.println("Remove index...");
    database.getMetadata().getSchema().getClass("Profile").getProperty("nick").dropIndexes();
    System.out.println("Ok");
    database.declareIntent(new OIntentMassiveInsert());
    database.begin(TXTYPE.NOTX);
}
Also used : ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OIntentMassiveInsert(com.orientechnologies.orient.core.intent.OIntentMassiveInsert)

Example 10 with OIntentMassiveInsert

use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.

the class LocalCreateObjectSpeedTest method init.

@Override
public void init() {
    Orient.instance().getProfiler().startRecording();
    database = new OObjectDatabaseTx(System.getProperty("url")).open("admin", "admin");
    database.getEntityManager().registerEntityClass(Account.class);
    database.declareIntent(new OIntentMassiveInsert());
    database.begin(TXTYPE.NOTX);
}
Also used : OObjectDatabaseTx(com.orientechnologies.orient.object.db.OObjectDatabaseTx) OIntentMassiveInsert(com.orientechnologies.orient.core.intent.OIntentMassiveInsert)

Aggregations

OIntentMassiveInsert (com.orientechnologies.orient.core.intent.OIntentMassiveInsert)31 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)14 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)8 ArrayList (java.util.ArrayList)7 ORID (com.orientechnologies.orient.core.id.ORID)5 OrientMonoThreadTest (com.orientechnologies.orient.test.database.base.OrientMonoThreadTest)5 Test (org.junit.Test)5 Test (org.testng.annotations.Test)5 Future (java.util.concurrent.Future)4 OCommandOutputListener (com.orientechnologies.orient.core.command.OCommandOutputListener)3 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)3 ODatabaseCompare (com.orientechnologies.orient.core.db.tool.ODatabaseCompare)3 ORecordBytes (com.orientechnologies.orient.core.record.impl.ORecordBytes)3 OStorage (com.orientechnologies.orient.core.storage.OStorage)3 OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)3 OException (com.orientechnologies.common.exception.OException)2 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)2 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)2 ORidBag (com.orientechnologies.orient.core.db.record.ridbag.ORidBag)2 OCommandExecutionException (com.orientechnologies.orient.core.exception.OCommandExecutionException)2