semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Qdrant MemoryStore delete collection does not perform delete operation

Open vtenisc opened this issue 2 years ago • 4 comments

Describe the bug Qdrant MemoryStore Delete collection does not perform a delete operation

The implementation code in the repo performs delete if the collection does not exists, instead you need to delete only if the collection exists.

public async Task DeleteCollectionAsync(string collectionName, CancellationToken cancellationToken = default) { if (!await this._qdrantClient.DoesCollectionExistAsync(collectionName, cancellationToken).ConfigureAwait(false)) { await this._qdrantClient.DeleteCollectionAsync(collectionName, cancellationToken).ConfigureAwait(false); } }

Instead the correct code should be this (removed ! in if condition) public async Task DeleteCollectionAsync(string collectionName, CancellationToken cancellationToken = default) { if (await this._qdrantClient.DoesCollectionExistAsync(collectionName, cancellationToken).ConfigureAwait(false)) { await this._qdrantClient.DeleteCollectionAsync(collectionName, cancellationToken).ConfigureAwait(false); } }

vtenisc avatar May 11 '23 11:05 vtenisc

@vtenisc , thanks for bringing this up. We will take a look and see what is going on.

evchaki avatar May 11 '23 20:05 evchaki

ah... I also found this bug today, which delayed me for half a day

EachShow avatar May 12 '23 10:05 EachShow

I also found this bug: Public async Task DeleteCollectionAsync(string collectionName, CancellationToken cancellationToken = default) { //if (!await this._qdrantClient.DoesCollectionExistAsync(collectionName, cancellationToken).ConfigureAwait(false)) if (await this._qdrantClient.DoesCollectionExistAsync(collectionName, cancellationToken).ConfigureAwait(false)) { await this._qdrantClient.DeleteCollectionAsync(collectionName, cancellationToken).ConfigureAwait(false); }

gpww avatar May 13 '23 01:05 gpww

I can repro the same with this code sample.

eric-urban avatar May 15 '23 17:05 eric-urban

Thank you for the heads up, PR in the queue!

craigomatic avatar May 16 '23 22:05 craigomatic

Fixed with https://github.com/microsoft/semantic-kernel/pull/1025. Thanks all for the reports, and @craigomatic for the fix.

shawncal avatar May 17 '23 05:05 shawncal