Package com.taobao.metamorphosis.server.transaction.store.JournalTransactionStore

Examples of com.taobao.metamorphosis.server.transaction.store.JournalTransactionStore.Tx


        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);
        assertEquals(2, commands.length);
        store.flush();
        // ��û��д��
        assertEquals(0, store.getSizeInBytes());
View Full Code Here


        store = this.messageStoreManager.getOrCreateMessageStore("topic1", 2);
        // ȷ����Ϣû��д��
        assertEquals(0, store.getSizeInBytes());

        // ȷ��TX������
        final Tx tx1 = this.transactionStore.getInflyTx(xid1);
        assertNotNull(tx1);
        PutCommand[] commands = tx1.getRequests();
        assertNotNull(commands);
        assertEquals(2, commands.length);

        final Tx tx2 = this.transactionStore.getInflyTx(xid2);
        assertNotNull(tx2);
        commands = tx2.getRequests();
        assertNotNull(commands);
        assertEquals(1, commands.length);

        // recover�󣬶��ع���
        this.transactionStore.recover(null);
View Full Code Here

        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);
        assertEquals(2, commands.length);
        store.flush();
        // ��û��д��
        assertEquals(0, store.getSizeInBytes());
View Full Code Here

        assertEquals(0, store.getSizeInBytes());
        assertNull(this.transactionStore.getInflyTx(xid));
        // ��Ȼ����prepare״̬
        assertNotNull(this.transactionStore.getPreparedTx(xid));
        // ȷ�ϲ�������
        final Tx tx = this.transactionStore.getPreparedTx(xid);
        assertNotNull(tx);
        final PutCommand[] commands = tx.getRequests();
        assertNotNull(commands);
        assertEquals(2, commands.length);
        for (final PutCommand cmd : commands) {
            assertTrue(cmd.equals(cmd1) || cmd.equals(cmd2));
        }
View Full Code Here

            null);
        this.transactionStore.commit(xid3, false);

        // ����checkpoint��Ӧ��Ϊ����1
        final JournalLocation location = this.transactionStore.checkpoint();
        final Tx tx = this.transactionStore.getInflyTx(xid1);
        assertEquals(location, tx.getLocation());
    }
View Full Code Here

            case XA_PREPARE:
                this.transactionStore.replayPrepare(xid);
                break;
            case XA_COMMIT:
            case LOCAL_COMMIT:
                final Tx tx = this.transactionStore.replayCommit(xid, command.getWasPrepared());
                if (tx == null) {
                    break;
                }
                if (tx.getOperations().isEmpty()) {
                    break;
                }

                final Map<MessageStore, List<Long>> ids = tx.getMsgIds();
                final Map<MessageStore, List<PutCommand>> putCmds = tx.getPutCommands();
                // ��ȡ�������ݣ������Ϣ��λ����Ϣ
                final int attachmentLen = command.getDataLength();
                final ByteBuffer buf = ByteBuffer.allocate(attachmentLen);
                // �������ݵ�����λ�ã���㣫4���ֽڵ�cmd���ȣ�cmd������
                final long dataOffset = 4 + offset + cmdBufLen;
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.server.transaction.store.JournalTransactionStore.Tx

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.