Examples of PutCommand


Examples of com.taobao.metamorphosis.network.PutCommand

        final Transaction tx = this.processor.getTransaction(context, xid);
        assertNotNull(tx);
        assertSame(xid, tx.getTransactionId());
        this.replay();

        this.processor.processPutCommand(new PutCommand("topic1", 2, "hello".getBytes(), xid, 0, 1), context, null);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        store.flush();
        assertEquals(0, store.getSizeInBytes());

        // prepare
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

        final Transaction tx = this.processor.getTransaction(context, xid);
        assertNotNull(tx);
        assertSame(xid, tx.getTransactionId());
        this.replay();

        this.processor.processPutCommand(new PutCommand("topic1", 2, "hello".getBytes(), xid, 0, 1), context, null);
        final MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        store.flush();
        assertEquals(0, store.getSizeInBytes());

        // prepare
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddRollBackCloseRecover() throws Exception {
        final LocalTransactionId xid = new LocalTransactionId("test", 1);
        final MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid, 0, 1), null);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg2".getBytes(), xid, 0, 2), null);

        final Tx tx = this.transactionStore.getInflyTx(xid);
        assertNotNull(tx);
        final PutCommand[] commands = tx.getRequests();
        assertNotNull(commands);
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddCloseRecover() throws Exception {
        final LocalTransactionId xid1 = new LocalTransactionId("test", 1);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid1, 0, 1), null);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg2".getBytes(), xid1, 0, 2), null);

        final LocalTransactionId xid2 = new LocalTransactionId("test", 2);
        store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid2, 0, 1), null);

        this.tearDown();
        this.init(this.path);
        assertTrue(this.journalStore.getCurrDataFile().getLength() > 0);
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddCommitCloseRecover() throws Exception {
        final LocalTransactionId xid = new LocalTransactionId("test", 1);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid, 0, 1), null);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg2".getBytes(), xid, 0, 2), null);

        final Tx tx = this.transactionStore.getInflyTx(xid);
        assertNotNull(tx);
        final PutCommand[] commands = tx.getRequests();
        assertNotNull(commands);
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddPrepareCommitCloseRecover() throws Exception {
        final XATransactionId xid = XIDGenerator.createXID(99);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid, 0, 1), null);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg2".getBytes(), xid, 0, 2), null);
        assertNotNull(this.transactionStore.getInflyTx(xid));
        assertNull(this.transactionStore.getPreparedTx(xid));
        // prepare
        this.transactionStore.prepare(xid);
        assertNull(this.transactionStore.getInflyTx(xid));
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddPrepareRollbackCloseRecover() throws Exception {
        final XATransactionId xid = XIDGenerator.createXID(99);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg1".getBytes(), xid, 0, 1), null);
        this.transactionStore.addMessage(store, 1, new PutCommand("topic1", 2, "msg2".getBytes(), xid, 0, 2), null);
        assertNotNull(this.transactionStore.getInflyTx(xid));
        assertNull(this.transactionStore.getPreparedTx(xid));
        // prepare
        this.transactionStore.prepare(xid);
        assertNull(this.transactionStore.getInflyTx(xid));
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testAddAddPrepareCloseRecover() throws Exception {
        final XATransactionId xid = XIDGenerator.createXID(99);
        MessageStore store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        final PutCommand cmd1 = new PutCommand("topic1", 2, "msg1".getBytes(), xid, 0, 1);
        this.transactionStore.addMessage(store, 1, cmd1, null);
        final PutCommand cmd2 = new PutCommand("topic1", 2, "msg2".getBytes(), xid, 0, 2);
        this.transactionStore.addMessage(store, 1, cmd2, null);

        // prepare
        this.transactionStore.prepare(xid);
        assertNull(this.transactionStore.getInflyTx(xid));
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

    @Test
    public void testCheckpoint() throws Exception {
        // ����1
        final LocalTransactionId xid1 = new LocalTransactionId("session1", 1);
        final MessageStore store1 = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        this.transactionStore.addMessage(store1, 1, new PutCommand("topic1", 2, ("msg" + 2).getBytes(), xid1, 0, 1),
            null);

        // ����2
        final LocalTransactionId xid2 = new LocalTransactionId("session2", 1);
        final MessageStore store2 = this.messageStoreManager.getOrCreateMessageStore("topic1", 3);
        this.transactionStore.addMessage(store2, 1, new PutCommand("topic1", 3, ("msg" + 3).getBytes(), xid2, 0, 1),
            null);

        // ����3���Ѿ��ύ
        final LocalTransactionId xid3 = new LocalTransactionId("session3", 1);
        final MessageStore store3 = this.messageStoreManager.getOrCreateMessageStore("topic1", 0);
        this.transactionStore.addMessage(store3, 1, new PutCommand("topic1", 0, ("msg" + 0).getBytes(), xid3, 0, 1),
            null);
        this.transactionStore.commit(xid3, false);

        // ����checkpoint��Ӧ��Ϊ����1
        final JournalLocation location = this.transactionStore.checkpoint();
View Full Code Here

Examples of com.taobao.metamorphosis.network.PutCommand

                for (int j = 0; j < rand.nextInt(3) + 1; j++) {
                    final int partition = rand.nextInt(10);
                    final MessageStore store =
                            JournalTransactionStoreUnitTest.this.messageStoreManager.getOrCreateMessageStore("topic1",
                                partition % 10);
                    JournalTransactionStoreUnitTest.this.transactionStore.addMessage(store, 1, new PutCommand("topic1",
                        partition, ("msg" + id).getBytes(), xid, 0, 1), null);
                }
                if (id % 100 == 0) {
                    JournalTransactionStoreUnitTest.this.journalStore.checkpoint();
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.