/** * hdfsGetDefaultBlockSize - Get the optimum blocksize. * * @param fs The configured filesystem handle. * @return Returns the blocksize; -1 on error. */ tOffset hdfsGetDefaultBlockSize(hdfsFS fs) { tOffset res; struct hdfsFS_internal *client = fs; struct hdfs_object *ex = NULL; res = hdfs_getPreferredBlockSize(client->fs_namenode, "/", &ex); if (ex) { ERR(EIO, "getPreferredBlockSize(): %s", hdfs_exception_get_message(ex)); goto out; } out: if (ex) hdfs_object_free(ex); return res; }
END_TEST START_TEST(test_getPreferredBlockSize) { bool s; struct hdfs_object *e = NULL; const char *tf = "/HADOOFUS_TEST_GETPREFERREDBLOCKSIZE", *client = "HADOOFUS_CLIENT"; hdfs_create(h, tf, 0644, client, true/*overwrite*/, false/*createparent*/, 1/*replication*/, 64*1024*1024, &e); if (e) ck_abort_msg("exception: %s", hdfs_exception_get_message(e)); /*bs = */hdfs_getPreferredBlockSize(h, tf, &e); if (e) ck_abort_msg("exception: %s", hdfs_exception_get_message(e)); s = hdfs_delete(h, tf, false/*recurse*/, &e); if (e) ck_abort_msg("exception: %s", hdfs_exception_get_message(e)); ck_assert_msg(s, "delete returned false"); }