Skip to content

Commit

Permalink
add a config for using the legacy methods (apache#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbeaudreault authored Mar 16, 2023
1 parent 2f45f25 commit cd1c883
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,14 @@ public static FSDataOutputStream createForWal(FileSystem fs, Path path, boolean
*/
public static FSDataOutputStream createForWal(FileSystem fs, Path path, boolean overwrite,
int bufferSize, short replication, long blockSize, boolean isRecursive) throws IOException {
// temporary for use while we work on upgrading clients to hadoop3
if (fs.getConf().getBoolean("use.legacy.hdfs.create.methods", false)) {
if (isRecursive) {
return fs.create(path, overwrite, bufferSize, replication, blockSize);
} else {
return fs.createNonRecursive(path, overwrite, bufferSize, replication, blockSize, null);
}
}
FSDataOutputStreamBuilder<?, ?> builder = fs.createFile(path).overwrite(overwrite)
.bufferSize(bufferSize).replication(replication).blockSize(blockSize);
if (isRecursive) {
Expand Down

0 comments on commit cd1c883

Please sign in to comment.