/** * displays entries in the activeTx table. * <p>useful for debug. */ public void activeTxDisplay() { for (int i=0; i < activeTx.length; ++i) { if (activeTx[i] == null) continue; synchronized(activeTx) { XACommittingTx tx = activeTx[i]; byte[][] record = tx.getRecord(); System.out.println("activeTx[" + i + "] key=" + Long.toHexString(tx.getLogKey()) + "\n Fields: " + record.length ); for (int j = 0; j < record.length; ++j) { byte[] field = record[j]; System.out.println(" [" + j + "] len=" + field.length + ": " + new String(field)); } } } }
newAvailableTx[i] = new XACommittingTx(i);
TraceTm.recovery.debug("Wrote UniqueIDRecord; at:" + LogId.getLogKey() + " uuid0:" + uuid0 + " uuid1:" + uuid1);
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }
TraceTm.recovery.debug("Wrote UniqueIDRecord; at:" + LogId.getLogKey() + " uuid0:" + uuid0 + " uuid1:" + uuid1);
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }
/** * displays entries in the activeTx table. * <p>useful for debug. */ public void activeTxDisplay() { for (int i=0; i < activeTx.length; ++i) { if (activeTx[i] == null) continue; synchronized(activeTx) { XACommittingTx tx = activeTx[i]; byte[][] record = tx.getRecord(); System.out.println("activeTx[" + i + "] key=" + Long.toHexString(tx.getLogKey()) + "\n Fields: " + record.length ); for (int j = 0; j < record.length; ++j) { byte[] field = record[j]; System.out.println(" [" + j + "] len=" + field.length + ": " + new String(field)); } } } }
public void close() throws IOException, InterruptedException { if (isClosed) return; long newMark = Long.MAX_VALUE; XACommittingTx tx = null; // set new log mark at oldest activeTx entry synchronized(activeTxLock) { for (int i=0; i < activeTx.length; ++i) { tx = activeTx[i]; if (tx == null) continue; long key = tx.getLogKey(); if (key < newMark) newMark = key; } if (newMark < Long.MAX_VALUE) { try { this.mark(newMark, true); } catch (InvalidLogKeyException e) { // will not happen } catch (LogClosedException e) { // will not happen } } } super.close(); }
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }