Browse Source

clean up

pull/7178/head
chrislu 4 weeks ago
parent
commit
18fb324570
  1. 33
      test/foundationdb/README.md
  2. 49
      weed/filer/foundationdb/foundationdb_store_test.go

33
test/foundationdb/README.md

@ -38,7 +38,7 @@ make test-emulated # Test with x86 emulation
**🍎 For M1/M2/M3 Mac users:** FoundationDB's official Docker images are AMD64-only. We provide three solutions: **🍎 For M1/M2/M3 Mac users:** FoundationDB's official Docker images are AMD64-only. We provide three solutions:
- **Native ARM64** (`make setup-arm64`) - Builds FoundationDB from source (10-15 min setup, best performance)
- **Native ARM64** (`make setup-arm64`) - Builds FoundationDB from source (10-15 min setup, the best performance)
- **x86 Emulation** (`make setup-emulated`) - Uses Docker emulation (fast setup, slower runtime) - **x86 Emulation** (`make setup-emulated`) - Uses Docker emulation (fast setup, slower runtime)
- **Mock Testing** (`make test-mock`) - No FoundationDB needed (instant, tests logic only) - **Mock Testing** (`make test-mock`) - No FoundationDB needed (instant, tests logic only)
@ -244,6 +244,37 @@ docker-compose exec fdb-init fdbcli
# getrange seaweedfs seaweedfs\xFF - Show SeaweedFS keys # getrange seaweedfs seaweedfs\xFF - Show SeaweedFS keys
``` ```
### Listing Operations Return Empty Results
**Symptoms:** Uploads succeed, direct file reads work, but listing operations (s3.bucket.list, ls/tree) return no results.
**Diagnostic steps:**
```bash
# 1. Verify writes reached FoundationDB
docker-compose exec fdb-init fdbcli
> getrange seaweedfs seaweedfs\xFF
# If no keys appear, writes aren't reaching the store
# 2. Check SeaweedFS volume assignment
curl http://localhost:9333/cluster/status
# Look for "AssignVolume" errors in logs:
make logs-seaweedfs | grep -i "assignvolume\|writable"
# 3. Verify filer health and configuration
curl http://localhost:8888/statistics/health
make logs-seaweedfs | grep -i "store\|foundationdb"
```
**Interpretation:**
- No SeaweedFS keys in FDB: Directory index writes failing; check filer logs for write errors
- AssignVolume errors: Volume assignment blocked; check master status and disk space
- Filer health errors: Configuration or connectivity issue; restart services and verify filer.toml
**Recovery:**
- If fresh data: restart services (`make clean && make setup`)
- If production data: ensure volume assignment works, check disk space on data nodes
## CI Integration ## CI Integration
For continuous integration: For continuous integration:

49
weed/filer/foundationdb/foundationdb_store_test.go

@ -144,45 +144,16 @@ func TestFoundationDBStore_KeyGeneration(t *testing.T) {
t.Error("Generated key should not be empty") t.Error("Generated key should not be empty")
} }
// Test that we can extract filename back
// Note: This tests internal consistency
if tc.fileName != "" {
extractedName, err := store.extractFileName(key)
if err != nil {
t.Errorf("extractFileName failed: %v", err)
}
if extractedName != tc.fileName {
t.Errorf("Expected extracted filename '%s', got '%s'", tc.fileName, extractedName)
}
}
})
}
}
func TestFoundationDBStore_DirectoryKeyPrefix(t *testing.T) {
store := &FoundationDBStore{}
err := store.initialize(getTestClusterFile(), 740)
if err != nil {
t.Skip("FoundationDB not available for testing, skipping")
}
defer store.Shutdown()
testCases := []struct {
dirPath string
prefix string
desc string
}{
{"/", "", "root directory, no prefix"},
{"/dir", "", "subdirectory, no prefix"},
{"/dir", "test", "subdirectory with prefix"},
{"/deep/nested", "pre", "nested directory with prefix"},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
key := store.genDirectoryKeyPrefix(tc.dirPath, tc.prefix)
if len(key) == 0 {
t.Error("Generated directory key prefix should not be empty")
// Test that we can extract filename back
// Note: This tests internal consistency
if tc.fileName != "" {
extractedName, err := store.extractFileName(key)
if err != nil {
t.Errorf("extractFileName failed: %v", err)
}
if extractedName != tc.fileName {
t.Errorf("Expected extracted filename '%s', got '%s'", tc.fileName, extractedName)
}
} }
}) })
} }

Loading…
Cancel
Save