snapshot of https://github.com/seaweedfs/seaweedfs.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
go: build dev binaries / cleanup (push) Successful in 4s
Codespell / Check for spelling errors (push) Failing after 3s
docker: build dev containers / build-rust-binaries (amd64, x86_64-unknown-linux-musl) (push) Failing after 3s
docker: build dev containers / build-dev-containers (push) Has been skipped
docker: build dev containers / build-rust-binaries (arm64, true, aarch64-unknown-linux-musl) (push) Failing after 3s
End to End / FUSE Mount (push) Failing after 2s
EC Integration Tests / EC Integration Tests (push) Failing after 30s
FUSE DLM Integration Tests / FUSE DLM Integration Tests (push) Failing after 3s
FUSE Volume Server Failover Tests / FUSE Volume Server Failover (push) Failing after 3s
FUSE Integration Tests / FUSE Integration Testing (push) Failing after 2s
FUSE P2P Peer Chunk Sharing Integration Tests / FUSE P2P Peer Chunk Sharing (push) Failing after 3s
go: build binary / Go Vet (push) Failing after 2s
go: build binary / Go Vet 32-bit (push) Failing after 3s
go: build binary / Build (push) Failing after 4s
go: build binary / Build cross-platform (freebsd/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (darwin/arm64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/arm64) (push) Failing after 3s
go: build binary / Test (push) Failing after 2s
go: build binary / Test 32-bit (push) Failing after 3s
helm: lint and test charts / lint-test (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (11) (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (17) (push) Failing after 3s
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Failing after 2s
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Failing after 3s
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Has been skipped
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Has been skipped
Java Client Unit Tests / Java Unit Tests (11) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (17) (push) Failing after 2s
Java Client Unit Tests / Java Unit Tests (21) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (8) (push) Failing after 3s
Kafka Quick Test (Load Test with Schema Registry) / Kafka Client Load Test (Quick) (push) Failing after 3s
Kafka Gateway Tests / Kafka Unit Tests (unit-tests-1) (push) Failing after 11s
Kafka Gateway Tests / Kafka Integration Tests (Critical) (integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka End-to-End Tests (with SMQ) (e2e-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Consumer Group Tests (Highly Isolated) (consumer-group-1) (push) Failing after 2s
Kafka Gateway Tests / Kafka Client Compatibility (with SMQ) (client-compat-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka SMQ Integration Tests (Full Stack) (smq-integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Protocol Tests (Isolated) (protocol-1) (push) Failing after 3s
KMS Tests / KMS Provider Integration Tests (push) Failing after 2s
KMS Tests / S3 KMS End-to-End Tests (push) Failing after 3s
Master Cold Start Tests / Master Cold Start Tests (push) Failing after 4s
Metadata Subscribe Integration Tests / Metadata Subscribe Integration Tests (push) Failing after 3s
Multi-Master Tests / Multi-Master Failover Tests (push) Failing after 3s
Performance / CPU and Heap Profile (push) Failing after 2s
Performance / S3 Read/Write Benchmark (rust volume) (push) Failing after 3s
pjdfstest POSIX Compliance / pjdfstest (push) Failing after 2s
Plugin Worker Integration Tests / Plugin Worker: erasure_coding (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: vacuum (push) Failing after 3s
Rust Volume Server Tests / Rust Integration Tests (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 1) (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 1) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 3) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Distributed Tests (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Performance Tests (push) Failing after 3s
Performance / Throughput Benchmark (go volume) (push) Failing after 3s
Performance / Throughput Benchmark (rust volume) (push) Failing after 2s
Performance / S3 Read/Write Benchmark (go volume) (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: volume_balance (push) Failing after 3s
PostgreSQL Gateway Tests / PostgreSQL Basic Tests (push) Failing after 3s
Rust Volume Server Tests / Rust Unit Tests (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 3) (push) Failing after 3s
Rust Plugin Worker Tests / Rust Plugin Worker Build and Unit Tests (push) Failing after 3s
rust: build dev volume server binaries / cleanup (push) Successful in 3s
S3 ETag and ACL Tests / S3 ETag + ACL Integration Tests (push) Failing after 3s
S3 IAM Integration Tests / IAM Unit Tests (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (advanced) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (basic) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (group) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (policy-enforcement) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (sts) (push) Failing after 4s
S3 Keycloak Integration Tests / S3 Keycloak Integration Tests (push) Failing after 3s
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.11) (push) Failing after 3s
S3 PyArrow Parquet Tests / Go Unit Tests (Implicit Directory) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.12) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-amd64, x86_64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-arm64, aarch64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-linux (linux-amd64, x86_64-unknown-linux-gnu) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.9) (push) Has been cancelled
S3 Proxy Signature Tests / S3 Proxy Signature Verification Tests (push) Has been cancelled
S3 SDK V2 Route Disambiguation Tests / S3 SDK V2 Routing Tests (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (quick) (push) Has been cancelled
S3 SSE Tests / S3 SSE Compatibility Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Metadata Persistence Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Copy Operations Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Multipart Upload Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Performance Test (push) Has been cancelled
S3 SSE Tests / S3 Volume Encryption Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (comprehensive) (push) Has been cancelled
Spark Integration Tests / Spark Integration Tests (push) Failing after 2s
Telemetry Integration Tests / telemetry-integration-test (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 1) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 1) (push) Failing after 3s
Ceph S3 tests / Basic S3 tests (KV store) (push) Has been cancelled
Ceph S3 tests / S3 Versioning & Object Lock tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Unit Tests (push) Failing after 3s
Ceph S3 tests / S3 CORS tests (push) Has been cancelled
Ceph S3 tests / SeaweedFS Custom S3 Copy tests (push) Has been cancelled
Ceph S3 tests / Basic S3 tests (SQL store) (push) Has been cancelled
test s3 over https using aws-cli / awscli-tests (push) Has been cancelled
TLS Rotation Integration Tests / TLS Rotation Integration Tests (push) Has been cancelled
Vacuum Integration Tests / Vacuum Integration Tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Variables Integration Tests (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (advanced-policy) (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (basic-policy) (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (contextual-policy) (push) Failing after 4s
S3 Policy Integration Tests / Trusted Proxy Detection Tests (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Shell Integration Tests (push) Failing after 3s
Samba on FUSE Integration / samba-integration (push) Failing after 2s
SFTP Integration Tests / SFTP Integration Testing (push) Failing after 3s
terraform: validate and test modules / fmt, validate, plan-level tests (push) Failing after 3s
terraform: validate and test modules / local cluster smoke test (real weed) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 3) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 2) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 2) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 3) (push) Failing after 5s
mount: windows conformance / WinFsp conformance (push) Has been cancelled
mount: windows / Mount on Windows (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 03:23:42 +05:00
commit 89f5be005d
3997 changed files with 961970 additions and 0 deletions

View File

@@ -0,0 +1,281 @@
package iceberg
import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"testing"
icebergmanifest "github.com/apache/iceberg-go"
"github.com/linkedin/goavro/v2"
)
// The testdata fixtures were written by ClickHouse 25.8's experimental
// Iceberg insert against a SeaweedFS table bucket. clickhouse_rel holds the
// default output (bucket-relative paths, no field-id annotations);
// clickhouse_abs was written with write_full_path_in_iceberg_metadata=1
// (absolute paths, still no field-ids).
type fakeManifestStore struct {
files map[string][]byte
saved map[string][]byte
}
func newFakeManifestStore() *fakeManifestStore {
return &fakeManifestStore{files: map[string][]byte{}, saved: map[string][]byte{}}
}
func (f *fakeManifestStore) loadFile(_ context.Context, location string) ([]byte, error) {
if data, ok := f.files[location]; ok {
return data, nil
}
return nil, fmt.Errorf("no file at %s", location)
}
func (f *fakeManifestStore) saveFile(_ context.Context, location string, data []byte) error {
f.files[location] = data
f.saved[location] = data
return nil
}
func loadFixture(t *testing.T, parts ...string) []byte {
t.Helper()
data, err := os.ReadFile(filepath.Join(append([]string{"testdata"}, parts...)...))
if err != nil {
t.Fatalf("read fixture: %v", err)
}
return data
}
const (
relTableLocation = "s3://iceberg-tables/wprobe/target_rel"
relListName = "snap-449670589-2-48b874af-90f6-4e5e-8002-df91e59c8a0c.avro"
relManifestName = "690958a2-9936-4a04-8117-d8104c977195.avro"
absTableLocation = "s3://iceberg-tables/wprobe/target"
absListName = "snap-331611856-2-51798e6c-427b-4fc2-9149-99e75d96e045.avro"
absManifestName = "b317f0e5-10f3-41d6-86bc-8b42f01f3e86.avro"
)
// verifyRepairedManifests checks the repaired files with iceberg-go's strict
// typed readers: the manifest list parses, references the repaired manifest
// with the right length, and the manifest's data file path is absolute.
func verifyRepairedManifests(t *testing.T, store *fakeManifestStore, listLocation, tableLocation string) {
t.Helper()
listBytes, ok := store.files[listLocation]
if !ok {
t.Fatalf("repaired manifest list %s was not saved", listLocation)
}
if !bytes.Contains(listBytes, []byte(`"field-id"`)) {
t.Fatalf("repaired manifest list schema has no field-id annotations")
}
manifests, err := icebergmanifest.ReadManifestList(bytes.NewReader(listBytes))
if err != nil {
t.Fatalf("iceberg-go cannot read repaired manifest list: %v", err)
}
if len(manifests) != 1 {
t.Fatalf("manifest list has %d entries, want 1", len(manifests))
}
manifestPath := manifests[0].FilePath()
if !strings.HasPrefix(manifestPath, tableLocation+"/metadata/") {
t.Fatalf("manifest path %s is not absolute under the table location", manifestPath)
}
manifestBytes, ok := store.files[manifestPath]
if !ok {
t.Fatalf("manifest %s not present in store", manifestPath)
}
if manifests[0].Length() != int64(len(manifestBytes)) {
t.Fatalf("manifest_length %d != stored size %d", manifests[0].Length(), len(manifestBytes))
}
if !bytes.Contains(manifestBytes, []byte(`"field-id"`)) {
t.Fatalf("repaired manifest schema has no field-id annotations")
}
entries, err := icebergmanifest.ReadManifest(manifests[0], bytes.NewReader(manifestBytes), false)
if err != nil {
t.Fatalf("iceberg-go cannot read repaired manifest: %v", err)
}
if len(entries) != 1 {
t.Fatalf("manifest has %d entries, want 1", len(entries))
}
dataFile := entries[0].DataFile()
if !strings.HasPrefix(dataFile.FilePath(), "s3://iceberg-tables/") {
t.Fatalf("data file path %s is not absolute", dataFile.FilePath())
}
if dataFile.Count() != 2 {
t.Fatalf("record count %d, want 2", dataFile.Count())
}
if len(dataFile.LowerBoundValues()) == 0 {
t.Fatalf("lower bounds were lost in repair")
}
}
func addSnapshotUpdateJSON(t *testing.T, manifestList string) []json.RawMessage {
t.Helper()
update := fmt.Sprintf(`{"action":"add-snapshot","snapshot":{"snapshot-id":449670589,"sequence-number":1,"timestamp-ms":1754625869000,"manifest-list":%q,"summary":{"operation":"append"},"schema-id":0}}`, manifestList)
return []json.RawMessage{json.RawMessage(update)}
}
func TestRepairClickHouseRelativeManifests(t *testing.T) {
store := newFakeManifestStore()
store.files[relTableLocation+"/metadata/"+relListName] = loadFixture(t, "clickhouse_rel", relListName)
store.files[relTableLocation+"/metadata/"+relManifestName] = loadFixture(t, "clickhouse_rel", relManifestName)
rawUpdates := addSnapshotUpdateJSON(t, "wprobe/target_rel/metadata/"+relListName)
repaired, changed := repairAddSnapshotUpdates(context.Background(), store, relTableLocation, rawUpdates)
if !changed {
t.Fatal("expected repair to change the update")
}
var update struct {
Snapshot struct {
ManifestList string `json:"manifest-list"`
SnapshotID int64 `json:"snapshot-id"`
Summary struct {
Operation string `json:"operation"`
} `json:"summary"`
} `json:"snapshot"`
}
if err := json.Unmarshal(repaired[0], &update); err != nil {
t.Fatalf("unmarshal repaired update: %v", err)
}
wantList := relTableLocation + "/metadata/" + repairedManifestPrefix + relListName
if update.Snapshot.ManifestList != wantList {
t.Fatalf("manifest-list = %s, want %s", update.Snapshot.ManifestList, wantList)
}
// The rest of the snapshot survives the rewrite.
if update.Snapshot.SnapshotID != 449670589 || update.Snapshot.Summary.Operation != "append" {
t.Fatalf("snapshot fields were disturbed: %s", repaired[0])
}
verifyRepairedManifests(t, store, wantList, relTableLocation)
}
func TestRepairClickHouseAbsoluteManifests(t *testing.T) {
store := newFakeManifestStore()
listLocation := absTableLocation + "/metadata/" + absListName
store.files[listLocation] = loadFixture(t, "clickhouse_abs", absListName)
store.files[absTableLocation+"/metadata/"+absManifestName] = loadFixture(t, "clickhouse_abs", absManifestName)
repaired, changed, err := repairManifestList(context.Background(), store, absTableLocation, listLocation)
if err != nil {
t.Fatalf("repairManifestList: %v", err)
}
if !changed {
t.Fatal("expected repair for missing field-ids")
}
verifyRepairedManifests(t, store, repaired, absTableLocation)
}
func TestRepairedManifestsAreLeftAlone(t *testing.T) {
store := newFakeManifestStore()
listLocation := absTableLocation + "/metadata/" + absListName
store.files[listLocation] = loadFixture(t, "clickhouse_abs", absListName)
store.files[absTableLocation+"/metadata/"+absManifestName] = loadFixture(t, "clickhouse_abs", absManifestName)
firstPass, changed, err := repairManifestList(context.Background(), store, absTableLocation, listLocation)
if err != nil || !changed {
t.Fatalf("first pass: changed=%v err=%v", changed, err)
}
store.saved = map[string][]byte{}
secondPass, changed, err := repairManifestList(context.Background(), store, absTableLocation, firstPass)
if err != nil {
t.Fatalf("second pass: %v", err)
}
if changed || secondPass != firstPass {
t.Fatalf("second pass rewrote an already-repaired list: changed=%v location=%s", changed, secondPass)
}
if len(store.saved) != 0 {
t.Fatalf("second pass saved files: %v", store.saved)
}
}
func TestRepairKeepsDeleteManifestContent(t *testing.T) {
// The fixture lacks the OCF "content" key; the repaired copy must take the
// content declared by the manifest-list entry, not default to data.
raw := loadFixture(t, "clickhouse_rel", relManifestName)
repaired, changed, err := repairManifest(raw, relTableLocation, 1)
if err != nil || !changed {
t.Fatalf("repairManifest: changed=%v err=%v", changed, err)
}
reader, err := goavro.NewOCFReader(bytes.NewReader(repaired))
if err != nil {
t.Fatalf("read repaired manifest: %v", err)
}
if got := string(reader.MetaData()["content"]); got != "deletes" {
t.Fatalf(`OCF content = %q, want "deletes"`, got)
}
asData, _, err := repairManifest(raw, relTableLocation, 0)
if err != nil {
t.Fatalf("repairManifest: %v", err)
}
reader, err = goavro.NewOCFReader(bytes.NewReader(asData))
if err != nil {
t.Fatalf("read repaired manifest: %v", err)
}
if got := string(reader.MetaData()["content"]); got != "data" {
t.Fatalf(`OCF content = %q, want "data"`, got)
}
// An existing content value that contradicts the manifest-list entry is
// corrected, not preserved.
relabeled, changed, err := repairManifest(asData, relTableLocation, 1)
if err != nil || !changed {
t.Fatalf("repairManifest on mismatched content: changed=%v err=%v", changed, err)
}
reader, err = goavro.NewOCFReader(bytes.NewReader(relabeled))
if err != nil {
t.Fatalf("read relabeled manifest: %v", err)
}
if got := string(reader.MetaData()["content"]); got != "deletes" {
t.Fatalf(`OCF content after relabel = %q, want "deletes"`, got)
}
}
func TestManifestContentValue(t *testing.T) {
cases := []struct {
record map[string]any
want int
}{
{map[string]any{"content": int32(1)}, 1},
{map[string]any{"content": int64(1)}, 1},
{map[string]any{"content": map[string]any{"int": int32(1)}}, 1},
{map[string]any{"content": nil}, 0},
{map[string]any{}, 0},
}
for _, c := range cases {
if got := manifestContentValue(c.record); got != c.want {
t.Errorf("manifestContentValue(%v) = %d, want %d", c.record, got, c.want)
}
}
}
func TestRepairSkipsLocationsOutsideMetadataDir(t *testing.T) {
store := newFakeManifestStore()
rawUpdates := addSnapshotUpdateJSON(t, "s3://other-bucket/elsewhere/list.avro")
_, changed := repairAddSnapshotUpdates(context.Background(), store, relTableLocation, rawUpdates)
if changed {
t.Fatal("repair touched a manifest list outside the table metadata directory")
}
}
func TestRepairLeavesUnreadableListAlone(t *testing.T) {
store := newFakeManifestStore()
store.files[relTableLocation+"/metadata/junk.avro"] = []byte("not avro")
rawUpdates := addSnapshotUpdateJSON(t, relTableLocation+"/metadata/junk.avro")
repaired, changed := repairAddSnapshotUpdates(context.Background(), store, relTableLocation, rawUpdates)
if changed {
t.Fatal("repair claimed to change an unreadable manifest list")
}
if !bytes.Equal(repaired[0], rawUpdates[0]) {
t.Fatal("update was modified despite repair failure")
}
}