Skip to content

Commit

Permalink
Undo overwrite change and clean up token when not being used
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimahriman committed Jan 6, 2024
1 parent 8e8d52f commit c566d20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions crates/hdfs-native/minidfs/src/main/java/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public static void main(String args[]) throws Exception {
DataOutputStream os = new DataOutputStream(new FileOutputStream("target/test/delegation_token"));
creds.writeTokenStorageToStream(os, SerializedFormat.WRITABLE);
os.close();
} else {
new File("target/test/delegation_token").delete();
}
}

Expand Down
11 changes: 5 additions & 6 deletions crates/hdfs-native/src/hdfs/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,18 @@ impl NamenodeProtocol {
) -> Result<hdfs::CreateResponseProto> {
let masked = hdfs::FsPermissionProto { perm: permission };

let mut create_flag = hdfs::CreateFlagProto::Create as u32;
if overwrite {
create_flag |= hdfs::CreateFlagProto::Overwrite as u32;
}

let message = hdfs::CreateRequestProto {
src: src.to_string(),
masked,
client_name: self.client_name.clone(),
create_parent,
replication,
block_size,
create_flag,
create_flag: if overwrite {
hdfs::CreateFlagProto::Overwrite
} else {
hdfs::CreateFlagProto::Create
} as u32,
..Default::default()
};

Expand Down
1 change: 1 addition & 0 deletions crates/hdfs-native/tests/test_ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ mod test {

assert!(client.delete(&file, false).await?);
}
let _ = EC_FAULT_INJECTOR.lock().unwrap().take();
Ok(())
}

Expand Down

0 comments on commit c566d20

Please sign in to comment.