HDFS-13707. [PROVIDED Storage] Fix failing integration tests in ITestProvidedImplementation. Contributed by Virajith Jalaparti.

This commit is contained in:
Inigo Goiri 2018-06-29 09:56:13 -07:00
parent e4d7227aad
commit 73746c5da7
2 changed files with 4 additions and 3 deletions

View File

@ -28,6 +28,7 @@
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Collections; import java.util.Collections;
@ -359,7 +360,7 @@ private FileRegion nextInternal(Iterator<FileRegion> i) throws IOException {
} }
byte[] nonce = new byte[0]; byte[] nonce = new byte[0];
if (f.length == 6) { if (f.length == 6) {
nonce = f[5].getBytes(Charset.forName("UTF-8")); nonce = Base64.getDecoder().decode(f[5]);
} }
return new FileRegion(Long.parseLong(f[0]), new Path(f[1]), return new FileRegion(Long.parseLong(f[0]), new Path(f[1]),
Long.parseLong(f[2]), Long.parseLong(f[3]), Long.parseLong(f[4]), Long.parseLong(f[2]), Long.parseLong(f[3]), Long.parseLong(f[4]),
@ -451,7 +452,7 @@ public void store(FileRegion token) throws IOException {
out.append(Long.toString(block.getGenerationStamp())); out.append(Long.toString(block.getGenerationStamp()));
if (psl.getNonce().length > 0) { if (psl.getNonce().length > 0) {
out.append(delim) out.append(delim)
.append(new String(psl.getNonce(), Charset.forName("UTF-8"))); .append(Base64.getEncoder().encodeToString(psl.getNonce()));
} }
out.append("\n"); out.append("\n");
} }

View File

@ -132,7 +132,7 @@ public void setSeed() throws Exception {
nnDirPath.toString()); nnDirPath.toString());
conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_TEXT_READ_FILE, conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_TEXT_READ_FILE,
new Path(nnDirPath, fileNameFromBlockPoolID(bpid)).toString()); new Path(nnDirPath, fileNameFromBlockPoolID(bpid)).toString());
conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_TEXT_DELIMITER, ","); conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_TEXT_DELIMITER, "\t");
conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR_PROVIDED, conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR_PROVIDED,
new File(providedPath.toUri()).toString()); new File(providedPath.toUri()).toString());