Skip to content

Commit

Permalink
HBASE-24181 Add region info when log meessages in HRegion. (#1506)
Browse files Browse the repository at this point in the history
Signed-off-by: Reid Chan <[email protected]>
Signed-off-by: Jan Hentschel <[email protected]>
  • Loading branch information
binlijin committed Apr 14, 2020
1 parent 0444666 commit a33e4d2
Showing 1 changed file with 43 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ public HStore call() throws IOException {
try {
store.close();
} catch (IOException e) {
LOG.warn("close store failed", e);
LOG.warn("close store {} failed in region {}", store.toString(), this, e);
}
}
}
Expand Down Expand Up @@ -1750,7 +1750,7 @@ public Pair<byte[], Collection<HStoreFile>> call() throws IOException {
if (!canFlush) {
decrMemStoreSize(this.memStoreSizing.getMemStoreSize());
} else if (this.memStoreSizing.getDataSize() != 0) {
LOG.error("Memstore data size is {}", this.memStoreSizing.getDataSize());
LOG.error("Memstore data size is {} in region {}", this.memStoreSizing.getDataSize(), this);
}
if (coprocessorHost != null) {
status.setStatus("Running coprocessor post-close hooks");
Expand Down Expand Up @@ -1789,7 +1789,7 @@ public void waitForFlushesAndCompactions() {
writestate.wait();
} catch (InterruptedException iex) {
// essentially ignore and propagate the interrupt back up
LOG.warn("Interrupted while waiting");
LOG.warn("Interrupted while waiting in region {}", this);
interrupted = true;
break;
}
Expand Down Expand Up @@ -1830,7 +1830,7 @@ public boolean waitForFlushes(long timeout) {
writestate.wait(toWait);
} catch (InterruptedException iex) {
// essentially ignore and propagate the interrupt back up
LOG.warn("Interrupted while waiting");
LOG.warn("Interrupted while waiting in region {}", this);
interrupted = true;
break;
} finally {
Expand All @@ -1842,7 +1842,7 @@ public boolean waitForFlushes(long timeout) {
Thread.currentThread().interrupt();
}
}
LOG.debug("Waited " + duration + " ms for flush to complete");
LOG.debug("Waited {} ms for region {} flush to complete", duration, this);
return !(writestate.flushing);
}
}
Expand Down Expand Up @@ -2254,7 +2254,7 @@ public boolean compact(CompactionContext compaction, HStore store,
requestNeedsCancellation = false;
store.compact(compaction, throughputController, user);
} catch (InterruptedIOException iioe) {
String msg = "compaction interrupted";
String msg = "region " + this + " compaction interrupted";
LOG.info(msg, iioe);
status.abort(msg);
return false;
Expand Down Expand Up @@ -2725,8 +2725,8 @@ private void doAbortFlushToWAL(final WAL wal, final long flushOpSeqId,
WALUtil.writeFlushMarker(wal, this.getReplicationScope(), getRegionInfo(), desc, false,
mvcc);
} catch (Throwable t) {
LOG.warn("Received unexpected exception trying to write ABORT_FLUSH marker to WAL:" +
StringUtils.stringifyException(t));
LOG.warn("Received unexpected exception trying to write ABORT_FLUSH marker to WAL: {} in "
+ " region {}", StringUtils.stringifyException(t), this);
// ignore this since we will be aborting the RS with DSE.
}
// we have called wal.startCacheFlush(), now we have to abort it
Expand Down Expand Up @@ -3312,7 +3312,7 @@ protected void checkAndPrepareMutation(int index, long timestamp) throws IOExcep
durability = tmpDur;
}
} catch (NoSuchColumnFamilyException nscfe) {
final String msg = "No such column family in batch mutation. ";
final String msg = "No such column family in batch mutation in region " + this;
if (observedExceptions.hasSeenNoSuchFamily()) {
LOG.warn(msg + nscfe.getMessage());
} else {
Expand All @@ -3325,7 +3325,7 @@ protected void checkAndPrepareMutation(int index, long timestamp) throws IOExcep
throw nscfe;
}
} catch (FailedSanityCheckException fsce) {
final String msg = "Batch Mutation did not pass sanity check. ";
final String msg = "Batch Mutation did not pass sanity check in region " + this;
if (observedExceptions.hasSeenFailedSanityCheck()) {
LOG.warn(msg + fsce.getMessage());
} else {
Expand All @@ -3338,7 +3338,7 @@ protected void checkAndPrepareMutation(int index, long timestamp) throws IOExcep
throw fsce;
}
} catch (WrongRegionException we) {
final String msg = "Batch mutation had a row that does not belong to this region. ";
final String msg = "Batch mutation had a row that does not belong to this region " + this;
if (observedExceptions.hasSeenWrongRegion()) {
LOG.warn(msg + we.getMessage());
} else {
Expand Down Expand Up @@ -3411,7 +3411,8 @@ public MiniBatchOperationInProgress<Mutation> lockRowsAndBuildMiniBatch(
throwException = true;
throw e;
} catch (IOException ioe) {
LOG.warn("Failed getting lock, row=" + Bytes.toStringBinary(mutation.getRow()), ioe);
LOG.warn("Failed getting lock, row={}, in region {}",
Bytes.toStringBinary(mutation.getRow()), this, ioe);
if (isAtomic()) { // fail, atomic means all or none
throwException = true;
throw ioe;
Expand Down Expand Up @@ -3949,7 +3950,7 @@ protected void checkAndPreparePut(Put p) throws IOException {
if (nonExistentList != null) {
for (byte[] family : nonExistentList) {
// Perhaps schema was changed between crash and replay
LOG.info("No family for " + Bytes.toString(family) + " omit from reply.");
LOG.info("No family for {} omit from reply in region {}.", Bytes.toString(family), this);
familyCellMap.remove(family);
}
}
Expand Down Expand Up @@ -4769,7 +4770,7 @@ private long replayRecoveredEditsForPaths(long minSeqIdForTheRegion, FileSystem
if (maxSeqId <= minSeqIdForTheRegion) {
if (LOG.isDebugEnabled()) {
String msg = "Maximum sequenceid for this wal is " + maxSeqId
+ " and minimum sequenceid for the region is " + minSeqIdForTheRegion
+ " and minimum sequenceid for the region " + this + " is " + minSeqIdForTheRegion
+ ", skipped the whole file, path=" + edits;
LOG.debug(msg);
}
Expand Down Expand Up @@ -4863,7 +4864,7 @@ private long replayRecoveredEdits(final Path edits, Map<byte[], Long> maxSeqIdIn
" edits=" + editsCount);
// Timeout reached
if(!reporter.progress()) {
msg = "Progressable reporter failed, stopping replay";
msg = "Progressable reporter failed, stopping replay for region " + this;
LOG.warn(msg);
status.abort(msg);
throw new IOException(msg);
Expand Down Expand Up @@ -4931,13 +4932,13 @@ private long replayRecoveredEdits(final Path edits, Map<byte[], Long> maxSeqIdIn
if (store == null) {
// This should never happen. Perhaps schema was changed between
// crash and redeploy?
LOG.warn("No family for " + cell);
LOG.warn("No family for cell {} in region {}", cell, this);
skippedEdits++;
continue;
}
if (checkRowWithinBoundary && !rowIsInRange(this.getRegionInfo(),
cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())) {
LOG.warn("Row of " + cell + " is not within region boundary");
LOG.warn("Row of {} is not within region boundary for region {}", cell, this);
skippedEdits++;
continue;
}
Expand Down Expand Up @@ -4970,9 +4971,9 @@ private long replayRecoveredEdits(final Path edits, Map<byte[], Long> maxSeqIdIn
}
} catch (EOFException eof) {
Path p = WALSplitUtil.moveAsideBadEditsFile(walFS, edits);
msg = "EnLongAddered EOF. Most likely due to Master failure during " +
"wal splitting, so we have this data in another edit. " +
"Continuing, but renaming " + edits + " as " + p;
msg = "EnLongAddered EOF. Most likely due to Master failure during "
+ "wal splitting, so we have this data in another edit. Continuing, but renaming "
+ edits + " as " + p + " for region " + this;
LOG.warn(msg, eof);
status.abort(msg);
} catch (IOException ioe) {
Expand Down Expand Up @@ -6052,7 +6053,8 @@ protected RowLock getRowLockInternal(byte[] row, boolean readLock, final RowLock
success = true;
return result;
} catch (InterruptedException ie) {
LOG.warn("Thread interrupted waiting for lock on row: " + rowKey);
LOG.warn("Thread interrupted waiting for lock on row: {}, in region {}", rowKey,
getRegionInfo().getRegionNameAsString());
InterruptedIOException iie = new InterruptedIOException();
iie.initCause(ie);
TraceUtil.addTimelineAnnotation("Interrupted exception getting row lock");
Expand All @@ -6062,7 +6064,8 @@ protected RowLock getRowLockInternal(byte[] row, boolean readLock, final RowLock
// The maximum lock count for read lock is 64K (hardcoded), when this maximum count
// is reached, it will throw out an Error. This Error needs to be caught so it can
// go ahead to process the minibatch with lock acquired.
LOG.warn("Error to get row lock for " + Bytes.toStringBinary(row) + ", cause: " + error);
LOG.warn("Error to get row lock for {}, in region {}, cause: {}", Bytes.toStringBinary(row),
getRegionInfo().getRegionNameAsString(), error);
IOException ioe = new IOException(error);
TraceUtil.addTimelineAnnotation("Error getting row lock");
throw ioe;
Expand Down Expand Up @@ -6313,7 +6316,8 @@ public Map<byte[], List<Path>> bulkLoadHFiles(Collection<Pair<byte[], String>> f

// validation failed because of some sort of IO problem.
if (ioException != null) {
LOG.error("There was IO error when checking if the bulk load is ok.", ioException);
LOG.error("There was IO error when checking if the bulk load is ok in region {}.", this,
ioException);
throw ioException;
}
}
Expand All @@ -6325,8 +6329,8 @@ public Map<byte[], List<Path>> bulkLoadHFiles(Collection<Pair<byte[], String>> f
.append(p.getSecond());
}
// problem when validating
LOG.warn("There was a recoverable bulk load failure likely due to a" +
" split. These (family, HFile) pairs were not loaded: " + list);
LOG.warn("There was a recoverable bulk load failure likely due to a split. These (family,"
+ " HFile) pairs were not loaded: {}, in region {}", list.toString(), this);
return null;
}

Expand Down Expand Up @@ -7666,7 +7670,8 @@ public MiniBatchOperationInProgress<Mutation> lockRowsAndBuildMiniBatch(
prevRowLock = rowLock;
}
} catch (IOException ioe) {
LOG.warn("Failed getting lock, row=" + Bytes.toStringBinary(row), ioe);
LOG.warn("Failed getting lock, row={}, in region {}", Bytes.toStringBinary(row), this,
ioe);
throw ioe;
}
}
Expand Down Expand Up @@ -7865,8 +7870,8 @@ private void doProcessRowWithTimeout(final RowProcessor<?,?> processor,
} catch (IOException e) {
String row = processor.getRowsToLock().isEmpty() ? "" :
" on row(s):" + Bytes.toStringBinary(processor.getRowsToLock().iterator().next()) + "...";
LOG.warn("RowProcessor:" + processor.getClass().getName() +
" throws Exception" + row, e);
LOG.warn("RowProcessor: {}, in region {}, throws Exception {}",
processor.getClass().getName(), getRegionInfo().getRegionNameAsString(), row, e);
throw e;
}
return;
Expand All @@ -7882,8 +7887,8 @@ public Void call() throws IOException {
} catch (IOException e) {
String row = processor.getRowsToLock().isEmpty() ? "" :
" on row(s):" + Bytes.toStringBinary(processor.getRowsToLock().iterator().next()) + "...";
LOG.warn("RowProcessor:" + processor.getClass().getName() +
" throws Exception" + row, e);
LOG.warn("RowProcessor: {}, in region {}, throws Exception {}",
processor.getClass().getName(), getRegionInfo().getRegionNameAsString(), row, e);
throw e;
}
}
Expand All @@ -7894,7 +7899,8 @@ public Void call() throws IOException {
} catch (TimeoutException te) {
String row = processor.getRowsToLock().isEmpty() ? "" :
" on row(s):" + Bytes.toStringBinary(processor.getRowsToLock().iterator().next()) + "...";
LOG.error("RowProcessor timeout:" + timeout + " ms" + row);
LOG.error("RowProcessor timeout: {} ms, in region {}, {}", timeout,
getRegionInfo().getRegionNameAsString(), row);
throw new IOException(te);
} catch (Exception e) {
throw new IOException(e);
Expand Down Expand Up @@ -8198,8 +8204,8 @@ private List<Cell> reckonDeltasByStore(HStore store, Operation op, Mutation muta
}
int newCellSize = PrivateCellUtil.estimatedSerializedSizeOf(newCell);
if (newCellSize > this.maxCellSize) {
String msg = "Cell with size " + newCellSize + " exceeds limit of " +
this.maxCellSize + " bytes";
String msg = "Cell with size " + newCellSize + " exceeds limit of " + this.maxCellSize
+ " bytes in region " + this;
if (LOG.isDebugEnabled()) {
LOG.debug(msg);
}
Expand Down Expand Up @@ -8369,8 +8375,8 @@ public boolean registerService(com.google.protobuf.Service instance) {
com.google.protobuf.Descriptors.ServiceDescriptor serviceDesc = instance.getDescriptorForType();
String serviceName = CoprocessorRpcUtils.getServiceName(serviceDesc);
if (coprocessorServiceHandlers.containsKey(serviceName)) {
LOG.error("Coprocessor service " + serviceName +
" already registered, rejecting request from " + instance);
LOG.error("Coprocessor service {} already registered, rejecting request from {} in region {}",
serviceName, instance, this);
return false;
}

Expand Down Expand Up @@ -8500,7 +8506,7 @@ public byte[] checkSplit() {
try {
checkRow(ret, "calculated split");
} catch (IOException e) {
LOG.error("Ignoring invalid split", e);
LOG.error("Ignoring invalid split for region {}", this, e);
return null;
}
}
Expand Down Expand Up @@ -8668,7 +8674,7 @@ private void lock(final Lock lock, final int multiplier)
this.getRegionServerServices().getServerName()));
}
} catch (InterruptedException ie) {
LOG.info("Interrupted while waiting for a lock");
LOG.info("Interrupted while waiting for a lock in region {}", this);
InterruptedIOException iie = new InterruptedIOException();
iie.initCause(ie);
throw iie;
Expand Down

0 comments on commit a33e4d2

Please sign in to comment.