Skip to content

Commit

Permalink
GEDS: Relocate files on close.
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Spörri <psp@zurich.ibm.com>
  • Loading branch information
pspoerri committed Apr 19, 2023
1 parent d1ec64e commit e2c011b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void close() throws IOException {
// super.close();
// geds.stopGEDS();
// geds = null;
geds.relocate();
geds.printStatistics();
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,13 @@ public void readFully(long position, byte[] buffer) throws IOException {

public void readFully(long position, ByteBuffer buffer) throws IOException {
int expected = buffer.remaining();
readFully(position, buffer, expected);
}

public void readFully(long position, ByteBuffer buffer, int length) throws IOException {
int len = file.read(position, buffer);
if (len != expected) {
throw new EOFException("Unable to read length " + buffer.length + " at position " + position + ".");
if (len != length) {
throw new EOFException("Unable to read length " + length + " at position " + position + ".");
}
}
}

0 comments on commit e2c011b

Please sign in to comment.