Permalink
Browse files

code clean up

  • Loading branch information...
gegao committed Dec 31, 2013
1 parent 527f127 commit 5c09ba2b9e87600c5418a38850fc31a9583b4196
@@ -88,7 +88,6 @@
import edu.brown.hstore.Hstoreservice.Status;
import edu.brown.hstore.Hstoreservice.WorkFragment;
import edu.brown.hstore.callbacks.ClientResponseCallback;
import edu.brown.hstore.callbacks.JVMSnapshotTransactionCallback;
import edu.brown.hstore.callbacks.LocalFinishCallback;
import edu.brown.hstore.callbacks.LocalInitQueueCallback;
import edu.brown.hstore.callbacks.PartitionCountingCallback;
@@ -503,11 +502,8 @@ public void update(EventObservable<Pair<Thread, Throwable>> o, Pair<Thread, Thro
Throwable error = arg.getSecond();
String threadName = "<unknown>";
if (thread != null) threadName = thread.getName();
StringWriter errors = new StringWriter();
error.printStackTrace(new PrintWriter(errors));
LOG.fatal(String.format("Thread %s had a fatal error: %s",
threadName, (error != null ? error.getMessage() : null)));
LOG.info(errors.toString());
error.printStackTrace();
hstore_coordinator.shutdownClusterBlocking(error);
}
@@ -1102,7 +1102,7 @@ else if (hstore_conf.site.specexec_enable) {
// if (trace.val)
// LOG.trace(String.format("The %s for partition %s empty. Checking for utility work...",
// this.work_queue.getClass().getSimpleName(), this.partitionId));
if (this.utilityWork()) {
if (this.utilityWork()) {
nextWork = UTIL_WORK_MSG;
}
}
@@ -1141,7 +1141,7 @@ else if (hstore_conf.site.specexec_enable) {
* @return true if there is more utility work that can be done
*/
private boolean utilityWork() {
if (hstore_conf.site.exec_profiling) this.profiler.util_time.start();
if (hstore_conf.site.exec_profiling) this.profiler.util_time.start();
// -------------------------------
// Poll Lock Queue
// -------------------------------
@@ -1156,12 +1156,7 @@ private boolean utilityWork() {
// this.specExecScheduler.getClass().getSimpleName(),
// this.partitionId,
// (this.currentDtxn != null ? "blocked on " + this.currentDtxn : "idle")));
LOG.trace(String.format("Checking %s for something to do at partition %d while %s",
this.specExecScheduler.getClass().getSimpleName(),
this.partitionId,
(this.currentDtxn != null ? "blocked on " + this.currentDtxn : "idle")));
assert(hstore_conf.site.specexec_enable) :
assert(hstore_conf.site.specexec_enable) :
"Trying to schedule speculative txn even though it is disabled";
SpeculationType specType = this.calculateSpeculationType();
if (hstore_conf.site.exec_profiling) this.profiler.conflicts_time.start();
@@ -3800,7 +3795,7 @@ private void notifyDonePartitions(LocalTransaction ts, DonePartitionsNotificatio
if (notify != null && notify.hasSitesToNotify())
this.notifyDonePartitions(ts, notify);
}
// Attach the ParameterSets to our transaction handle so that anybody on this HStoreSite
// can access them directly without needing to deserialize them from the WorkFragments
ts.attachParameterSets(batchParams);
@@ -3879,11 +3874,13 @@ private void notifyDonePartitions(LocalTransaction ts, DonePartitionsNotificatio
ts, this.partitionId));
break;
}
this.tmp_localWorkFragmentBuilders.clear();
if (predict_singlePartition == false) {
this.tmp_remoteFragmentBuilders.clear();
this.tmp_localSiteFragmentBuilders.clear();
}
// -------------------------------
// FAST PATH: Assume everything is local
// -------------------------------
@@ -4067,10 +4064,7 @@ private void notifyDonePartitions(LocalTransaction ts, DonePartitionsNotificatio
first = false;
} // WHILE
if (hstore_site.getJvmSnapshotManager().isParent())
this.fs.getBBContainer().discard();
// LOG.info(String.format("%s - BREAK OUT [first=%s, stillHasWorkFragments=%s, latch=%s]",
// ts, first, this.depTracker.stillHasWorkFragments(ts), latch));
//
this.fs.getBBContainer().discard();
if (trace.val)
LOG.trace(String.format("%s - BREAK OUT [first=%s, stillHasWorkFragments=%s, latch=%s]",
ts, first, this.depTracker.stillHasWorkFragments(ts), latch));
@@ -151,7 +151,7 @@ public AbstractTransaction poll() {
this.lock.lock();
try {
if (this.state == QueueState.BLOCKED_SAFETY || this.state == QueueState.BLOCKED_ORDERING) {
this.checkQueueState(false);
this.checkQueueState(false);
}
if (this.state == QueueState.UNBLOCKED) {
@@ -366,7 +366,6 @@ public boolean remove(Object obj) {
if (trace.val)
LOG.trace(String.format("Partition %d :: Attempting to acquire lock", this.partitionId));
this.lock.lock();
try {
// We have to check whether we are the first txn in the queue,
// because we will need to reset the blockTimestamp after
@@ -398,9 +397,6 @@ public Long noteTransactionRecievedAndReturnLastSafeTxnId(Long txnId) {
if (debug.val)
LOG.debug(String.format("Partition %d :: noteTransactionRecievedAndReturnLastSeen(%d)",
this.partitionId, txnId));
if (debug.val)
LOG.debug("txnId: "+txnId + " lastTxnPopped:" + lastTxnPopped + " lastSafeTxnId:"+lastSafeTxnId);
this.lastSeenTxnId = txnId;
if (trace.val) {
@@ -487,9 +483,7 @@ private QueueState checkQueueState(boolean afterRemoval) {
// that the lastSafeTxnId has been polled. That means that we need to
// wait for an appropriate amount of time before we're allow to be executed.
if (this.lastSafeTxnId != -1 && txnId.compareTo(this.lastSafeTxnId) > 0 && afterRemoval == false) {
LOG.debug(String.format("Partition %d :: txnId[%d] ==> %s (blockTime=%d)",
this.partitionId, txnId, newState, this.blockTimestamp));
newState = QueueState.BLOCKED_ORDERING;
newState = QueueState.BLOCKED_ORDERING;
if (debug.val)
LOG.debug(String.format("Partition %d :: txnId[%d] > lastSafeTxnId[%d]",
this.partitionId, txnId, this.lastSafeTxnId));
@@ -586,8 +580,6 @@ else if (newState == QueueState.UNBLOCKED) {
// Set the new state
if (newState != this.state) {
// LOG.info(String.format("Partition %d :: ORIG[%s]->NEW[%s] / LastSafeTxn:%d",
// this.partitionId, this.state, newState, this.lastSafeTxnId));
if (trace.val)
LOG.trace(String.format("Partition %d :: ORIG[%s]->NEW[%s] / LastSafeTxn:%d",
this.partitionId, this.state, newState, this.lastSafeTxnId));
@@ -618,7 +610,6 @@ else if (this.profiler != null) {
assert(this.state != QueueState.BLOCKED_ORDERING ||
(this.state == QueueState.BLOCKED_ORDERING && this.blockTimestamp != NULL_BLOCK_TIMESTAMP)) :
String.format("Invalid state %s with NULL blocked timestamp", this.state);
return this.state;
}
Oops, something went wrong.

0 comments on commit 5c09ba2

Please sign in to comment.