Package edu.brown.hstore.txns

Examples of edu.brown.hstore.txns.LocalTransaction


    public void testWithGroupCommit() throws Exception {
        // Write out a new txn invocation to the log
        int num_txns = 1000;
        long txnId[] = new long[num_txns];
        for (int i = 0; i < num_txns; i++) {
            LocalTransaction ts = new LocalTransaction(hstore_site);
            txnId[i] = TXN_ID.incrementAndGet();
            ts.testInit(txnId[i],
                        BASE_PARTITION,
                        new PartitionSet(BASE_PARTITION),
                        catalog_procs[i % 2],
                        TARGET_PARAMS[i % 2]);
           
View Full Code Here


        this.addPartitions(NUM_PARTITIONS);
       
        this.hstore_site = new MockHStoreSite(0, catalogContext, HStoreConf.singleton());
        this.catalog_proc = this.getProcedure(UpdateLocation.class);
       
        this.ts0 = new LocalTransaction(this.hstore_site);
        this.ts0.testInit(NEXT_TXN_ID++, BASE_PARTITION, null, catalogContext.getAllPartitionIds(), catalog_proc);
       
        this.ts1 = new LocalTransaction(this.hstore_site);
        this.ts1.testInit(NEXT_TXN_ID++, BASE_PARTITION, null, new PartitionSet(BASE_PARTITION), catalog_proc);
       
        // Initialize some messages that we can use
        this.utilMsg = new UtilityWorkMessage();
        this.startMsg = new StartTxnMessage(ts1);
View Full Code Here

                                 params);
        this.plan.getWorkFragmentsBuilders(TXN_ID, stmtCounters, ftasks);
        assertFalse(ftasks.isEmpty());
        assertNotNull(ftasks);
       
        this.ts = new LocalTransaction(hstore_site);
        this.ts.testInit(TXN_ID,
                         LOCAL_PARTITION,
                         null,
                         catalogContext.getAllPartitionIds(),
                         this.getProcedure(TARGET_PROCEDURE));
View Full Code Here

    // --------------------------------------------------------------------------------------------
    // UTILITY METHODS
    // --------------------------------------------------------------------------------------------
   
    private LocalTransaction createTransaction(Long txn_id, PartitionSet partitions, final MockCallback callback) {
        LocalTransaction ts = new LocalTransaction(this.hstore_site) {
            @Override
            public MockCallback getInitCallback() {
                return (callback);
            }
        };
        Procedure catalog_proc = this.getProcedure(TARGET_PROCEDURE);
        ts.testInit(txn_id, 0, partitions, catalog_proc);
        callback.init(ts, partitions);
        this.txns.put(txn_id, ts);
        return (ts);
    }
View Full Code Here

     */
    @Test
    public void testSingleTransaction() throws InterruptedException {
        Long txn_id = this.idManager.getNextUniqueTransactionId();
        MockCallback inner_callback = new MockCallback();
        LocalTransaction txn0 = this.createTransaction(txn_id, catalogContext.getAllPartitionIds(), inner_callback);
       
        // Insert the txn into our queue and then call check
        // This should immediately release our transaction and invoke the inner_callback
        boolean result = this.addToQueue(txn0, inner_callback);
        assertTrue(result);
View Full Code Here

        final PartitionSet partitions1 = catalogContext.getAllPartitionIds();
        final PartitionSet partitions2 = catalogContext.getAllPartitionIds();
        final MockCallback inner_callback0 = new MockCallback();
        final MockCallback inner_callback1 = new MockCallback();
        final MockCallback inner_callback2 = new MockCallback();
        final LocalTransaction txn0 = this.createTransaction(txn_id0, partitions0, inner_callback0);
        final LocalTransaction txn1 = this.createTransaction(txn_id1, partitions1, inner_callback1);
        final LocalTransaction txn2 = this.createTransaction(txn_id2, partitions2, inner_callback2);
       
        System.err.println("TXN0: " + txn0);
        System.err.println("TXN1: " + txn1);
        System.err.println("TXN2: " + txn2);
        System.err.flush();
View Full Code Here

        final PartitionSet partitions1 = new PartitionSet(1, 3);
        final PartitionSet partitions2 = catalogContext.getAllPartitionIds();
        final MockCallback inner_callback0 = new MockCallback();
        final MockCallback inner_callback1 = new MockCallback();
        final MockCallback inner_callback2 = new MockCallback();
        final LocalTransaction txn0 = this.createTransaction(txn_id0, partitions0, inner_callback0);
        final LocalTransaction txn1 = this.createTransaction(txn_id1, partitions1, inner_callback1);
        final LocalTransaction txn2 = this.createTransaction(txn_id2, partitions2, inner_callback2);
       
        assert(txn_id0 < txn_id1);
        assert(txn_id1 < txn_id2);
       
        System.err.println("txn_id0: " + txn_id0);
View Full Code Here

        final Long txn_id1 = this.idManager.getNextUniqueTransactionId();
        final PartitionSet partitions0 = new PartitionSet(0, 1, 2);
        final PartitionSet partitions1 = new PartitionSet(2, 3);
        final MockCallback inner_callback0 = new MockCallback();
        final MockCallback inner_callback1 = new MockCallback();
        final LocalTransaction txn0 = this.createTransaction(txn_id0, partitions0, inner_callback0);
        final LocalTransaction txn1 = this.createTransaction(txn_id1, partitions1, inner_callback1);
     
        System.err.println("txn_id0: " + txn_id0);
        System.err.println("txn_id1: " + txn_id1);
        System.err.flush();
       
View Full Code Here

        TestSmallBankSuite.initializeSmallBankDatabase(catalogContext, this.client);
       
        BlockingSendPayment voltProc = this.startTxn();
        Long txnId = voltProc.getTransactionId();
        assertNotNull(txnId);
        LocalTransaction ts = hstore_site.getTransaction(txnId);
        assertNotNull(ts);
       
        Set<String> expectedTables = new HashSet<String>();
        for (Table tbl : catalogContext.database.getTables()) {
            if (ts.isTableRead(BASE_PARTITION, tbl)) {
                expectedTables.add(tbl.getName());
            }
        } // FOR
       
        // Let's take a peek at its ReadSet
View Full Code Here

        TestSmallBankSuite.initializeSmallBankDatabase(catalogContext, this.client);
       
        BlockingSendPayment voltProc = this.startTxn();
        Long txnId = voltProc.getTransactionId();
        assertNotNull(txnId);
        LocalTransaction ts = hstore_site.getTransaction(txnId);
        assertNotNull(ts);
       
        Set<String> expectedTables = new HashSet<String>();
        for (Table tbl : catalogContext.database.getTables()) {
            if (ts.isTableWritten(BASE_PARTITION, tbl)) {
                expectedTables.add(tbl.getName());
            }
        } // FOR
       
        // Let's take a peek at its WriteSet
View Full Code Here

TOP

Related Classes of edu.brown.hstore.txns.LocalTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.