Skip to content

Commit

Permalink
Merge pull request #4768 from weaviate/correct-idx-add-concurrency-pr…
Browse files Browse the repository at this point in the history
…operties

errgroup wait correction on idx add property
  • Loading branch information
moogacs committed Apr 26, 2024
2 parents 268d180 + d92cf4a commit 83a51ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions adapters/repos/db/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,12 @@ func (i *Index) addProperty(ctx context.Context, props ...*models.Property) erro

i.ForEachShard(func(key string, shard ShardLike) error {
shard.createPropertyIndex(ctx, eg, props...)
if err := eg.Wait(); err != nil {
return errors.Wrapf(err, "extend idx '%s' with properties '%v", i.ID(), props)
}
return nil
})

if err := eg.Wait(); err != nil {
return errors.Wrapf(err, "extend idx '%s' with properties '%v", i.ID(), props)
}
return nil
}

Expand Down
1 change: 0 additions & 1 deletion adapters/repos/db/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ func (s *Shard) createPropertyIndex(ctx context.Context, eg *enterrors.ErrorGrou
return nil
})
}

return nil
})

Expand Down
3 changes: 1 addition & 2 deletions usecases/schema/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/weaviate/weaviate/cluster/proto/api"
"github.com/weaviate/weaviate/entities/models"
"github.com/weaviate/weaviate/entities/schema"
schemaConfig "github.com/weaviate/weaviate/entities/schema/config"
)

type executor struct {
Expand Down Expand Up @@ -91,7 +90,7 @@ func (e *executor) UpdateClass(req api.UpdateClassRequest) error {
}
} else {
if err := e.migrator.UpdateVectorIndexConfig(ctx,
className, req.Class.VectorIndexConfig.(schemaConfig.VectorIndexConfig)); err != nil {
className, asVectorIndexConfig(req.Class)); err != nil {
return fmt.Errorf("vector index config update: %w", err)
}
}
Expand Down
9 changes: 9 additions & 0 deletions usecases/schema/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ func asVectorIndexConfigs(c *models.Class) map[string]schemaConfig.VectorIndexCo
return cfgs
}

func asVectorIndexConfig(c *models.Class) schemaConfig.VectorIndexConfig {
validCfg, ok := c.VectorIndexConfig.(schemaConfig.VectorIndexConfig)
if !ok {
return nil
}

return validCfg
}

func validateShardingConfig(current, update *models.Class, mtEnabled bool) error {
if mtEnabled {
return nil
Expand Down

0 comments on commit 83a51ad

Please sign in to comment.