List of usage examples for org.apache.hadoop.hdfs DFSConfigKeys DFS_BLOCK_SIZE_KEY
String DFS_BLOCK_SIZE_KEY
To view the source code for org.apache.hadoop.hdfs DFSConfigKeys DFS_BLOCK_SIZE_KEY.
Click Source Link
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public long getDefaultBlockSize() { return getConf().getLongBytes(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, DFSConfigKeys.DFS_BLOCK_SIZE_DEFAULT); }
From source file:com.mellanox.r4h.TestFSOutputSummer.java
License:Apache License
private void doTestFSOutputSummer(String checksumType) throws Exception { Configuration conf = new HdfsConfiguration(); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE); conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, BYTES_PER_CHECKSUM); conf.set(DFSConfigKeys.DFS_CHECKSUM_TYPE_KEY, checksumType); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_OF_DATANODES).build(); fileSys = cluster.getFileSystem();// w w w. jav a 2 s . c o m try { Path file = new Path("try.dat"); Random rand = new Random(seed); rand.nextBytes(expected); writeFile1(file); writeFile2(file); writeFile3(file); } finally { fileSys.close(); cluster.shutdown(); } }
From source file:com.mellanox.r4h.TestFSOutputSummer.java
License:Apache License
@Test public void TestDFSCheckSumType() throws Exception { Configuration conf = new HdfsConfiguration(); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE); conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, BYTES_PER_CHECKSUM); conf.set(DFSConfigKeys.DFS_CHECKSUM_TYPE_KEY, "NULL"); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_OF_DATANODES).build(); fileSys = cluster.getFileSystem();//from w w w .j a v a 2 s. c om try { Path file = new Path("try.dat"); Random rand = new Random(seed); rand.nextBytes(expected); writeFile1(file); } finally { fileSys.close(); cluster.shutdown(); } }
From source file:com.mellanox.r4h.TestHFlush.java
License:Apache License
/** * The test uses/*from www . j a va2s .co m*/ * {@link #doTheJob(Configuration, String, long, short, boolean, EnumSet)} * to write a file with a custom block size so the writes will be * happening across block' boundaries */ @Test public void hFlush_02() throws IOException { Configuration conf = new HdfsConfiguration(); int customPerChecksumSize = 512; int customBlockSize = customPerChecksumSize * 3; // Modify defaul filesystem settings conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, customPerChecksumSize); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, customBlockSize); doTheJob(conf, fName, customBlockSize, (short) 2, false, EnumSet.noneOf(SyncFlag.class)); }
From source file:com.mellanox.r4h.TestHFlush.java
License:Apache License
/** * The test uses/*www. ja v a2s . c o m*/ * {@link #doTheJob(Configuration, String, long, short, boolean, EnumSet)} * to write a file with a custom block size so the writes will be * happening across block's and checksum' boundaries */ @Test public void hFlush_03() throws IOException { Configuration conf = new HdfsConfiguration(); int customPerChecksumSize = 400; int customBlockSize = customPerChecksumSize * 3; // Modify defaul filesystem settings conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, customPerChecksumSize); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, customBlockSize); doTheJob(conf, fName, customBlockSize, (short) 2, false, EnumSet.noneOf(SyncFlag.class)); }
From source file:com.mellanox.r4h.TestHFlush.java
License:Apache License
/** * The test calls//www .ja va2 s. c om * {@link #doTheJob(Configuration, String, long, short, boolean, EnumSet)} * while requiring the semantic of {@link SyncFlag#UPDATE_LENGTH}. * Similar with {@link #hFlush_02()} , it writes a file with a custom block * size so the writes will be happening across block' boundaries */ @Test public void hSyncUpdateLength_02() throws IOException { Configuration conf = new HdfsConfiguration(); int customPerChecksumSize = 512; int customBlockSize = customPerChecksumSize * 3; // Modify defaul filesystem settings conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, customPerChecksumSize); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, customBlockSize); doTheJob(conf, fName, customBlockSize, (short) 2, true, EnumSet.of(SyncFlag.UPDATE_LENGTH)); }
From source file:com.mellanox.r4h.TestHFlush.java
License:Apache License
/** * The test calls/* ww w .j a v a 2 s.c o m*/ * {@link #doTheJob(Configuration, String, long, short, boolean, EnumSet)} * while requiring the semantic of {@link SyncFlag#UPDATE_LENGTH}. * Similar with {@link #hFlush_03()} , it writes a file with a custom block * size so the writes will be happening across block's and checksum' * boundaries. */ @Test public void hSyncUpdateLength_03() throws IOException { Configuration conf = new HdfsConfiguration(); int customPerChecksumSize = 400; int customBlockSize = customPerChecksumSize * 3; // Modify defaul filesystem settings conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, customPerChecksumSize); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, customBlockSize); doTheJob(conf, fName, customBlockSize, (short) 2, true, EnumSet.of(SyncFlag.UPDATE_LENGTH)); }
From source file:com.mellanox.r4h.TestWriteRead.java
License:Apache License
@Before public void initJunitModeTest() throws Exception { LOG.info("initJunitModeTest"); conf = new HdfsConfiguration(); conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize); // 100K // blocksize cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); cluster.waitActive();/*from ww w. ja v a2s.com*/ mfs = cluster.getFileSystem(); mfc = FileContext.getFileContext(); Path rootdir = new Path(ROOT_DIR); mfs.mkdirs(rootdir); }
From source file:me.haohui.libhdfspp.TestRemoteBlockReaderCase.java
License:Apache License
@BeforeClass public static void setUp() throws IOException { conf = new HdfsConfiguration(); conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, BLOCK_SIZE); conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE); byte[] chars = GetCharacterTable(); CONTENTS = new byte[CONTENT_SIZE]; for (int i = 0; i < CONTENT_SIZE; ++i) { CONTENTS[i] = chars[i % chars.length]; }//from w w w . ja v a 2 s . c o m cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); fs = cluster.getFileSystem(); OutputStream os = fs.create(new Path(FILENAME)); os.write(CONTENTS); os.close(); }
From source file:net.arp7.HdfsPerfTest.WriteFileParameters.java
License:Apache License
/** * Initialize some write parameters from the configuration. * * @param conf//from w ww.j a v a 2 s . com */ private void initDefaultsFromConfiguration(Configuration conf) { blockSize = conf.getLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, DFSConfigKeys.DFS_BLOCK_SIZE_DEFAULT); replication = conf.getLong(DFSConfigKeys.DFS_REPLICATION_KEY, DFSConfigKeys.DFS_REPLICATION_DEFAULT); }