Search in sources :

Example 86 with ODatabaseDocumentTx

use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.

the class OSchemaBlogClustersEmbeddedTest method before.

@Before
public void before() {
    db = new ODatabaseDocumentTx("memory:" + OSchemaBlogClustersEmbeddedTest.class.getSimpleName());
    db.create();
}
Also used : ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) Before(org.junit.Before)

Example 87 with ODatabaseDocumentTx

use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.

the class AlterSuperclassTest method before.

@BeforeMethod
public void before() {
    db = new ODatabaseDocumentTx("memory:" + AlterSuperclassTest.class.getSimpleName());
    db.create();
}
Also used : ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 88 with ODatabaseDocumentTx

use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.

the class DefaultValueTest method before.

@Before
public void before() {
    database = new ODatabaseDocumentTx("memory:" + DefaultValueTest.class.getSimpleName());
    database.create();
}
Also used : ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) Before(org.junit.Before)

Example 89 with ODatabaseDocumentTx

use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.

the class ODistributedStorage method getAsyncReplicationError.

protected OAsyncReplicationError getAsyncReplicationError() {
    if (OExecutionThreadLocal.INSTANCE.get().onAsyncReplicationError != null) {
        final OAsyncReplicationError subCallback = OExecutionThreadLocal.INSTANCE.get().onAsyncReplicationError;
        final ODatabaseDocumentTx currentDatabase = (ODatabaseDocumentTx) ODatabaseRecordThreadLocal.INSTANCE.get();
        final ODatabaseDocumentTx copyDatabase = currentDatabase.copy();
        currentDatabase.activateOnCurrentThread();
        return new OAsyncReplicationError() {

            @Override
            public ACTION onAsyncReplicationError(final Throwable iException, final int iRetry) {
                copyDatabase.activateOnCurrentThread();
                switch(subCallback.onAsyncReplicationError(iException, iRetry)) {
                    case RETRY:
                        break;
                    case IGNORE:
                }
                return OAsyncReplicationError.ACTION.IGNORE;
            }
        };
    } else
        return null;
}
Also used : OAsyncReplicationError(com.orientechnologies.orient.core.replication.OAsyncReplicationError) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)

Example 90 with ODatabaseDocumentTx

use of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx in project orientdb by orientechnologies.

the class OConflictResolverDatabaseRepairer method check.

private void check() throws Exception {
    // OPEN THE DATABASE ONLY IF NEEDED
    ODatabaseDocumentTx db = null;
    try {
        final int batchMax = OGlobalConfiguration.DISTRIBUTED_CONFLICT_RESOLVER_REPAIRER_BATCH.getValueAsInteger();
        final List<ORecordId> rids = new ArrayList<ORecordId>(batchMax);
        // REPAIR CLUSTER FIRST
        for (Integer clusterId : clusters.keySet()) {
        //repairCluster(db, clusterId);
        }
        clusters.clear();
        // REPAIR RECORDS
        for (ORecordId rid : records.keySet()) {
            rids.add(rid);
            if (rids.size() >= batchMax)
                // REACHED MAXIMUM FOR BATCH
                break;
        }
        if (!rids.isEmpty()) {
            // REPAIR RECORDS IN BATCH
            db = getDatabase();
            if (repairRecords(db, rids)) {
                // SUCCEED: REMOVE REPAIRED RECORDS
                for (ORecordId rid : rids) records.remove(rid);
            }
        }
    } finally {
        if (db != null)
            db.close();
    }
}
Also used : ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) ORecordId(com.orientechnologies.orient.core.id.ORecordId)

Aggregations

ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)590 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)257 Test (org.testng.annotations.Test)182 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)120 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)81 Test (org.junit.Test)79 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)61 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)47 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)46 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)41 ORID (com.orientechnologies.orient.core.id.ORID)39 ORecordId (com.orientechnologies.orient.core.id.ORecordId)34 Before (org.junit.Before)34 File (java.io.File)33 OProperty (com.orientechnologies.orient.core.metadata.schema.OProperty)25 ArrayList (java.util.ArrayList)25 BeforeClass (org.testng.annotations.BeforeClass)23 BeforeMethod (org.testng.annotations.BeforeMethod)23 OStorage (com.orientechnologies.orient.core.storage.OStorage)21 List (java.util.List)20