Files
seaweedfs/other/java/hdfs3
490379bff3 Add codespell support with configuration and typo fixes (#10393)
* Add GitHub Actions workflow for codespell on master

* Add rudimentary codespell config

* Tune codespell config: skip generated code, ignore camelCase, whitelist domain terms

Add camelCase/PascalCase regex to ignore common Go/Rust/JS identifiers
like allLocations, publishErr, ReadInside, FlushInterval. Also skip
templ-generated *_templ.go files, and whitelist a handful of
short/domain-specific words (visibles, fo, te, ser, bject, unparseable,
keep-alives, tread, anc, ue) that show up as false positives across the
tree.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix ambiguous typos and protect false positives

Fixes typos that codespell reports with multiple candidate suggestions
(so `codespell -w` cannot auto-apply them), plus one inline pragma and
one config entry to protect legitimate identifiers.

Manual fixes (single correct answer chosen from context):
- pattens -> patterns (5x) in filer/upload/shell flag help strings
- finded  -> found (2x) in tarantool storage.lua comment
- spacify -> specify (2x) in helm chart values.yaml comment
- wether  -> whether in skiplist.go docstring
- simpe   -> simple in mq schema test case name

False-positive protection:
- Add `//codespell:ignore` next to `source GET's` (possessive of HTTP
  verb) in s3api_object_handlers_copy_stream.go
- Whitelist `auther` in .codespellrc — it's a local variable meaning
  "authenticator" in weed/security/tls.go, not a typo of "author".

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Extend codespell ignore list: .git-meta path and thirdparty groupId

Also skip `.git-meta` (scratch dir for commit messages that may contain
typo words verbatim) and whitelist `thirdparty` — it appears as the
literal Maven groupId `org.apache.hadoop.thirdparty` in hdfs3 poms
and cannot be renamed.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [DATALAD RUNCMD] Fix non-ambiguous typos with codespell -w

Auto-applied fixes to the 44 remaining single-suggestion typos across
docs, comments, log messages, tests, config, and one Java pom.

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "uvx codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

* Revert breaking codespell fixes; whitelist unknwon and atleast

Two of the auto-applied `codespell -w` fixes were false positives that
would break the build/tests:

- go.mod: `github.com/unknwon/goconfig` is a real Go module path — the
  upstream author's GitHub handle is literally `unknwon`. Renaming to
  `unknown` would fail dependency resolution.
- test/benchmark/fuse_db/bin/{sqlite_verify.py,run_mysql.sh,run_sqlite.sh}:
  `atleast` is a literal CLI mode value (a string constant compared and
  passed as a positional argument). Rewriting to `at least` splits it
  into two arguments and breaks the mode check.

Reverted those files and whitelisted both words in .codespellrc so
future runs won't re-suggest the same broken fixes.

Co-Authored-By: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Code 2.1.217 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-22 14:38:06 -07:00
..
2025-11-26 18:22:32 -08:00
2026-07-08 06:43:07 +00:00

SeaweedFS Hadoop3 Client

Hadoop FileSystem implementation for SeaweedFS, compatible with Hadoop 3.x.

Building

mvn clean install

Testing

This project includes two types of tests:

1. Configuration Tests (No SeaweedFS Required)

These tests verify configuration handling and initialization logic without requiring a running SeaweedFS instance:

mvn test -Dtest=SeaweedFileSystemConfigTest

2. Integration Tests (Requires SeaweedFS)

These tests verify actual FileSystem operations against a running SeaweedFS instance.

Prerequisites

  1. Start SeaweedFS with default ports:

    # Terminal 1: Start master
    weed master
    
    # Terminal 2: Start volume server
    weed volume -master=localhost:9333
    
    # Terminal 3: Start filer
    weed filer -master=localhost:9333
    
  2. Verify services are running:

Running Integration Tests

# Enable integration tests
export SEAWEEDFS_TEST_ENABLED=true

# Run all tests
mvn test

# Run specific test
mvn test -Dtest=SeaweedFileSystemTest

Test Configuration

Integration tests can be configured via environment variables or system properties:

  • SEAWEEDFS_TEST_ENABLED: Set to true to enable integration tests (default: false)
  • Tests use these default connection settings:
    • Filer Host: localhost
    • Filer HTTP Port: 8888
    • Filer gRPC Port: 18888

Running Tests with Custom Configuration

To test against a different SeaweedFS instance, modify the test code or use Hadoop configuration:

conf.set("fs.seaweed.filer.host", "your-host");
conf.setInt("fs.seaweed.filer.port", 8888);
conf.setInt("fs.seaweed.filer.port.grpc", 18888);

Test Coverage

The test suite covers:

  • Configuration & Initialization

    • URI parsing and configuration
    • Default values
    • Configuration overrides
    • Working directory management
  • File Operations

    • Create files
    • Read files
    • Write files
    • Append to files
    • Delete files
  • Directory Operations

    • Create directories
    • List directory contents
    • Delete directories (recursive and non-recursive)
  • Metadata Operations

    • Get file status
    • Set permissions
    • Set owner/group
    • Rename files and directories

Usage in Hadoop

  1. Copy the built JAR to your Hadoop classpath:

    cp target/seaweedfs-hadoop3-client-*.jar $HADOOP_HOME/share/hadoop/common/lib/
    
  2. Configure core-site.xml:

    <configuration>
      <property>
        <name>fs.seaweedfs.impl</name>
        <value>seaweed.hdfs.SeaweedFileSystem</value>
      </property>
      <property>
        <name>fs.seaweed.filer.host</name>
        <value>localhost</value>
      </property>
      <property>
        <name>fs.seaweed.filer.port</name>
        <value>8888</value>
      </property>
      <property>
        <name>fs.seaweed.filer.port.grpc</name>
        <value>18888</value>
      </property>
      <!-- Optional: Replication configuration with three priority levels:
           1) If set to non-empty value (e.g. "001") - uses that value
           2) If set to empty string "" - uses SeaweedFS filer's default replication
           3) If not configured (property not present) - uses HDFS replication parameter
      -->
      <!-- <property>
        <name>fs.seaweed.replication</name>
        <value>001</value>
      </property> -->
    </configuration>
    
  3. Use SeaweedFS with Hadoop commands:

    hadoop fs -ls seaweedfs://localhost:8888/
    hadoop fs -mkdir seaweedfs://localhost:8888/test
    hadoop fs -put local.txt seaweedfs://localhost:8888/test/
    

Continuous Integration

For CI environments, tests can be run in two modes:

  1. Configuration Tests Only (default, no SeaweedFS required):

    mvn test -Dtest=SeaweedFileSystemConfigTest
    
  2. Full Integration Tests (requires SeaweedFS):

    # Start SeaweedFS in CI environment
    # Then run:
    export SEAWEEDFS_TEST_ENABLED=true
    mvn test
    

Troubleshooting

Tests are skipped

If you see "Skipping test - SEAWEEDFS_TEST_ENABLED not set":

export SEAWEEDFS_TEST_ENABLED=true

Connection refused errors

Ensure SeaweedFS is running and accessible:

curl http://localhost:8888/

gRPC errors

Verify the gRPC port is accessible:

# Should show the port is listening
netstat -an | grep 18888

Contributing

When adding new features, please include:

  1. Configuration tests (no SeaweedFS required)
  2. Integration tests (with SEAWEEDFS_TEST_ENABLED guard)
  3. Documentation updates