Unified Storage Indexer: Build tenant indexes concurrently (#95795)

* WIP - build tenant indexes concurrently

* adds local dev seeders and readme for indexer

* update logging and adds locking in getShard()

* update logs

* Adds Namespaces func. Initializes index after ResourceServer is created.

* fixes Count() and updates test lint issues

* Initialize index separately. Don't do it when creating the resource server. Makes testing really awkward.

* fix lint error

* handles error when getting namespaces

* updates test and index helper funcs
This commit is contained in:
owensmallwood
2024-11-06 12:58:07 -06:00
committed by GitHub
parent 3877537dc0
commit b6596db75e
13 changed files with 373 additions and 70 deletions
+10 -2
View File
@@ -75,6 +75,8 @@ type StorageBackend interface {
// Get all events from the store
// For HA setups, this will be more events than the local WriteEvent above!
WatchWriteEvents(ctx context.Context) (<-chan *WrittenEvent, error)
Namespaces(ctx context.Context) ([]string, error)
}
// This interface is not exposed to end users directly
@@ -182,7 +184,7 @@ func NewResourceServer(opts ResourceServerOptions) (ResourceServer, error) {
UserID: 1,
IsGrafanaAdmin: true,
}))
return &server{
s := &server{
tracer: opts.Tracer,
log: logger,
backend: opts.Backend,
@@ -194,7 +196,9 @@ func NewResourceServer(opts ResourceServerOptions) (ResourceServer, error) {
now: opts.Now,
ctx: ctx,
cancel: cancel,
}, nil
}
return s, nil
}
var _ ResourceServer = &server{}
@@ -765,6 +769,10 @@ func (s *server) Origin(ctx context.Context, req *OriginRequest) (*OriginRespons
// Index returns the search index. If the index is not initialized, it will be initialized.
func (s *server) Index(ctx context.Context) (*Index, error) {
if err := s.Init(ctx); err != nil {
return nil, err
}
index := s.index.(*IndexServer)
if index.index == nil {
err := index.Init(ctx, s)