Browse Source

adds more debug messages

pull/7178/head
chrislu 2 months ago
parent
commit
829450e4a4
  1. 2
      test/foundationdb/docker-compose.arm64.yml
  2. 4
      weed/filer/foundationdb/CONFIGURATION.md
  3. 2
      weed/filer/foundationdb/INSTALL.md
  4. 2
      weed/filer/foundationdb/README.md
  5. 12
      weed/filer/foundationdb/foundationdb_store.go
  6. 12
      weed/filer/foundationdb/foundationdb_store_test.go

2
test/foundationdb/docker-compose.arm64.yml

@ -154,7 +154,7 @@ services:
WEED_LEVELDB2_ENABLED: "false"
WEED_FOUNDATIONDB_ENABLED: "true"
WEED_FOUNDATIONDB_CLUSTER_FILE: "/var/fdb/config/fdb.cluster"
WEED_FOUNDATIONDB_API_VERSION: "720"
WEED_FOUNDATIONDB_API_VERSION: "740"
WEED_FOUNDATIONDB_TIMEOUT: "5s"
WEED_FOUNDATIONDB_MAX_RETRY_DELAY: "1s"
WEED_MASTER_VOLUME_GROWTH_COPY_1: 1

4
weed/filer/foundationdb/CONFIGURATION.md

@ -23,7 +23,7 @@ All configuration options can be set via environment variables with the `WEED_FO
```bash
export WEED_FOUNDATIONDB_ENABLED=true
export WEED_FOUNDATIONDB_CLUSTER_FILE=/etc/foundationdb/fdb.cluster
export WEED_FOUNDATIONDB_API_VERSION=720
export WEED_FOUNDATIONDB_API_VERSION=740
export WEED_FOUNDATIONDB_TIMEOUT=5s
export WEED_FOUNDATIONDB_MAX_RETRY_DELAY=1s
export WEED_FOUNDATIONDB_DIRECTORY_PREFIX=seaweedfs
@ -274,7 +274,7 @@ location = "/backup"
# Docker environment
WEED_FOUNDATIONDB_ENABLED=true
WEED_FOUNDATIONDB_CLUSTER_FILE=/var/fdb/config/fdb.cluster
WEED_FOUNDATIONDB_API_VERSION=720
WEED_FOUNDATIONDB_API_VERSION=740
```
### Kubernetes ConfigMap

2
weed/filer/foundationdb/INSTALL.md

@ -135,7 +135,7 @@ Alternative configuration via environment variables:
```bash
export WEED_FOUNDATIONDB_ENABLED=true
export WEED_FOUNDATIONDB_CLUSTER_FILE=/etc/foundationdb/fdb.cluster
export WEED_FOUNDATIONDB_API_VERSION=720
export WEED_FOUNDATIONDB_API_VERSION=740
export WEED_FOUNDATIONDB_TIMEOUT=5s
export WEED_FOUNDATIONDB_MAX_RETRY_DELAY=1s
export WEED_FOUNDATIONDB_DIRECTORY_PREFIX=seaweedfs

2
weed/filer/foundationdb/README.md

@ -71,7 +71,7 @@ Configure via environment variables:
```bash
export WEED_FOUNDATIONDB_ENABLED=true
export WEED_FOUNDATIONDB_CLUSTER_FILE=/etc/foundationdb/fdb.cluster
export WEED_FOUNDATIONDB_API_VERSION=720
export WEED_FOUNDATIONDB_API_VERSION=740
export WEED_FOUNDATIONDB_TIMEOUT=5s
export WEED_FOUNDATIONDB_MAX_RETRY_DELAY=1s
export WEED_FOUNDATIONDB_DIRECTORY_PREFIX=seaweedfs

12
weed/filer/foundationdb/foundationdb_store.go

@ -381,6 +381,7 @@ func (store *FoundationDBStore) ListDirectoryPrefixedEntries(ctx context.Context
for _, kv := range kvs {
fileName := store.extractFileName(kv.Key)
if fileName == "" {
glog.V(0).Infof("list %s: failed to extract fileName from key %v", dirPath, kv.Key)
continue
}
@ -447,6 +448,9 @@ func (store *FoundationDBStore) KvGet(ctx context.Context, key []byte) ([]byte,
}
if err != nil || len(data) == 0 {
if err != nil {
glog.V(2).Infof("KvGet error for key %v: %v", key, err)
}
return nil, filer.ErrKvNotFound
}
@ -489,12 +493,18 @@ func (store *FoundationDBStore) genDirectoryKeyPrefix(dirPath, prefix string) fd
func (store *FoundationDBStore) extractFileName(key fdb.Key) string {
t, err := store.seaweedfsDir.Unpack(key)
if err != nil || len(t) < 2 {
if err != nil {
glog.V(4).Infof("extractFileName: unpack error for key %v: %v", key, err)
return ""
}
if len(t) < 2 {
glog.V(4).Infof("extractFileName: tuple too short (len=%d) for key %v", len(t), key)
return ""
}
if fileName, ok := t[1].(string); ok {
return fileName
}
glog.V(4).Infof("extractFileName: second element not a string (type=%T) for key %v", t[1], key)
return ""
}

12
weed/filer/foundationdb/foundationdb_store_test.go

@ -20,7 +20,7 @@ func TestFoundationDBStore_Initialize(t *testing.T) {
// Test with default configuration
config := util.GetViper()
config.Set("foundationdb.cluster_file", getTestClusterFile())
config.Set("foundationdb.api_version", 630)
config.Set("foundationdb.api_version", 740)
store := &FoundationDBStore{}
err := store.Initialize(config, "foundationdb.")
@ -42,7 +42,7 @@ func TestFoundationDBStore_Initialize(t *testing.T) {
func TestFoundationDBStore_InitializeWithCustomConfig(t *testing.T) {
config := util.GetViper()
config.Set("foundationdb.cluster_file", getTestClusterFile())
config.Set("foundationdb.api_version", 630)
config.Set("foundationdb.api_version", 740)
config.Set("foundationdb.timeout", "10s")
config.Set("foundationdb.max_retry_delay", "2s")
config.Set("foundationdb.directory_prefix", "custom_prefix")
@ -118,7 +118,7 @@ func TestFoundationDBStore_InitializeInvalidConfig(t *testing.T) {
func TestFoundationDBStore_KeyGeneration(t *testing.T) {
store := &FoundationDBStore{}
err := store.initialize(getTestClusterFile(), 720)
err := store.initialize(getTestClusterFile(), 740)
if err != nil {
t.Skip("FoundationDB not available for testing, skipping")
}
@ -158,7 +158,7 @@ func TestFoundationDBStore_KeyGeneration(t *testing.T) {
func TestFoundationDBStore_DirectoryKeyPrefix(t *testing.T) {
store := &FoundationDBStore{}
err := store.initialize(getTestClusterFile(), 720)
err := store.initialize(getTestClusterFile(), 740)
if err != nil {
t.Skip("FoundationDB not available for testing, skipping")
}
@ -187,7 +187,7 @@ func TestFoundationDBStore_DirectoryKeyPrefix(t *testing.T) {
func TestFoundationDBStore_ErrorHandling(t *testing.T) {
store := &FoundationDBStore{}
err := store.initialize(getTestClusterFile(), 720)
err := store.initialize(getTestClusterFile(), 740)
if err != nil {
t.Skip("FoundationDB not available for testing, skipping")
}
@ -227,7 +227,7 @@ func TestFoundationDBStore_ErrorHandling(t *testing.T) {
func TestFoundationDBStore_TransactionState(t *testing.T) {
store := &FoundationDBStore{}
err := store.initialize(getTestClusterFile(), 720)
err := store.initialize(getTestClusterFile(), 740)
if err != nil {
t.Skip("FoundationDB not available for testing, skipping")
}

Loading…
Cancel
Save