fix: Admin UI user creation fails before filer discovery (#7624) (#7625)

* fix: Admin UI user creation fails before filer discovery (#7624)

The credential manager's filer address function was not configured quickly
enough after admin server startup, causing 'filer address function not
configured' errors when users tried to create users immediately.

Changes:
- Use exponential backoff (200ms -> 5s) instead of fixed 5s polling for
  faster filer discovery on startup
- Improve error messages to be more user-friendly and actionable

Fixes #7624

* Add more debug logging to help diagnose filer discovery issues

* fix: Use dynamic filer address function to eliminate race condition

Instead of using a goroutine to wait for filer discovery before setting
the filer address function, we now set a dynamic function immediately
that returns the current filer address whenever it's called.

This eliminates the race condition where users could create users before
the goroutine completed, and provides clearer error messages when no
filer is available.

The dynamic function is HA-aware - it automatically returns whatever
filer is currently available, adapting to filer failovers.
This commit is contained in:
Chris Lu
2025-12-05 12:19:06 -08:00
committed by GitHub
parent 5c1de633cb
commit 4cc6a2a4e5
2 changed files with 13 additions and 19 deletions

View File

@@ -58,7 +58,7 @@ func (store *FilerEtcStore) withFilerClient(fn func(client filer_pb.SeaweedFiler
store.mu.RLock()
if store.filerAddressFunc == nil {
store.mu.RUnlock()
return fmt.Errorf("filer_etc: filer address function not configured")
return fmt.Errorf("filer_etc: filer not yet available - please wait for filer discovery to complete and try again")
}
filerAddress := store.filerAddressFunc()
@@ -66,7 +66,7 @@ func (store *FilerEtcStore) withFilerClient(fn func(client filer_pb.SeaweedFiler
store.mu.RUnlock()
if filerAddress == "" {
return fmt.Errorf("filer_etc: filer address is empty")
return fmt.Errorf("filer_etc: no filer discovered yet - please ensure a filer is running and accessible")
}
// Use the pb.WithGrpcFilerClient helper similar to existing code