Skip to content

Commit

Permalink
STAR-1056 Update FSError to store File instead of String value (apach…
Browse files Browse the repository at this point in the history
…e#320)

(cherry picked from commit c390f5f)
(cherry picked from commit ff24c10)
(cherry picked from commit bf50617)
  • Loading branch information
djatnieks authored and jacek-lewandowski committed Oct 18, 2022
1 parent ec596ab commit ea19215
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/java/org/apache/cassandra/io/FSError.java
Expand Up @@ -24,18 +24,18 @@

public abstract class FSError extends IOError
{
public final String path;
public final File file;

public FSError(Throwable cause, File path)
public FSError(Throwable cause, File file)
{
super(cause);
this.path = path.toString();
this.file = file;
}

public FSError(Throwable cause, Path path)
{
super(cause);
this.path = path.toString();
this.file = new File(path);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/java/org/apache/cassandra/io/FSReadError.java
Expand Up @@ -28,9 +28,9 @@ public FSReadError(Throwable cause, Path path)
super(cause, path);
}

public FSReadError(Throwable cause, File path)
public FSReadError(Throwable cause, File file)
{
super(cause, path);
super(cause, file);
}

public FSReadError(Throwable cause, String path)
Expand All @@ -41,6 +41,6 @@ public FSReadError(Throwable cause, String path)
@Override
public String toString()
{
return "FSReadError in " + path;
return "FSReadError in " + file;
}
}
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/io/FSWriteError.java
Expand Up @@ -46,6 +46,6 @@ public FSWriteError(Throwable cause)
@Override
public String toString()
{
return "FSWriteError in " + path;
return "FSWriteError in " + file;
}
}
Expand Up @@ -21,22 +21,22 @@

public class CorruptSSTableException extends RuntimeException
{
public final File path;
public final File file;

public CorruptSSTableException(Throwable cause, File path)
public CorruptSSTableException(Throwable cause, File file)
{
super("Corrupted: " + path, cause);
this.path = path;
super("Corrupted: " + file, cause);
this.file = file;
}

public CorruptSSTableException(Throwable cause, String path)
{
this(cause, new File(path));
}

protected CorruptSSTableException(String msg, Throwable cause, File path)
protected CorruptSSTableException(String msg, Throwable cause, File file)
{
super(msg, cause);
this.path = path;
this.file = file;
}
}
Expand Up @@ -81,10 +81,10 @@ public void handleFSError(FSError e)
}

// for both read and write errors mark the path as unwritable.
DisallowedDirectories.maybeMarkUnwritable(new File(e.path));
DisallowedDirectories.maybeMarkUnwritable(e.file);
if (e instanceof FSReadError)
{
File directory = DisallowedDirectories.maybeMarkUnreadable(new File(e.path));
File directory = DisallowedDirectories.maybeMarkUnreadable(e.file);
if (directory != null)
Keyspace.removeUnreadableSSTables(directory);
}
Expand Down

0 comments on commit ea19215

Please sign in to comment.