HBASE-8838 [WINDOWS] FileLink assumptions are broken under NTFS
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1503501 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c89c0e25f0
commit
a39393addd
@ -87,6 +87,9 @@ public abstract class FSUtils {
|
|||||||
/** Full access permissions (starting point for a umask) */
|
/** Full access permissions (starting point for a umask) */
|
||||||
private static final String FULL_RWX_PERMISSIONS = "777";
|
private static final String FULL_RWX_PERMISSIONS = "777";
|
||||||
|
|
||||||
|
/** Set to true on Windows platforms */
|
||||||
|
public static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");
|
||||||
|
|
||||||
protected FSUtils() {
|
protected FSUtils() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -22,27 +22,23 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
|
||||||
import org.apache.hadoop.fs.Path;
|
|
||||||
import org.apache.hadoop.fs.FSDataInputStream;
|
|
||||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
|
||||||
import org.apache.hadoop.hbase.MediumTests;
|
|
||||||
import org.apache.hadoop.hbase.io.FileLink;
|
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.fs.FSDataInputStream;
|
||||||
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
|
import org.apache.hadoop.hbase.MediumTests;
|
||||||
|
import org.apache.hadoop.hbase.util.FSUtils;
|
||||||
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that FileLink switches between alternate locations
|
* Test that FileLink switches between alternate locations
|
||||||
* when the current location moves or gets deleted.
|
* when the current location moves or gets deleted.
|
||||||
@ -108,12 +104,21 @@ public class TestFileLink {
|
|||||||
dataVerify(data, n, (byte)2);
|
dataVerify(data, n, (byte)2);
|
||||||
size += n;
|
size += n;
|
||||||
|
|
||||||
|
if (FSUtils.WINDOWS) {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
// Move origin to archive
|
// Move origin to archive
|
||||||
assertFalse(fs.exists(archivedPath));
|
assertFalse(fs.exists(archivedPath));
|
||||||
fs.rename(originalPath, archivedPath);
|
fs.rename(originalPath, archivedPath);
|
||||||
assertFalse(fs.exists(originalPath));
|
assertFalse(fs.exists(originalPath));
|
||||||
assertTrue(fs.exists(archivedPath));
|
assertTrue(fs.exists(archivedPath));
|
||||||
|
|
||||||
|
if (FSUtils.WINDOWS) {
|
||||||
|
in = link.open(fs); // re-read from beginning
|
||||||
|
in.read(data);
|
||||||
|
}
|
||||||
|
|
||||||
// Try to read to the end
|
// Try to read to the end
|
||||||
while ((n = in.read(data)) > 0) {
|
while ((n = in.read(data)) > 0) {
|
||||||
dataVerify(data, n, (byte)2);
|
dataVerify(data, n, (byte)2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user