https://opendal.apache.org/ logo
Facing issue with webhdfs multi write during conca...
# general
s
Hi team, with the recent change to support multi write in webhdfs. I am testing it with hdfs 2.6 The application panics with the error
Copy code
thread 'main' panicked at src/main.rs:19:35:
called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: Unexpected (permanent) at Writer::close => deserialize json

Context:
   service: webhdfs
   path: webhdfs_test1/sink_file.txt

Source:
   EOF while parsing a value at line 1 column 0
On checking hdfs I see files are created in atomic_write_dir but the final concat to the target file seems to be failing. It could be something trivial on my end. Could you please help point out the issue? Thank you! Sharing sample code
Copy code
#[tokio::main]
async fn main() -> opendal::Result<()> {
    let mut map = HashMap::new();
    map.insert("endpoint".to_string(), "http://namenode_host:50070".to_string());
    map.insert("root".to_string(), "/".to_string());
    map.insert("atomic_write_dir".to_string(), "atomic_write_dir/".to_string());
    let op: Operator = Operator::via_map(Scheme::Webhdfs, map)?;
    let dir = op.create_dir("/webhdfs_test1/").await.unwrap();
    multi_write_example(op).await.unwrap();
    Ok(())
}

async fn multi_write_example(op: Operator) -> Result<()> {
    let mut w = op.writer_with("/webhdfs_test1/sink_file.txt").await?;
    w.write("here comes some data for line 1").await?;
    w.write("line 2 starts brings in more info").await?;
    w.close().await?;
    Ok(())
}
x
Thanks for the report. This error seems at opendal side.
Would you like to add RUST_BACKTRACE=1 and run your sample again? This will print the error backtrace so we know which line produces this error.
x
Seems webhdfs 2.6 doesn't support
noredirect
, it returns with the location and empty body instead.
That's why we failed for parsing json failed.
To fix this, we need to handle 307 redirect correctly.
Would you like to start an issue for this?
s
Sure, let me create an issue. Thank you!
I tried disabling redirect on the http client itself. The code flow went ahead and now fails at concat
Copy code
Context:
   uri: http://namenode:50070/webhdfs/v1/atomic_write_dir2/96c10cfe-dade-460e-906d-a7567ec978cd?op=CONCAT&sources=/atomic_write_dir2/2c9ad7ab-9c4c-41b7-a54a-070968ba41bc
   response: Parts { status: 400, version: HTTP/1.1, headers: {"cache-control": "no-cache", "expires": "Wed, 17 Jan 2024 04:41:10 GMT", "expires": "Wed, 17 Jan 2024 04:41:10 GMT", "date": "Wed, 17 Jan 2024 04:41:10 GMT", "date": "Wed, 17 Jan 2024 04:41:10 GMT", "pragma": "no-cache", "pragma": "no-cache", "content-type": "application/json", "x-frame-options": "SAMEORIGIN", "transfer-encoding": "chunked"} }
   service: webhdfs
   path: webhdfs_test2/sink_file.txt