[
https://issues.apache.org/jira/browse/HBASE-7199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13535165#comment-13535165
]
Jonathan Hsieh commented on HBASE-7199:
---------------------------------------
style nit:
I believe it is generally better to exit early instead of nesting ifs deeper
and deeper. currently it look like this:
{code}
+ if (isReference) {
..
+ if (!fs.exists(referredToFile)) {
..
+ if (shouldFixReferenceFiles()) {
..
+ if (index > 0) {
{code}
would be nicer if it was like this:
{code}
+ if (!isReference) reutrn xxx;
..
+ if (fs.exists(referredToFile)) return xxx;
..
+ if (!shouldFixReferenceFiles()) return xxx;
..
+ if (index <= 0) return xxx;
...
... normal case
{code}
----
sp: sildeline
+ LOG.info("Trying to sildeline reference file"
+ + path + " to " + dst);
----
can this
{code}
+ String pathStr = path.toString();
+ int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR);
+ for (int i = 0; index > 0 && i < 3; i++) {
+ index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index);
+ }
+ if (index > 0) {
+ Path rootDir = getSidelineDir();
+ Path dst = new Path(rootDir, pathStr.substring(index));
+ fs.mkdirs(dst.getParent());
+ LOG.info("Trying to sildeline reference file"
+ + path + " to " + dst);
+ setShouldRerun();
+
+ success = fs.rename(path, dst);
+ }
{code}
be something cleaner using path.getParent() and path.getName()?
Alternatively, I think we could get away with an example because some the
string manip is a little intricate.
> hbck should check lingering reference hfile and have option to sideline them
> automatically
> ------------------------------------------------------------------------------------------
>
> Key: HBASE-7199
> URL: https://issues.apache.org/jira/browse/HBASE-7199
> Project: HBase
> Issue Type: Improvement
> Components: hbck
> Reporter: Jimmy Xiang
> Assignee: Jimmy Xiang
> Attachments: trunk-7199.patch
>
>
> Sometimes, some lingering reference hfile points to some region doesn't exist
> any more. This will prevent the region to open. Hbck should be able to find
> these files and sideline them automatically if requested.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira