Merge branch '1.7'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/02450e4f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/02450e4f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/02450e4f Branch: refs/heads/master Commit: 02450e4f60f41ea52ffed7103459c252e8654630 Parents: 173d80e 2b286ba Author: Dave Marion <dlmar...@apache.org> Authored: Thu Mar 31 16:34:09 2016 -0400 Committer: Dave Marion <dlmar...@apache.org> Committed: Thu Mar 31 16:34:09 2016 -0400 ---------------------------------------------------------------------- .../java/org/apache/accumulo/core/conf/Property.java | 3 +-- .../java/org/apache/accumulo/tserver/TabletServer.java | 3 ++- .../apache/accumulo/tserver/log/TabletServerLogger.java | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/02450e4f/core/src/main/java/org/apache/accumulo/core/conf/Property.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/02450e4f/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/02450e4f/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java ---------------------------------------------------------------------- diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java index b76b9cd,c7b6c98..1c9c5b9 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java @@@ -152,17 -146,19 +155,18 @@@ public class TabletServerLogger this.flushCounter = flushCounter; this.retryFactory = retryFactory; this.retry = null; + this.maxAge = maxAge; } - private int initializeLoggers(final List<DfsLogger> copy) throws IOException { - final int[] result = {-1}; - testLockAndRun(logSetLock, new TestCallWithWriteLock() { + private DfsLogger initializeLoggers(final AtomicInteger logIdOut) throws IOException { + final AtomicReference<DfsLogger> result = new AtomicReference<DfsLogger>(); + testLockAndRun(logIdLock, new TestCallWithWriteLock() { @Override boolean test() { - copy.clear(); - copy.addAll(loggers); - if (!loggers.isEmpty()) - result[0] = logSetId.get(); - return loggers.isEmpty(); + result.set(currentLog); + if (currentLog != null) + logIdOut.set(logId.get()); + return currentLog == null; } @Override @@@ -209,25 -200,18 +213,26 @@@ } try { - DfsLogger alog = new DfsLogger(tserver.getServerConfig(), syncCounter, flushCounter); - alog.open(tserver.getClientAddressString()); - loggers.add(alog); - logSetId.incrementAndGet(); - - // When we successfully create a WAL, make sure to reset the Retry. - if (null != retry) { - retry = null; + startLogMaker(); + Object next = nextLog.take(); + if (next instanceof Exception) { + throw (Exception) next; } + if (next instanceof DfsLogger) { + currentLog = (DfsLogger) next; + logId.incrementAndGet(); + log.info("Using next log " + currentLog.getFileName()); + + // When we successfully create a WAL, make sure to reset the Retry. + if (null != retry) { + retry = null; + } - this.createTime = System.currentTimeMillis(); - return; ++ this.createTime = System.currentTimeMillis(); + return; + } else { + throw new RuntimeException("Error: unexpected type seen: " + next); + } } catch (Exception t) { if (null == retry) { retry = retryFactory.create(); @@@ -434,12 -363,12 +439,12 @@@ }); } } - // if the log gets too big, reset it .. grab the write lock first + // if the log gets too big or too old, reset it .. grab the write lock first logSizeEstimate.addAndGet(4 * 3); // event, tid, seq overhead - testLockAndRun(logSetLock, new TestCallWithWriteLock() { + testLockAndRun(logIdLock, new TestCallWithWriteLock() { @Override boolean test() { - return logSizeEstimate.get() > maxSize; + return (logSizeEstimate.get() > maxSize) || ((System.currentTimeMillis() - createTime) > maxAge); } @Override