use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class TestTransControl method queueBatchSize_03.
@Test
public void queueBatchSize_03() {
TransactionManager.QueueBatchSize = 2;
DatasetGraph dsg = create();
TransactionManager tMgr = TDBInternal.getTransactionManager(dsg);
txnAddData(dsg);
assertEquals(1, tMgr.getQueueLength());
txnAddData(dsg);
assertEquals(2, tMgr.getQueueLength());
txnAddData(dsg);
assertEquals(0, tMgr.getQueueLength());
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class TestTransControl method journalThresholdSize_03.
// Intermediate flush journal size.
@Test
public void journalThresholdSize_03() {
TransactionManager.QueueBatchSize = 100;
TransactionManager.MaxQueueThreshold = -1;
// More than commit size, less than block.
TransactionManager.JournalThresholdSize = 1000;
DatasetGraph dsg = create();
TransactionManager tMgr = TDBInternal.getTransactionManager(dsg);
// About 20 bytes.
Txn.executeWrite(dsg, () -> {
});
assertEquals(1, tMgr.getQueueLength());
txnAddData(dsg);
assertEquals(0, tMgr.getQueueLength());
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_01.
@Test
public void trans_readBlock_01() {
// READ(start)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
dsgW.add(q);
dsgW.commit();
dsgW.end();
assertFalse(dsgR1.contains(q));
dsgR1.end();
//**** Not hitting the queue ****
// Order of tweaking counters?
// also writer and counters?
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_03.
@Test
public void trans_readBlock_03() {
// READ(start)-WRITE(commit)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
assertFalse(dsgR1.contains(q1));
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
assertFalse(dsgR1.contains(q1));
assertFalse(dsgR1.contains(q2));
dsgR1.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q1));
assertTrue(dsgR2.contains(q2));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_09.
@Test
public void trans_readBlock_09() {
// WRITE(commit)-READ(start)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR1.contains(q1));
assertFalse(dsgR1.contains(q2));
assertTrue(dsgR2.contains(q1));
assertTrue(dsgR2.contains(q2));
dsgR1.end();
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
}
Aggregations