Skip to content

Instantly share code, notes, and snippets.

@Amareshwari
Created April 24, 2012 10:46
Show Gist options
  • Save Amareshwari/2478721 to your computer and use it in GitHub Desktop.
Save Amareshwari/2478721 to your computer and use it in GitHub Desktop.
Patch for Scribe : Make HDFS file writes to flush after the write
diff --git src/HdfsFile.cpp src/HdfsFile.cpp
index f1ffadf..ac5d134 100644
--- src/HdfsFile.cpp
+++ src/HdfsFile.cpp
@@ -120,12 +120,15 @@ bool HdfsFile::write(const std::string& data) {
tSize bytesWritten = hdfsWrite(fileSys, hfile, data.data(),
(tSize) data.length());
bool retVal = (bytesWritten == (tSize) data.length()) ? true : false;
+ if (retVal) {
+ hdfsHFlush(fileSys, hfile);
+ }
return retVal;
}
void HdfsFile::flush() {
if (hfile) {
- hdfsFlush(fileSys, hfile);
+ hdfsHFlush(fileSys, hfile);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment