Skip to content

Releases

v2.8.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 00:31
1d184a0

v2.8.0

This release adds delegation-token authentication, hflush/hsync support in
FileWriter, and safe handling of broken write pipelines, along with ls
sorting flags and several fixes for secure clusters.

Highlights

Delegation token authentication

Clients can now authenticate with an HDFS delegation token instead of Kerberos:

  • hdfs.New honors HADOOP_TOKEN_FILE_LOCATION, reading a Hadoop token storage
    file (such as one written by hdfs fetchdt) and using its
    HDFS_DELEGATION_TOKEN. The token takes precedence over Kerberos, and the
    token's owner becomes the effective user.
  • Library users can set ClientOptions.Token, or create tokens programmatically
    with Client.GetDelegationToken, Client.RenewDelegationToken, and
    Client.CancelDelegationToken.
  • Tokens are used for both namenode SASL authentication and datanode block
    access.
  • Tokens whose expiry can be determined are renewed automatically in the
    background at half their remaining lifetime, for as long as the client is
    open.

hflush and hsync

FileWriter gains the Java client's durability primitives:

  • FileWriter.Sync() implements hflush: buffered data is sent to the
    datanodes with the sync flag set, the whole pipeline must acknowledge it, and
    new readers can see the data immediately.
  • FileWriter.Hsync() implements hsync: like Sync, plus the namenode
    fsync RPC, so the current file length is persisted on the namenode and
    visible to Stat.
  • FileReader now queries the visible length of the last block, so data made
    visible by Sync can be read before the writer calls Close.
  • Close is still required after either call.

Write pipeline failures

A broken write pipeline no longer leaves a writer that might silently truncate a
file:

  • Close fails with ErrWritePipelineFailed and deliberately does not complete
    the file.
  • IsErrWritePipelineFailed tests for it through wrapping, and
    FileWriter.Abandon() drops the partially written block before retrying or
    removing the file.
  • Pipelines fail fast on datanode failures instead of continuing with an
    unusable stream.

CLI: ls sorting

  • ls accepts -t (modification time), -c (change time), -u (access time),
    and -U (directory order).
  • Output is now sorted by name by default, matching unix ls. -c falls back to
    modification time (HDFS has no ctime), and -u falls back when access-time
    tracking is disabled.
  • When flags are combined, -U wins, then -c, -u, and -t; ties break by
    name.

Secure-cluster fixes

  • Datanode IPC connections now authenticate with the block token when one is
    available, falling back to an unauthenticated connection if the cluster
    rejects SASL. This fixes reading hflushed data on clusters with block access
    tokens enabled.
  • The effective user sent for token-authenticated datanode IPC is the short
    name, matching the Java client.
  • The datanode SASL handshake now tolerates a SUCCESS response without an
    rspauth challenge.

Compatibility

  • Public API changes are additive: ClientOptions.Token;
    Client.GetDelegationToken, Client.RenewDelegationToken, and
    Client.CancelDelegationToken; FileWriter.Sync, FileWriter.Hsync, and
    FileWriter.Abandon; ErrWritePipelineFailed and IsErrWritePipelineFailed.
    No functions or methods were removed or had their signatures changed.
  • CLI behavior change: hdfs ls now sorts entries by name by default, like unix
    ls. Use -U for directory order.
  • The minimum Go version remains 1.25.

Installation

go get github.com/colinmarc/hdfs/v2@v2.8.0

Prebuilt CLI archives:

OS Architecture Archive
Linux amd64 gohdfs-v2.8.0-linux-amd64.tar.gz
Linux arm64 gohdfs-v2.8.0-linux-arm64.tar.gz
macOS amd64 gohdfs-v2.8.0-darwin-amd64.tar.gz
macOS arm64 gohdfs-v2.8.0-darwin-arm64.tar.gz
Windows amd64 gohdfs-v2.8.0-windows-amd64.zip
Windows arm64 gohdfs-v2.8.0-windows-arm64.zip

Full changelog: v2.7.0...v2.8.0

v2.7.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 14:16
fb2bcdd

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.Offset now advances after a skip, preventing wrong bytes after a seek followed by a datanode failover (#312).
  • transfer: SASL integrity/privacy Read now 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-8 and algorithm=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/conf on non-Windows systems.
  • Repository references were updated after the project moved to wgzhao/hdfs.

Dependencies and security

  • golang.org/x/crypto v0.31.0 → v0.52.0
  • golang.org/x/net v0.21.0 → v0.55.0
  • google.golang.org/protobuf v1.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/crypto v0.52.0 and protobuf v1.33.0.
  • Public API changes are additive: new Client.RecoverLease, HadoopConf.NamenodesForNameservice, and new ClientOptions fields. 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 call NamenodesForNameservice explicitly.
  • Because ClientOptions gained fields, composite literals must use keyed fields.

Installation

go get github.com/colinmarc/hdfs/v2@v2.7.0

Prebuilt 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

v2.6.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 11:41
513000c

Full Changelog: v2.5.0...v2.6.0

v2.5.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 11:41
77e3b06

What's Changed

  • Optimization: BlockReader skip() return nil if size is 0 by @mtnk2005 in #325
  • Updated go version and crypto dependency to fix CVE-2024-453, CVE-20… by @kzgrzendek in #342

New Contributors

Full Changelog: v2.4.0...v2.5.0

v2.4.0

Choose a tag to compare

@github-actions github-actions released this 16 Jul 13:40
13d9368

This release contains numerous contributed bugfixes, as well a few changes in functionality:

  • The default checksum for written blocks has been changed from CRC32 to CRC32C, to match the behavior of the java client. (thanks @symious)
  • The hdfs binary now supports test (#292) and ls -R (#289), per the posix spec. (thanks @gardenia)

v2.3.0

Choose a tag to compare

@github-actions github-actions released this 11 Feb 10:04
36a28bc

This release, along with several bugfixes, contains new functionality:

It contains one potentially dangerous behaviour change, in b02ab58: FileWriter.Close now will correctly propagate errors in the situation where the namenode has not yet received all acks from the datanodes. Close returns a specific error in that case, ErrReplicating, which the client can either ignore or use in a retry loop. See also IsErrReplicating, for checking this case.

v2.2.1

Choose a tag to compare

@colinmarc colinmarc released this 05 Feb 22:10
e0cba43

This release contains several contributed bugfixes, notably the longstanding HDP issues described in #260.

v2.2.0

Choose a tag to compare

@colinmarc colinmarc released this 30 Dec 11:02
b2bcdb8

This overdue release contains a spate of bugfixes, as well as two major features contributed by others:

  • #236: Data transfer encryption support, for fully kerberized clusters.
  • #238: Extended attributes ("XAttr") support

v2.1.1

Choose a tag to compare

@colinmarc colinmarc released this 06 Dec 23:19
4424035

This is a small bugfix release, fixing a case where the lease renewal code didn't run, and another bug where a goroutine was possibly leaked on a call to Close. Both fixes are in 1cf907d.

v2.1.0

Choose a tag to compare

@colinmarc colinmarc released this 24 Nov 00:29
7eabc3a

This is a small release. In addition to some bug fixes, it includes a few useful features:

  • #153, #154, #208, 574b0ba: Automatic renewal of file leases and heartbeats for write streams. Both features are necessary for writes to open filesover a long period.
  • #144, #170, 1c841f7: Support for SASL-wrapped RPC communication with the namenode.
  • #205: Support for snapshots.
  • 6f7e441: A new method, RemoveAll, and a fix such that Remove is not recursive. Please be careful to check your usage of said function, as this is a fairly major change to behavior.

It also officially includes support for CDH6, although it probably worked before.

⌂ 换网址