http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/LibHdfs.html
-lhdfs
-llibjvm
즉,
gcc -o 001 001.c -I/app/hdfs/include/ -L/app/hdfs/lib/native -L/app/jdk/jre/lib/amd64/server -lhdfs -ljvm
export CLASSPATH=`hadoop classpath`
export LD_LIBRARY_PATH= ...
https://issues.apache.org/jira/browse/HDFS-4953 via mmap
헐?
그냥 있네?
걱정되는 것은 포인터가 돌아다닐때 얼마나 IO를 아껴서 해줄 것이냐. 아직 안 해봐서 모른다.
똘똘하다면 포인터가 부지런히 돌아다닐때 비록 버리는 놈이 많을지언정, 로캘리티 기반으로 페이지 캐시로 펑펑 쏴올려놓은 다음 포인터가 자유롭게 여행하도록 놔둘 것이고...
대충 짰다면 포인터 돌아다닐때 IO가 겁나 폭발해서 더 느릴 것이다..
테스트는 다음 주에...
/**
* Perform a byte buffer read.
* If possible, this will be a zero-copy (mmap) read.
*
* @param file The file to read from.
* @param opts An options structure created by hadoopRzOptionsAlloc.
* @param maxLength The maximum length to read. We may read fewer bytes
* than this length.
*
* @return On success, we will return a new hadoopRzBuffer.
* This buffer will continue to be valid and readable
* until it is released by readZeroBufferFree. Failure to
* release a buffer will lead to a memory leak.
* You can access the data within the hadoopRzBuffer with
* hadoopRzBufferGet. If you have reached EOF, the data
* within the hadoopRzBuffer will be NULL. You must still
* free hadoopRzBuffer instances containing NULL.
*
* On failure, we will return NULL plus an errno code.
* errno = EOPNOTSUPP indicates that we could not do a
* zero-copy read, and there was no ByteBufferPool
* supplied.
*/
struct hadoopRzBuffer* hadoopReadZero(hdfsFile file,
struct hadoopRzOptions *opts, int32_t maxLength);