Skip to content

Commit

Permalink
fix: Workaround to not require hnsw batch params when updating an ind…
Browse files Browse the repository at this point in the history
…ex. Also remove prompt

There is still a limitation where if any batch param is provided all others must also be provided
  • Loading branch information
Jesse Schmidt committed Jul 19, 2024
1 parent 3094c99 commit ddfc709
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions cmd/indexUpdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ asvec index update -i myindex -n test --%s 10000 --%s 10000ms --%s 10s --%s 16 -
}
defer adminClient.Close()

hnswParams := &protos.HnswIndexUpdate{
MaxMemQueueSize: indexUpdateFlags.hnswMaxMemQueueSize.Val,
BatchingParams: &protos.HnswBatchingParams{
var batchingParams *protos.HnswBatchingParams
if indexUpdateFlags.hnswBatch.MaxRecords.Val != nil || indexUpdateFlags.hnswBatch.Interval.Uint32() != nil {
batchingParams = &protos.HnswBatchingParams{
MaxRecords: indexUpdateFlags.hnswBatch.MaxRecords.Val,
Interval: indexUpdateFlags.hnswBatch.Interval.Uint32(),
},
}
}

hnswParams := &protos.HnswIndexUpdate{
MaxMemQueueSize: indexUpdateFlags.hnswMaxMemQueueSize.Val,
BatchingParams: batchingParams,
CachingParams: &protos.HnswCachingParams{
MaxEntries: indexUpdateFlags.hnswCache.MaxEntries.Val,
Expiry: indexUpdateFlags.hnswCache.Expiry.Uint64(),
Expand All @@ -116,14 +121,6 @@ asvec index update -i myindex -n test --%s 10000 --%s 10000ms --%s 10s --%s 16 -
},
}

if !indexUpdateFlags.yes && !confirm(fmt.Sprintf(
"Are you sure you want to update the index %s.%s?",
indexUpdateFlags.namespace,
indexUpdateFlags.indexName,
)) {
return nil
}

ctx, cancel := context.WithTimeout(context.Background(), indexUpdateFlags.clientFlags.Timeout)
defer cancel()

Expand Down

0 comments on commit ddfc709

Please sign in to comment.