-
Notifications
You must be signed in to change notification settings - Fork 444
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
Handle old sorted map files in Upgrade #2185
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -105,6 +105,12 @@ | |||||
* <a href="https://github.com/apache/accumulo/issues/1642">#1642</a>, and | ||||||
* <a href="https://github.com/apache/accumulo/issues/1643">#1643</a> as well.</li> | ||||||
* </ul> | ||||||
* | ||||||
* Sorted recovery was updated to use RFiles instead of map files. So to prevent issues during | ||||||
* tablet recovery, remove the old temporary map files and resort using RFiles. This is done in | ||||||
* {@link #dropSortedMapWALFiles(VolumeManager)}. For more information see the following issues: | ||||||
* <a href="https://github.com/apache/accumulo/issues/2117">#2117</a> and | ||||||
* <a href="https://github.com/apache/accumulo/issues/2179">#2179</a> | ||||||
*/ | ||||||
public class Upgrader9to10 implements Upgrader { | ||||||
|
||||||
|
@@ -142,6 +148,8 @@ public void upgradeMetadata(ServerContext ctx) { | |||||
upgradeRelativePaths(ctx, Ample.DataLevel.USER); | ||||||
upgradeDirColumns(ctx, Ample.DataLevel.USER); | ||||||
upgradeFileDeletes(ctx, Ample.DataLevel.USER); | ||||||
// special case where old files need to be deleted | ||||||
dropSortedMapWALFiles(ctx.getVolumeManager()); | ||||||
milleruntime marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
|
||||||
private void setMetaTableProps(ServerContext ctx) { | ||||||
|
@@ -726,4 +734,37 @@ static Path resolveRelativeDelete(String oldDelete, String upgradeProperty) { | |||||
} | ||||||
return new Path(upgradeProperty, VolumeManager.FileType.TABLE.getDirectory() + oldDelete); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Remove old temporary map files to prevent problems during recovery. | ||||||
*/ | ||||||
static void dropSortedMapWALFiles(VolumeManager vm) { | ||||||
Path recoveryDir = new Path("/accumulo/recovery"); | ||||||
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. Seems like this should loop over the set of configured volumes instead of this. 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. Good catch. I will create a follow on ticket with this and any other suggestions you have. 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. Do you think using the volumes configured in 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.
Yeah, could look through all of those. Could narrow it by calling : accumulo/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java Line 180 in a9100ac
But I don't think it hurts to just look through all volumes. Maybe could use accumulo/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java Line 196 in a9100ac
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. Would probably be best to avoid choosable() as that will give the volumes configured for new WALs. The config could change and an old WAL could be on a volume that choosable() no longer returns. So probably best to inspect all volumes looking for old sorted wals to nuke. 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.
Definitely avoid this. Consider RandomVolumeChooser 😺 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 thought the VolumeChooser was for selecting volumes for writes? I want to loop through every volume configured to find the old sorted WALs to remove. Will the VolumeChooser allow for this? |
||||||
try { | ||||||
if (!vm.exists(recoveryDir)) { | ||||||
log.info("There are no recovery files in /accumulo/recovery"); | ||||||
return; | ||||||
} | ||||||
List<Path> directoriesToDrop = new ArrayList<>(); | ||||||
for (FileStatus walDir : vm.listStatus(recoveryDir)) { | ||||||
// map files will be in a directory starting with "part" | ||||||
Path walDirPath = walDir.getPath(); | ||||||
for (FileStatus dirOrFile : vm.listStatus(walDirPath)) { | ||||||
if (dirOrFile.isDirectory()) { | ||||||
directoriesToDrop.add(walDirPath); | ||||||
break; | ||||||
} | ||||||
} | ||||||
} | ||||||
if (!directoriesToDrop.isEmpty()) { | ||||||
log.info("Found {} old sorted map directories to delete.", directoriesToDrop.size()); | ||||||
for (Path dir : directoriesToDrop) { | ||||||
log.info("Deleting everything in old sorted map directory: {}", dir); | ||||||
vm.deleteRecursively(dir); | ||||||
} | ||||||
} | ||||||
} catch (IOException ioe) { | ||||||
throw new UncheckedIOException(ioe); | ||||||
} | ||||||
} | ||||||
} |
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.
Did you consider calling this new method in upgradeZookeeper instead? I think that is called before the root tablet is loaded, which would allow deleting any old sorted logs the root tablet may reference.
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.
No, I didn't think any tables were loaded until after the Upgrader was finished. If that is the case, then moving it to
upgradeZookeeper
would be better.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.
I think the upgrade methods are run as follows.
upgradeZookeeper()
is run before the root tablet is loaded.upgradeRoot()
is run after the root tablet is loaded and before the metadata table is loaded.upgradeMetadata
is run after the metadata table is loaded and before loading user tablets.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.
Ah OK. I will move it to
upgradeZookeeper()
.