From e2c011b74288c63c55478f75ac9586708e17def3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Spo=CC=88rri?= Date: Thu, 30 Mar 2023 10:26:55 +0200 Subject: [PATCH] GEDS: Relocate files on close. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pascal SpoĢˆrri --- src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java | 1 + src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java b/src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java index 2f1b3a7..57ef70c 100644 --- a/src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java +++ b/src/main/java/com/ibm/geds/hdfs/GEDSHadoopFileSystem.java @@ -52,6 +52,7 @@ public void close() throws IOException { // super.close(); // geds.stopGEDS(); // geds = null; + geds.relocate(); geds.printStatistics(); } diff --git a/src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java b/src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java index 4715aa3..b7da198 100644 --- a/src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java +++ b/src/main/java/com/ibm/geds/hdfs/GEDSInputStream.java @@ -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 + "."); } } }