Updated Branches: refs/heads/trunk 42dc743d6 -> 2dcbf0673
switch Paxos debug logging to Tracing Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2dcbf067 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2dcbf067 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2dcbf067 Branch: refs/heads/trunk Commit: 2dcbf0673e01e0977bf18814dc99d93b63b2a2be Parents: 42dc743 Author: Jonathan Ellis <[email protected]> Authored: Tue May 14 15:30:38 2013 -0500 Committer: Jonathan Ellis <[email protected]> Committed: Tue May 14 15:30:56 2013 -0500 ---------------------------------------------------------------------- .../org/apache/cassandra/service/StorageProxy.java | 18 +++++++------- .../apache/cassandra/service/paxos/PaxosState.java | 9 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/2dcbf067/src/java/org/apache/cassandra/service/StorageProxy.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 696569c..f170039 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -213,7 +213,7 @@ public class StorageProxy implements StorageProxyMBean continue; // read the current value and compare with expected - logger.debug("Reading existing values for CAS precondition"); + Tracing.trace("Reading existing values for CAS precondition"); ReadCommand readCommand = expected == null ? new SliceFromReadCommand(table, key, cfName, new SliceQueryFilter(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 1)) : new SliceByNamesReadCommand(table, key, cfName, new NamesQueryFilter(ImmutableSortedSet.copyOf(expected.getColumnNames()))); @@ -221,22 +221,22 @@ public class StorageProxy implements StorageProxyMBean ColumnFamily current = rows.get(0).cf; if (!casApplies(expected, current)) { - logger.debug("CAS precondition {} does not match current values {}", expected, current); + Tracing.trace("CAS precondition {} does not match current values {}", expected, current); return false; } // finish the paxos round w/ the desired updates // TODO turn null updates into delete? Commit proposal = Commit.newProposal(key, ballot, updates); - logger.debug("CAS precondition is met; proposing client-requested updates for {}", ballot); + Tracing.trace("CAS precondition is met; proposing client-requested updates for {}", ballot); if (proposePaxos(proposal, liveEndpoints, requiredParticipants)) { commitPaxos(proposal, liveEndpoints); - logger.debug("Paxos CAS successful"); + Tracing.trace("CAS successful"); return true; } - logger.debug("Paxos proposal not accepted (pre-empted by a higher ballot)"); + Tracing.trace("Paxos proposal not accepted (pre-empted by a higher ballot)"); Uninterruptibles.sleepUninterruptibly(FBUtilities.threadLocalRandom().nextInt(100), TimeUnit.MILLISECONDS); // continue to retry } @@ -301,12 +301,12 @@ public class StorageProxy implements StorageProxyMBean UUID ballot = UUIDGen.getTimeUUID(); // prepare - logger.debug("Preparing {}", ballot); + Tracing.trace("Preparing {}", ballot); Commit toPrepare = Commit.newPrepare(key, metadata, ballot); PrepareCallback summary = preparePaxos(toPrepare, liveEndpoints, requiredParticipants); if (!summary.promised) { - logger.debug("Some replicas have already promised a higher ballot than ours; aborting"); + Tracing.trace("Some replicas have already promised a higher ballot than ours; aborting"); // sleep a random amount to give the other proposer a chance to finish Uninterruptibles.sleepUninterruptibly(FBUtilities.threadLocalRandom().nextInt(100), TimeUnit.MILLISECONDS); return null; @@ -319,7 +319,7 @@ public class StorageProxy implements StorageProxyMBean // needs to be completed, so do it. if (!inProgress.update.isEmpty() && inProgress.isAfter(mostRecent)) { - logger.debug("Finishing incomplete paxos round {}", inProgress); + Tracing.trace("Finishing incomplete paxos round {}", inProgress); if (proposePaxos(inProgress, liveEndpoints, requiredParticipants)) commitPaxos(inProgress, liveEndpoints); // no need to sleep here @@ -333,7 +333,7 @@ public class StorageProxy implements StorageProxyMBean Iterable<InetAddress> missingMRC = summary.replicasMissingMostRecentCommit(); if (Iterables.size(missingMRC) > 0) { - logger.debug("Repairing replicas that missed the most recent commit"); + Tracing.trace("Repairing replicas that missed the most recent commit"); commitPaxos(mostRecent, missingMRC); // TODO: provided commits don't invalid the prepare we just did above (which they don't), we could just wait // for all the missingMRC to acknowledge this commit and then move on with proposing our value. But that means http://git-wip-us.apache.org/repos/asf/cassandra/blob/2dcbf067/src/java/org/apache/cassandra/service/paxos/PaxosState.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/paxos/PaxosState.java b/src/java/org/apache/cassandra/service/paxos/PaxosState.java index 597036a..d46c851 100644 --- a/src/java/org/apache/cassandra/service/paxos/PaxosState.java +++ b/src/java/org/apache/cassandra/service/paxos/PaxosState.java @@ -9,6 +9,7 @@ import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.db.RowMutation; import org.apache.cassandra.db.SystemTable; import org.apache.cassandra.db.Table; +import org.apache.cassandra.tracing.Tracing; public class PaxosState { @@ -50,14 +51,14 @@ public class PaxosState PaxosState state = SystemTable.loadPaxosState(toPrepare.key, toPrepare.update.metadata()); if (toPrepare.isAfter(state.inProgressCommit)) { - logger.debug("promising ballot {}", toPrepare.ballot); + Tracing.trace("promising ballot {}", toPrepare.ballot); SystemTable.savePaxosPromise(toPrepare); // return the pre-promise ballot so coordinator can pick the most recent in-progress value to resume return new PrepareResponse(true, state.inProgressCommit, state.mostRecentCommit); } else { - logger.debug("promise rejected; {} is not sufficiently newer than {}", toPrepare, state.inProgressCommit); + Tracing.trace("promise rejected; {} is not sufficiently newer than {}", toPrepare, state.inProgressCommit); return new PrepareResponse(false, state.inProgressCommit, state.mostRecentCommit); } } @@ -70,7 +71,7 @@ public class PaxosState PaxosState state = SystemTable.loadPaxosState(proposal.key, proposal.update.metadata()); if (proposal.hasBallot(state.inProgressCommit.ballot) || proposal.isAfter(state.inProgressCommit)) { - logger.debug("accepting {}", proposal); + Tracing.trace("accepting proposal {}", proposal); SystemTable.savePaxosProposal(proposal); return true; } @@ -87,7 +88,7 @@ public class PaxosState // Committing it is however always safe due to column timestamps, so always do it. However, // if our current in-progress ballot is strictly greater than the proposal one, we shouldn't // erase the in-progress update. - logger.debug("committing {}", proposal); + Tracing.trace("committing proposal {}", proposal); RowMutation rm = proposal.makeMutation(); Table.open(rm.getTable()).apply(rm, true);
