bug(services/hdfs-native): delegation tokens with NameNode addresses and viewfs:// name_node fail

Open
#9,035 3 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

The fault is in services/hdfs-native, where the name_node value is turned into a nameservice or an address list before the token is chosen. Start with that parsing and with how the token service string is matched, then compare against hdfs_native::Client using the MiniDFS setup in the report. Done means the three name_node forms list / with a delegation token and viewfs:// uses the mount table.

Written by the indexing model from the issue text.

Description

bug services/hdfs_native
OpenDAL version or commit

main (d86cd9245) with #9016 (910c76a1b) merged on top

Affected service or component

services/hdfs-native

Describe the bug

#9016 routes default and logical nameservices through the Hadoop configuration. Two name_node forms still fail where hdfs_native::Client succeeds:

  1. NameNode addresses with a delegation token. For hdfs://host:port and hdfs://nn1:port,nn2:port, the service names the nameservice nameservice. The client then uses only a token whose service is ha-hdfs:nameservice. A token that the cluster issues has the service host:port or ha-hdfs:<nameservice>, so the client skips it and SASL fails.
  2. A viewfs:// name_node. The value contains : and /, so the service parses it as a list of NameNode addresses. The client retries the address viewfs:, then fails.
Steps to Reproduce

I used MiniDFS from the hdfs-native repository. HADOOP_CONF_DIR points at the core-site.xml that it writes.

  1. Start MiniDFS with security token (and with security token ha). Set HADOOP_TOKEN_FILE_LOCATION to its delegation_token. There is no Kerberos ticket.
  2. Start MiniDFS with viewfs.
async fn list(name_node: &str, path: &str) -> opendal_core::Result<()> {
    let op = Operator::new(HdfsNative::default().name_node(name_node))?;
    op.list(path).await.map(|_| ())
}

// 1
list("hdfs://127.0.0.1:9000", "/").await?;
list("hdfs://localhost:34991,localhost:35931,localhost:44035", "/").await?; // `ha`
// 2
list("viewfs://minidfs-viewfs", "/mount1/").await?;
Actual Behavior
name_node OpenDAL hdfs_native::Client
hdfs://127.0.0.1:9000, token GSSAPI error: GssMajorCodes { raw: "0x00070000", ... } lists / (URL hdfs://127.0.0.1:9000)
HA addresses, token GSSAPI error: GssMajorCodes { raw: "0x00070000", ... } lists / (URL hdfs://minidfs-ns)
default, token lists /
viewfs://minidfs-viewfs invalid port value after about 175 s writes and lists /mount1 (URL viewfs://minidfs-viewfs)
Expected Behavior
  1. With NameNode addresses, the service uses the token that the cluster issued for them.
  2. A viewfs:// name_node uses the ViewFS mount table, as name_node = "default" does when fs.defaultFS is viewfs://....
Additional Context
  • For a single address, passing hdfs://host:port to ClientBuilder::with_url makes the client use the token service host:port, which matches the token that the cluster issues. For several addresses, a logical nameservice is the only form that matches a cluster token. That works with #9016.
  • For a viewfs:// name_node, passing the URL to ClientBuilder::with_url without change makes the client use the mount table.
Are you willing to submit a PR to fix this bug?
  • I reproduced this issue against the affected component. For a service-specific report, I used the actual service rather than only a mock, emulator, or source-code analysis.
  • Yes, I would like to submit a PR.
Dominant language
Rust
Stars
5.5k
Forks
869
Avg merge
8h 2m
Merged PRs (30d)
862

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/opendal

All issues in apache/opendal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.