Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/services/hdfs/hdfs_cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ runs:
cat << EOF >> $GITHUB_ENV
OPENDAL_HDFS_ROOT=/tmp/opendal/
OPENDAL_HDFS_NAME_NODE=hdfs://localhost:8020
OPENDAL_HDFS_ENABLE_APPEND=true
EOF
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ runs:
OPENDAL_HDFS_ROOT=/tmp/opendal/
OPENDAL_HDFS_ATOMIC_WRITE_DIR=/tmp/atomic_write_dir/opendal/
OPENDAL_HDFS_NAME_NODE=hdfs://localhost:8020
OPENDAL_HDFS_ENABLE_APPEND=false
EOF
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF
2 changes: 1 addition & 1 deletion .github/services/hdfs/hdfs_default/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ runs:
cat << EOF >> $GITHUB_ENV
OPENDAL_HDFS_ROOT=/tmp/opendal/
OPENDAL_HDFS_NAME_NODE=default
OPENDAL_HDFS_ENABLE_APPEND=false
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF
2 changes: 1 addition & 1 deletion .github/services/hdfs/hdfs_default_gcs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ runs:
LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${HADOOP_HOME}/lib/native
OPENDAL_HDFS_ROOT=${OPENDAL_GCS_ROOT}
OPENDAL_HDFS_NAME_NODE=gs://${OPENDAL_GCS_BUCKET}
OPENDAL_HDFS_ENABLE_APPEND=false
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF

mkdir -p /tmp/hdfs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ runs:
LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${HADOOP_HOME}/lib/native
OPENDAL_HDFS_ROOT=${OPENDAL_AZBLOB_ROOT}
OPENDAL_HDFS_NAME_NODE=wasb://${OPENDAL_AZBLOB_CONTAINER}@${OPENDAL_AZBLOB_ACCOUNT_NAME}.blob.core.windows.net
OPENDAL_HDFS_ENABLE_APPEND=false
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ runs:
CLASSPATH=${CLASSPATH}
LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${HADOOP_HOME}/lib/native
OPENDAL_HDFS_NAME_NODE=s3a://test
OPENDAL_HDFS_ENABLE_APPEND=false
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ runs:
OPENDAL_HDFS_ROOT=/tmp/opendal/
OPENDAL_HDFS_ATOMIC_WRITE_DIR=/tmp/atomic_write_dir/opendal/
OPENDAL_HDFS_NAME_NODE=default
OPENDAL_HDFS_ENABLE_APPEND=false
EOF
OPENDAL_TEST_CAPABILITY_OVERRIDES=write_can_append=false
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ runs:
cat << EOF >> $GITHUB_ENV
OPENDAL_HDFS_NATIVE_ROOT=/tmp/opendal/
OPENDAL_HDFS_NATIVE_NAME_NODE=hdfs://localhost:8020
OPENDAL_HDFS_NATIVE_ENABLE_APPEND=true
EOF
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace OpenDAL.ServiceConfig
public sealed class HdfsNativeServiceConfig : IServiceConfig
{
/// <summary>
/// enable the append capacity
/// Deprecated: HDFS Native append capability is enabled by default.
/// </summary>
public bool? EnableAppend { get; init; }
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,9 @@ public Map<String, String> configMap() {
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
class HdfsNative implements ServiceConfig {
/**
* <p>enable the append capacity</p>
* <p>Deprecated: HDFS Native append capability is enabled by default.</p>
*
* @deprecated HDFS Native append capability is enabled by default and this option is no longer needed.
*/
public final Boolean enableAppend;
/**
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/python/opendal/operator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ class AsyncOperator:
Parameters
----------
enable_append : builtins.bool, optional
enable the append capacity
Deprecated: HDFS Native append capability is enabled by default.
name_node : builtins.str, optional
name_node of this backend
options : builtins.dict, optional
Expand Down Expand Up @@ -3981,7 +3981,7 @@ class Operator:
Parameters
----------
enable_append : builtins.bool, optional
enable the append capacity
Deprecated: HDFS Native append capability is enabled by default.
name_node : builtins.str, optional
name_node of this backend
options : builtins.dict, optional
Expand Down
6 changes: 4 additions & 2 deletions bindings/python/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,8 @@ submit! {
Parameters
----------
enable_append : builtins.bool, optional
enable the append capacity
Deprecated: HDFS Native append capability is enabled
by default.
name_node : builtins.str, optional
name_node of this backend
options : builtins.dict, optional
Expand Down Expand Up @@ -3823,7 +3824,8 @@ submit! {
Parameters
----------
enable_append : builtins.bool, optional
enable the append capacity
Deprecated: HDFS Native append capability is enabled
by default.
name_node : builtins.str, optional
name_node of this backend
options : builtins.dict, optional
Expand Down
14 changes: 7 additions & 7 deletions core/services/hdfs-native/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ impl HdfsNativeBuilder {
self
}

/// Enable append capacity of this backend.
///
/// This should be disabled when HDFS runs in non-distributed mode.
pub fn enable_append(mut self, enable_append: bool) -> Self {
self.config.enable_append = enable_append;
/// Deprecated: HDFS Native append capability is enabled by default.
#[deprecated(
since = "0.57.0",
note = "HDFS Native append capability is enabled by default and this option is no longer needed."
)]
pub fn enable_append(self, _enable_append: bool) -> Self {
self
}

Expand Down Expand Up @@ -130,7 +131,7 @@ impl Builder for HdfsNativeBuilder {
read: true,

write: true,
write_can_append: self.config.enable_append,
write_can_append: true,

create_dir: true,
delete: true,
Expand All @@ -148,7 +149,6 @@ impl Builder for HdfsNativeBuilder {
},
root,
client: Arc::new(client),
enable_append: self.config.enable_append,
}),
})
}
Expand Down
8 changes: 6 additions & 2 deletions core/services/hdfs-native/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ pub struct HdfsNativeConfig {
pub root: Option<String>,
/// name_node of this backend
pub name_node: Option<String>,
/// enable the append capacity
/// Deprecated: HDFS Native append capability is enabled by default.
#[deprecated(
since = "0.57.0",
note = "HDFS Native append capability is enabled by default and this option is no longer needed."
)]
pub enable_append: bool,
/// other options for hdfs client
pub options: Option<HashMap<String, String>>,
Expand All @@ -48,7 +52,6 @@ impl Debug for HdfsNativeConfig {
f.debug_struct("HdfsNativeConfig")
.field("root", &self.root)
.field("name_node", &self.name_node)
.field("enable_append", &self.enable_append)
.field("options", &self.options)
.finish_non_exhaustive()
}
Expand All @@ -72,6 +75,7 @@ impl opendal_core::Configurator for HdfsNativeConfig {
Self::from_iter(map)
}

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
HdfsNativeBuilder { config: self }
}
Expand Down
3 changes: 0 additions & 3 deletions core/services/hdfs-native/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ pub struct HdfsNativeCore {
pub info: Arc<AccessorInfo>,
pub root: String,
pub client: Arc<hdfs_native::Client>,
pub enable_append: bool,
}

impl Debug for HdfsNativeCore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("HdfsNativeCore")
.field("root", &self.root)
.field("enable_append", &self.enable_append)
.finish_non_exhaustive()
}
}
Expand Down Expand Up @@ -116,7 +114,6 @@ impl HdfsNativeCore {

let f = if target_exists {
if args.append() {
assert!(self.enable_append, "append is not enabled");
self.client
.append(&target_path)
.await
Expand Down
2 changes: 1 addition & 1 deletion core/services/hdfs-native/src/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ This service can be used to:

- `root`: Set the work dir for backend.
- `name_node`: Set the name node for backend.
- `enable_append`: enable the append capacity. Default is false.
- `enable_append`: Deprecated. HDFS Native append capability is enabled by default and this option is no longer needed.
13 changes: 7 additions & 6 deletions core/services/hdfs/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ impl HdfsBuilder {
self
}

/// Enable append capacity of this backend.
///
/// This should be disabled when HDFS runs in non-distributed mode.
pub fn enable_append(mut self, enable_append: bool) -> Self {
self.config.enable_append = enable_append;
/// Deprecated: HDFS append capability is enabled by default.
#[deprecated(
since = "0.57.0",
note = "HDFS append capability is enabled by default and this option is no longer needed."
)]
pub fn enable_append(self, _enable_append: bool) -> Self {
self
}

Expand Down Expand Up @@ -165,7 +166,7 @@ impl Builder for HdfsBuilder {
read: true,

write: true,
write_can_append: self.config.enable_append,
write_can_append: true,

create_dir: true,
delete: true,
Expand Down
8 changes: 6 additions & 2 deletions core/services/hdfs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ pub struct HdfsConfig {
pub kerberos_ticket_cache_path: Option<String>,
/// user of this backend
pub user: Option<String>,
/// enable the append capacity
/// Deprecated: HDFS append capability is enabled by default.
#[deprecated(
since = "0.57.0",
note = "HDFS append capability is enabled by default and this option is no longer needed."
)]
pub enable_append: bool,
/// atomic_write_dir of this backend
pub atomic_write_dir: Option<String>,
Expand All @@ -53,7 +57,6 @@ impl Debug for HdfsConfig {
&self.kerberos_ticket_cache_path,
)
.field("user", &self.user)
.field("enable_append", &self.enable_append)
.field("atomic_write_dir", &self.atomic_write_dir)
.finish_non_exhaustive()
}
Expand All @@ -77,6 +80,7 @@ impl opendal_core::Configurator for HdfsConfig {
Self::from_iter(map)
}

#[allow(deprecated)]
fn into_builder(self) -> Self::Builder {
HdfsBuilder { config: self }
}
Expand Down
11 changes: 3 additions & 8 deletions core/services/hdfs/src/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ HDFS support needs to enable feature `services-hdfs`.
- `name_node`: Set the name node for backend.
- `kerberos_ticket_cache_path`: Set the kerberos ticket cache path for backend, this should be gotten by `klist` after `kinit`
- `user`: Set the user for backend
- `enable_append`: enable the append capacity. Default is false.
- `enable_append`: Deprecated. HDFS append capability is enabled by default and this option is no longer needed.

Refer to [`HdfsBuilder`]'s public API docs for more information.

Expand Down Expand Up @@ -113,19 +113,14 @@ use opendal_service_hdfs::Hdfs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create fs backend builder.
let mut builder = Hdfs::default()
let builder = Hdfs::default()
// Set the name node for hdfs.
// If the string starts with a protocol type such as file://, hdfs://, or gs://, this protocol type will be used.
.name_node("hdfs://127.0.0.1:9000")
// Set the root for hdfs, all operations will happen under this root.
//
// NOTE: the root must be absolute path.
.root("/tmp")

// Enable the append capacity for hdfs.
//
// Note: HDFS run in non-distributed mode doesn't support append.
.enable_append(true);
.root("/tmp");

// `Accessor` provides the low level APIs, we will use `Operator` normally.
let op: Operator = Operator::new(builder)?.finish();
Expand Down
Loading