use of com.orientechnologies.orient.core.storage.OStorage 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());
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OStorageLocalTest method withLegacyPath.
public void withLegacyPath() {
String dbPath = getDatabasePath();
System.out.println("Using db = plocal:" + dbPath);
File dbDir = new File(dbPath);
System.out.println("Clean db directory for test...");
delTree(dbDir);
ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:" + dbPath);
db.create();
OStorage storage = db.getStorage();
db.close();
storage.close(true, false);
System.out.println("Reopen it...");
// Something was added to dbPath so the legacy situation was simulated
dbPath += "/foo";
db = new ODatabaseDocumentTx("plocal:" + dbPath).open("admin", "admin");
db.drop();
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OStorageLocalTest method withNormalPath.
public void withNormalPath() {
String dbPath = getDatabasePath();
System.out.println("Using db = plocal:" + dbPath);
File dbDir = new File(dbPath);
System.out.println("Clean db directory for test...");
delTree(dbDir);
ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:" + dbPath);
db.create();
OStorage storage = db.getStorage();
db.close();
storage.close(true, false);
System.out.println("Reopen it...");
db = new ODatabaseDocumentTx("plocal:" + dbPath).open("admin", "admin");
db.drop();
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class ClusterDebugInfoTest method testOnePageRecordDebugInfo.
@Test
public void testOnePageRecordDebugInfo() throws IOException {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:ClusterDebugInfoTest");
db.create();
try {
OStorage storage = db.getStorage();
int defaultId = storage.getDefaultClusterId();
OPaginatedCluster cluster = (OPaginatedCluster) storage.getClusterById(defaultId);
int size = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger();
int half = size / 2;
byte[] content = new byte[half * 1024];
OStorageOperationResult<OPhysicalPosition> result = storage.createRecord(new ORecordId(defaultId), content, 0, (byte) 'b', OPERATION_MODE.SYNCHRONOUS.ordinal(), null);
OPaginatedClusterDebug debug = cluster.readDebug(result.getResult().clusterPosition);
Assert.assertEquals(debug.clusterPosition, result.getResult().clusterPosition);
Assert.assertNotEquals(debug.contentSize, 0);
Assert.assertFalse(debug.empty);
Assert.assertEquals(debug.pages.size(), 1);
Assert.assertNotEquals(debug.pages.get(0).pageIndex, -1);
Assert.assertNotEquals(debug.pages.get(0).inPagePosition, -1);
Assert.assertNotEquals(debug.pages.get(0).inPageSize, -1);
Assert.assertNotNull(debug.pages.get(0).content);
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class ClusterDebugInfoTest method testTwoPagesRecordDebugInfo.
@Test
public void testTwoPagesRecordDebugInfo() throws IOException {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:ClusterDebugInfoTest");
db.create();
try {
OStorage storage = db.getStorage();
int defaultId = storage.getDefaultClusterId();
OPaginatedCluster cluster = (OPaginatedCluster) storage.getClusterById(defaultId);
int size = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger();
int half = size / 2;
byte[] content = new byte[(size + half) * 1024];
OStorageOperationResult<OPhysicalPosition> result = storage.createRecord(new ORecordId(defaultId), content, 0, (byte) 'b', OPERATION_MODE.SYNCHRONOUS.ordinal(), null);
OPaginatedClusterDebug debug = cluster.readDebug(result.getResult().clusterPosition);
Assert.assertEquals(debug.pages.size(), 2);
Assert.assertEquals(debug.clusterPosition, result.getResult().clusterPosition);
Assert.assertNotEquals(debug.contentSize, 0);
Assert.assertFalse(debug.empty);
Assert.assertNotEquals(debug.pages.get(0).pageIndex, -1);
Assert.assertNotEquals(debug.pages.get(0).inPagePosition, -1);
Assert.assertNotEquals(debug.pages.get(0).inPageSize, -1);
Assert.assertNotNull(debug.pages.get(0).content);
Assert.assertNotEquals(debug.pages.get(1).pageIndex, -1);
Assert.assertNotEquals(debug.pages.get(1).inPagePosition, -1);
Assert.assertNotEquals(debug.pages.get(1).inPageSize, -1);
Assert.assertNotNull(debug.pages.get(1).content);
} finally {
db.drop();
}
}
Aggregations