-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23285 Sometimes walArchiveDir does not exist when separate the old WALs into different regionserver directories #819
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
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
wchevreuil
left a comment
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.
Shouldn't the archive dir had already been created at WAL initialization here?
But,if there are no files, the regionserver directory will be cleared.
Do you mean, somewhere else, the RS specific wal dir gets deleted?
| while (v.length() < 1000) { | ||
| v.append(className); | ||
| } | ||
| this.value = Bytes.toBytes(v.toString()); |
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.
Also, it seems we only use this value variable in the doPut method, so there's no need to make it a class attribute. Could be created at startAndWriteData and passed as parameter to doPut . If we still think it's worth keep it as global, then initialisation should be moved to setup method.
| @BeforeClass | ||
| public static void setUpBeforeClass() throws Exception { | ||
|
|
||
| Configuration conf = TEST_UTIL.getConfiguration(); |
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.
As there's only one test method for now, TEST_UTIL could be made non-static and all initialisation logic moved to setUp method.
| TEST_UTIL.shutdownMiniCluster(); | ||
| } | ||
|
|
||
| protected void startAndWriteData() throws IOException, InterruptedException { |
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.
Why protected modifier?
| try { | ||
| Thread.sleep(1000); | ||
| } catch (InterruptedException e) { | ||
| // continue |
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.
Add logging to help troubleshooting eventual test failures?
| //start cleaner chore | ||
| Configuration conf = TEST_UTIL.getConfiguration(); | ||
| Path rootdir = CommonFSUtils.getWALRootDir(conf); | ||
| Path OLD_WALS_DIR = |
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.
small nit: non-constant, variable names should follow camel case java conventions.
| Path rootdir = CommonFSUtils.getWALRootDir(conf); | ||
| Path OLD_WALS_DIR = | ||
| new Path(rootdir, HConstants.HREGION_OLDLOGDIR_NAME); | ||
| DirScanPool POOL = new DirScanPool(TEST_UTIL.getConfiguration()); |
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.
small nit: non-constant, variable names should follow camel case java conventions.
| Thread thread = new Thread(() -> cleaner.chore()); | ||
| thread.setDaemon(true); | ||
| thread.start(); | ||
|
|
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.
Shouldn't we wait for log cleaner thread to finish? This will likely give us false positives, as the test thread itself may finish before the log cleaner.
| thread.start(); | ||
|
|
||
| // Now roll the log | ||
| log.rollWriter(); |
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.
We must assert what we are testing in this method. If we want to validate that wal file got deleted from the given RS oldWAL dir, then we should verify that the given folder is now empty.
| public TestSeparateOldWALCleaner() { | ||
| this.server = null; | ||
| this.tableName = null; | ||
|
|
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.
These should be omitted, as object attributes are already null be default.
| StringBuilder v = new StringBuilder(className); | ||
| while (v.length() < 1000) { | ||
| v.append(className); | ||
| } |
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.
Why such a loop to generate a value? Couldn't we simply create a byte[] here with the desired size?
|
|
💔 -1 overall
This message was automatically generated. |
…old WALs into different regionserver directories
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
This PR causes the pre commit PR job NPE as the source repo is unreachable. Will close this one. Feel free to open a new one. |
HBASE-14247 Add a new config hbase.separate.oldlogdir.by.regionserver, the old wal dir will be separated by regionservers.
But,if there are no files, the regionserver directory will be cleared. CommonFSUtils.renameAndSetModifyTime(this.fs, p, newPath) will throw exception.