Repository navigation
v2.7.0
This release adds HDFS federation support, lease recovery, configurable namenode timeouts, and fixes several long-standing bugs found during issue triage. Dependencies with known vulnerabilities were upgraded, which raises the minimum Go version to 1.25.
Highlights
HDFS federation support
hadoopconf now resolves namenodes per nameservice. HadoopConf.Namenodes() returns only the namenodes backing the default filesystem instead of every namenode in the configuration, so a client in a federated cluster no longer fails over to an unrelated nameservice. Use the new HadoopConf.NamenodesForNameservice(ns) to target a specific nameservice; the CLI uses it for hdfs://<nameservice>/... URLs.
Lease recovery
New Client.RecoverLease(name) asks the namenode to force-release a file's lease and close it — useful when a writer dies without closing its file. It returns true when the file is already closed or the lease was recovered. If the last block still needs recovery, the namenode starts that recovery and returns false; retry until it returns true.
Configurable namenode timeouts
ClientOptions gains NamenodeReadTimeout and NamenodeWriteTimeout, which bound the handshake and every RPC call (zero means no timeout). Deadline and dial errors now propagate correctly, and connections are closed after network errors so a timed-out response cannot be reused.
SASL override exported
ClientOptions.SkipSaslForPrivilegedDatanodePorts is now exported for external libraries such as rclone (resolves #355).
Bug fixes
- cli: glob expansion no longer fails entirely when one matched branch lacks the remaining path; missing directories are treated as empty matches, matching Hadoop's behavior (#188).
- transfer:
BlockReader.Offsetnow advances after a skip, preventing wrong bytes after a seek followed by a datanode failover (#312). - transfer: SASL integrity/privacy
Readnow accounts for buffered bytes, so callers using small buffers no longer silently lose part of the stream (#353). - transfer: a checksum mismatch now returns only the bytes that were actually validated, guaranteeing unverified data is never surfaced to the caller and triggering failover on the next read (#349).
- transfer: propagate a previously dropped error (#352).
- sasl: parse unquoted challenge values such as
charset=utf-8andalgorithm=md5-sess(#247). - rpc: report a clear error instead of
no available namenodes: %!s(<nil>)when no namenode addresses are configured (#297). - cmd/hdfs: close file handles properly (#339).
Documentation
- The Hadoop configuration directory fallback chain is documented and searched in this order:
HADOOP_CONF_DIR,$HADOOP_HOME/etc/hadoop,$HADOOP_HOME/conf, and/etc/hadoop/confon non-Windows systems. - Repository references were updated after the project moved to
wgzhao/hdfs.
Dependencies and security
golang.org/x/cryptov0.31.0 → v0.52.0golang.org/x/netv0.21.0 → v0.55.0google.golang.org/protobufv1.31.0 → v1.33.0
This resolves 21 Dependabot security alerts.
Compatibility
- The minimum Go version is now 1.25 (previously 1.22), required by
x/cryptov0.52.0 and protobuf v1.33.0. - Public API changes are additive: new
Client.RecoverLease,HadoopConf.NamenodesForNameservice, and newClientOptionsfields. No functions or methods were removed, renamed, or had their signatures changed. HadoopConf.Namenodes()now returns the default filesystem's nameservice instead of every namenode found in the configuration. Code that relied on the old behavior in a federated cluster should callNamenodesForNameserviceexplicitly.- Because
ClientOptionsgained fields, composite literals must use keyed fields.
Installation
go get github.com/colinmarc/hdfs/v2@v2.7.0Prebuilt CLI archives (Linux arm64 archives are now published as well):
| OS | Architecture | Archive |
|---|---|---|
| Linux | amd64 | gohdfs-v2.7.0-linux-amd64.tar.gz |
| Linux | arm64 | gohdfs-v2.7.0-linux-arm64.tar.gz |
| macOS | amd64 | gohdfs-v2.7.0-darwin-amd64.tar.gz |
| macOS | arm64 | gohdfs-v2.7.0-darwin-arm64.tar.gz |
| Windows | amd64 | gohdfs-v2.7.0-windows-amd64.zip |
| Windows | arm64 | gohdfs-v2.7.0-windows-arm64.zip |
Thanks
Thanks to @tolgaatam, @testwill, @zhenliuxc, @alrs, and everyone who reported and triaged issues for this release.
Full changelog: v2.6.0...v2.7.0