From c566d20734820d27c0f75d2e20166d6d3ea16a0a Mon Sep 17 00:00:00 2001 From: Adam Binford Date: Sat, 6 Jan 2024 16:42:28 -0500 Subject: [PATCH] Undo overwrite change and clean up token when not being used --- .../hdfs-native/minidfs/src/main/java/main/Main.java | 2 ++ crates/hdfs-native/src/hdfs/protocol.rs | 11 +++++------ crates/hdfs-native/tests/test_ec.rs | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/hdfs-native/minidfs/src/main/java/main/Main.java b/crates/hdfs-native/minidfs/src/main/java/main/Main.java index 2201167..410577d 100644 --- a/crates/hdfs-native/minidfs/src/main/java/main/Main.java +++ b/crates/hdfs-native/minidfs/src/main/java/main/Main.java @@ -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(); } } diff --git a/crates/hdfs-native/src/hdfs/protocol.rs b/crates/hdfs-native/src/hdfs/protocol.rs index dedea15..cfe5daf 100644 --- a/crates/hdfs-native/src/hdfs/protocol.rs +++ b/crates/hdfs-native/src/hdfs/protocol.rs @@ -109,11 +109,6 @@ impl NamenodeProtocol { ) -> Result { 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, @@ -121,7 +116,11 @@ impl NamenodeProtocol { create_parent, replication, block_size, - create_flag, + create_flag: if overwrite { + hdfs::CreateFlagProto::Overwrite + } else { + hdfs::CreateFlagProto::Create + } as u32, ..Default::default() }; diff --git a/crates/hdfs-native/tests/test_ec.rs b/crates/hdfs-native/tests/test_ec.rs index be47803..bc03d86 100644 --- a/crates/hdfs-native/tests/test_ec.rs +++ b/crates/hdfs-native/tests/test_ec.rs @@ -108,6 +108,7 @@ mod test { assert!(client.delete(&file, false).await?); } + let _ = EC_FAULT_INJECTOR.lock().unwrap().take(); Ok(()) }