[ 
https://issues.apache.org/jira/browse/CASSANDRA-3101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166657#comment-13166657
 ] 

paul cannon commented on CASSANDRA-3101:
----------------------------------------

The following imports appear to be unused, and should probably be removed:

{code}
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import sun.misc.IOUtils;
{code}

Also, why add the logger.error() call in createHardLink, but not in 
createHardLinkWithExec? seems like if we want to know about the error in the C* 
log in the first case, we'd also want to know about it in the second case.

As a less important point, I wonder if it isn't worth modifying the existing 
hard-linking code a bit: "cmd /c mklink /H" seems a much more clunky way to 
make a hard link, and I think the logic is backwards: "fsutil hardlink create" 
is supported in all Windows versions since Windows Server 2000, except XP. 
Maybe the osversion comparison was meant to use cmd /c mklink /H in the 
"Windows XP or less" case, not "Windows Vista or later".

Tested on Windows 7, though, after mounting a USB drive at the "snapshots" dir 
and trying to snapshot that keyspace. Error showed up correctly with output to 
nodetool, although no errors showed in the c* log.
                
> Should check for errors when calling /bin/ln
> --------------------------------------------
>
>                 Key: CASSANDRA-3101
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3101
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.4
>            Reporter: paul cannon
>            Assignee: Vijay
>            Priority: Minor
>              Labels: lhf
>             Fix For: 1.0.6
>
>         Attachments: 0001-3101-throw-IOE-while-calling-bin-ln.patch
>
>
> It looks like cassandra.utils.CLibrary.createHardLinkWithExec() does not 
> check for any errors in the execution of the hard-link-making utility. This 
> could be bad if, for example, the user has put the snapshot directory on a 
> different filesystem from the data directory. The hard linking would fail and 
> the sstable snapshots would not exist, but no error would be reported.
> It does look like errors with the more direct JNA link() call are handled 
> correctly- an exception is thrown. The WithExec version should probably do 
> the same thing.
> Definitely it would be enough to check the process exit value from /bin/ln 
> for nonzero in the *nix case, but I don't know whether 'fsutil hardlink 
> create' or 'cmd /c mklink /H' return nonzero on failure.
> For bonus points, use any output from the Process's error stream in the text 
> of the exception, to aid in debugging problems.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to