mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.
- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
"Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
(replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
keep their upstream import paths with zero churn. Internal identifiers and
import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
help/usage/flag strings, shell autocomplete program name, and the product name
in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
(e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
`cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
updated to ignore the `s3` build output.
48 lines
2.2 KiB
Go
48 lines
2.2 KiB
Go
package mount
|
|
|
|
// evictOneWritableChunk is the callback the WriteBufferAccountant invokes
|
|
// when Reserve would otherwise block. It walks open file handles and asks
|
|
// the first one that has a writable chunk to force-seal it. Sealing moves
|
|
// the chunk into the async upload path, whose completion Releases a slot
|
|
// on the accountant and unblocks the waiter.
|
|
//
|
|
// Without this hook, workloads that open many files for write but never
|
|
// fill or close any single chunk (e.g. fio 4k randwrite across nrfiles
|
|
// where nrfiles * chunkSizeLimit > writeBufferSizeMB) deadlock
|
|
// permanently: every writable chunk reserves a full chunkSize slot on
|
|
// creation, and the pipeline only releases the slot when the chunk
|
|
// finishes uploading, which only happens after the chunk fills or the
|
|
// file closes.
|
|
//
|
|
// Performance note: this does a linear scan of fhMap.inode2fh looking
|
|
// for the first handle with a writable chunk. The scan is bounded by
|
|
// the number of open-for-write file handles at the moment Reserve
|
|
// blocks, not by nrfiles in the workload: handles that have no dirty
|
|
// pages fall through EvictOneWritableChunk in O(1) under their own
|
|
// chunksLock, so the hot-path cost is just the map walk. The scan is
|
|
// already serialized by the caller's single-flight `evicting` flag
|
|
// (one eviction across the entire accountant at a time), and happens
|
|
// only when Reserve is about to block — i.e., when the cap is actually
|
|
// exhausted and we would otherwise park a writer — so the O(N) walk is
|
|
// paid at most once per chunkSize drained, not per write. Replacing
|
|
// the map with an LRU / dirty-set would trade this for per-AddPage
|
|
// bookkeeping overhead on a hotter path; we keep the scan until a
|
|
// profile shows it mattering at the scale users actually hit.
|
|
//
|
|
// Called from WriteBufferAccountant.Reserve with accountant.mu dropped.
|
|
// Must not call anything that takes accountant.mu back; see the caller's
|
|
// single-flight `evicting` flag for safety against concurrent invocation.
|
|
func (wfs *WFS) evictOneWritableChunk(needBytes int64) bool {
|
|
wfs.fhMap.RLock()
|
|
defer wfs.fhMap.RUnlock()
|
|
for _, fh := range wfs.fhMap.inode2fh {
|
|
if fh == nil || fh.dirtyPages == nil {
|
|
continue
|
|
}
|
|
if fh.dirtyPages.EvictOneWritableChunk() {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|