-
Notifications
You must be signed in to change notification settings - Fork 479
Cleanup recovery code #6261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ddanielr
wants to merge
2
commits into
apache:main
Choose a base branch
from
ddanielr:feature/reduce-serverContext-usages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+33
−37
Open
Cleanup recovery code #6261
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,8 +222,8 @@ protected TabletServer(ServerOpts opts, | |
| super(ServerId.Type.TABLET_SERVER, opts, serverContextFactory, args); | ||
| context = super.getContext(); | ||
| final AccumuloConfiguration aconf = getConfiguration(); | ||
| log.info("Version " + Constants.VERSION); | ||
| log.info("Instance " + getInstanceID()); | ||
| log.info("Version {}", Constants.VERSION); | ||
| log.info("Instance {}", getInstanceID()); | ||
| this.sessionManager = new SessionManager(context); | ||
| this.logSorter = new LogSorter(this); | ||
| this.statsKeeper = new TabletStatsKeeper(); | ||
|
|
@@ -423,7 +423,7 @@ private HostAndPort getManagerAddress() { | |
| } | ||
| return HostAndPort.fromString(managers.iterator().next().toHostPortString()); | ||
| } catch (Exception e) { | ||
| log.warn("Failed to obtain manager host " + e); | ||
| log.warn("Failed to obtain manager host", e); | ||
| } | ||
|
|
||
| return null; | ||
|
|
@@ -438,7 +438,7 @@ private ManagerClientService.Client managerConnection(HostAndPort address) { | |
| // log.info("Listener API to manager has been opened"); | ||
| return ThriftUtil.getClient(ThriftClientTypes.MANAGER, address, getContext()); | ||
| } catch (Exception e) { | ||
| log.warn("Issue with managerConnection (" + address + ") " + e, e); | ||
| log.warn("Issue with managerConnection ({}) {}", address, e, e); | ||
| } | ||
| return null; | ||
| } | ||
|
|
@@ -735,7 +735,7 @@ public TServerInstance getTabletSession() { | |
| try { | ||
| return new TServerInstance(getAdvertiseAddress().toString(), lockSessionId); | ||
| } catch (Exception ex) { | ||
| log.warn("Unable to read session from tablet server lock" + ex); | ||
| log.warn("Unable to read session from tablet server lock", ex); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here about behavior change. |
||
| return null; | ||
| } | ||
| } | ||
|
|
@@ -890,15 +890,15 @@ public boolean needsRecovery(TabletMetadata tabletMetadata) { | |
| } | ||
|
|
||
| try { | ||
| return logger.needsRecovery(getContext(), tabletMetadata.getExtent(), logEntries); | ||
| return logger.needsRecovery(tabletMetadata.getExtent(), logEntries); | ||
| } catch (IOException e) { | ||
| throw new UncheckedIOException(e); | ||
| } | ||
| } | ||
|
|
||
| public void recover(VolumeManager fs, KeyExtent extent, Collection<LogEntry> logEntries, | ||
| Set<String> tabletFiles, MutationReceiver mutationReceiver) throws IOException { | ||
| logger.recover(getContext(), extent, logEntries, tabletFiles, mutationReceiver); | ||
| public void recover(KeyExtent extent, Collection<LogEntry> logEntries, Set<String> tabletFiles, | ||
| MutationReceiver mutationReceiver) throws IOException { | ||
| logger.recover(extent, logEntries, tabletFiles, mutationReceiver); | ||
| } | ||
|
|
||
| public int createLogId() { | ||
|
|
@@ -1016,7 +1016,7 @@ private void markUnusedWALs() { | |
| try { | ||
| TServerInstance session = this.getTabletSession(); | ||
| for (DfsLogger candidate : eligible) { | ||
| log.info("Marking " + candidate.getPath() + " as unreferenced"); | ||
| log.info("Marking {} as unreferenced", candidate.getPath()); | ||
| walMarker.walUnreferenced(session, candidate.getPath()); | ||
| } | ||
| synchronized (closedLogs) { | ||
|
|
@@ -1028,7 +1028,7 @@ private void markUnusedWALs() { | |
| } | ||
|
|
||
| public void addNewLogMarker(DfsLogger copy) throws WalMarkerException { | ||
| log.info("Writing log marker for " + copy.getPath()); | ||
| log.info("Writing log marker for {}", copy.getPath()); | ||
| walMarker.addNewWalMarker(getTabletSession(), copy.getPath()); | ||
| } | ||
|
|
||
|
|
@@ -1040,7 +1040,7 @@ public void walogClosed(DfsLogger currentLog) throws WalMarkerException { | |
| closedLogs.add(currentLog); | ||
| clSize = closedLogs.size(); | ||
| } | ||
| log.info("Marking " + currentLog.getPath() + " as closed. Total closed logs " + clSize); | ||
| log.info("Marking {} as closed. Total closed logs {}", currentLog.getPath(), clSize); | ||
| walMarker.closeWal(getTabletSession(), currentLog.getPath()); | ||
|
|
||
| // whenever a new log is added to the set of closed logs, go through all of the tablets and | ||
|
|
@@ -1058,8 +1058,7 @@ public void walogClosed(DfsLogger currentLog) throws WalMarkerException { | |
| } | ||
| } | ||
| } else { | ||
| log.info( | ||
| "Marking " + currentLog.getPath() + " as unreferenced (skipping closed writes == 0)"); | ||
| log.info("Marking {} as unreferenced (skipping closed writes == 0)", currentLog.getPath()); | ||
| walMarker.walUnreferenced(getTabletSession(), currentLog.getPath()); | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,6 @@ | |
| import org.apache.accumulo.core.util.Retry; | ||
| import org.apache.accumulo.core.util.Retry.RetryFactory; | ||
| import org.apache.accumulo.core.util.threads.Threads; | ||
| import org.apache.accumulo.server.ServerContext; | ||
| import org.apache.accumulo.server.log.WalStateManager.WalMarkerException; | ||
| import org.apache.accumulo.tserver.TabletMutations; | ||
| import org.apache.accumulo.tserver.TabletServer; | ||
|
|
@@ -293,7 +292,7 @@ private synchronized void startLogMaker() { | |
| try { | ||
| tserver.addNewLogMarker(alog); | ||
| } catch (Exception e) { | ||
| log.error("Failed to add new WAL marker for " + alog.getLogEntry(), e); | ||
| log.error("Failed to add new WAL marker for {}", alog.getLogEntry(), e); | ||
|
|
||
| try { | ||
| // Intentionally not deleting walog because it may have been advertised in ZK. See | ||
|
|
@@ -311,7 +310,7 @@ private synchronized void startLogMaker() { | |
| try { | ||
| tserver.walogClosed(alog); | ||
| } catch (WalMarkerException | RuntimeException e2) { | ||
| log.error("Failed to close WAL that failed to open: " + alog.getLogEntry(), e2); | ||
| log.error("Failed to close WAL that failed to open: {}", alog.getLogEntry(), e2); | ||
| } | ||
|
|
||
| try { | ||
|
|
@@ -348,7 +347,7 @@ private synchronized void close() throws IOException { | |
| } catch (DfsLogger.LogClosedException ex) { | ||
| // ignore | ||
| } catch (IOException | RuntimeException ex) { | ||
| log.error("Unable to cleanly close log " + currentLog.getLogEntry() + ": " + ex, ex); | ||
| log.error("Unable to cleanly close log {}: {}", currentLog.getLogEntry(), ex, ex); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the first |
||
| } finally { | ||
| try { | ||
| this.tserver.walogClosed(currentLog); | ||
|
|
@@ -523,26 +522,25 @@ private CacheProvider createCacheProvider(TabletServerResourceManager resourceMg | |
| LoggingBlockCache.wrap(CacheType.DATA, resourceMgr.getDataCache())); | ||
| } | ||
|
|
||
| public boolean needsRecovery(ServerContext context, KeyExtent extent, Collection<LogEntry> walogs) | ||
| throws IOException { | ||
| public boolean needsRecovery(KeyExtent extent, Collection<LogEntry> walogs) throws IOException { | ||
| try { | ||
| var resourceMgr = tserver.getResourceManager(); | ||
| var cacheProvider = createCacheProvider(resourceMgr); | ||
| SortedLogRecovery recovery = | ||
| new SortedLogRecovery(context, resourceMgr.getFileLenCache(), cacheProvider); | ||
| new SortedLogRecovery(tserver.getContext(), resourceMgr.getFileLenCache(), cacheProvider); | ||
| return recovery.needsRecovery(extent, resolve(walogs)); | ||
| } catch (Exception e) { | ||
| throw new IOException(e); | ||
| } | ||
| } | ||
|
|
||
| public void recover(ServerContext context, KeyExtent extent, Collection<LogEntry> walogs, | ||
| Set<String> tabletFiles, MutationReceiver mr) throws IOException { | ||
| public void recover(KeyExtent extent, Collection<LogEntry> walogs, Set<String> tabletFiles, | ||
| MutationReceiver mr) throws IOException { | ||
| try { | ||
| var resourceMgr = tserver.getResourceManager(); | ||
| var cacheProvider = createCacheProvider(resourceMgr); | ||
| SortedLogRecovery recovery = | ||
| new SortedLogRecovery(context, resourceMgr.getFileLenCache(), cacheProvider); | ||
| new SortedLogRecovery(tserver.getContext(), resourceMgr.getFileLenCache(), cacheProvider); | ||
| recovery.recover(extent, resolve(walogs), tabletFiles, mr); | ||
| } catch (Exception e) { | ||
| throw new IOException(e); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this prints the entire stack trace, then I think this is a behavior change. Previously this would print
Exception.toString, not the entire stack trace. Suggest adding a placeholder to the message{}.