You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.Net MEVD: Clarify thread-safety of the abstraction #10454
Most implementation of the abstraction provide thread-safety, i.e. the instances of IVectorStore and IVectorStoreRecordCollection can be used concurrently from multiple threads; but not all.
PostgresVectorStoreRecordCollection accepts an NpgsqlDataSource, and gets a new (pooled) connection for aech operation. This is a thread-safe design, where multiple threads can use PostgresVectorStoreRecordCollection concurrently.
IMHO we should be guaranteeing thread-safety, and fix the SQLite implementation to e.g. accept a connection string (or DbDataSource) instead of a DbConnection.
I'm wondering, if we change SQLite implementation to accept a connection string, it means that we will have to create a new instance of DbConnection on our side. It will probably force us to make SqliteVectorStoreRecordCollection as IDisposable. I don't think it's a problem, but it won't be aligned with other connectors. However, thread-safety would be more important than API alignment.
If we do that, does it mean that we won't recommend registering SqliteVectorStoreRecordCollection as Singleton in user applications to avoid long-lived connections?
It will probably force us to make SqliteVectorStoreRecordCollection as IDisposable
I'm not sure - I was thinking we'd create (and open) a new SqliteConnection for each operation. After all, that's what the PostgreSQL provider does too - it just does it via NpgsqlDataSource.
I'm not sure - I was thinking we'd create (and open) a new SqliteConnection for each operation.
In that case we should be good. I didn't know about the existence of DbDataSource. If it's working with SQLite, then I guess it should be a good choice.
The Sqlite connector has been fixed to be thread-safe (#10972, accept connection string instead of DbConnection), Adam Sitnik (@adamsitnik) we need to do the same for the new SQL Server connector.
Beyond that we should add docs to IVectorStore/IVectorStoreRecordCollection to reflect that they're thread-safe unless otherwise documented (#10991).
Activity
dmytrostruk commentedon Feb 9, 2025
I'm wondering, if we change SQLite implementation to accept a connection string, it means that we will have to create a new instance of
DbConnectionon our side. It will probably force us to makeSqliteVectorStoreRecordCollectionasIDisposable. I don't think it's a problem, but it won't be aligned with other connectors. However, thread-safety would be more important than API alignment.If we do that, does it mean that we won't recommend registering
SqliteVectorStoreRecordCollectionasSingletonin user applications to avoid long-lived connections?roji commentedon Feb 9, 2025
I'm not sure - I was thinking we'd create (and open) a new SqliteConnection for each operation. After all, that's what the PostgreSQL provider does too - it just does it via NpgsqlDataSource.
dmytrostruk commentedon Feb 9, 2025
In that case we should be good. I didn't know about the existence of
DbDataSource. If it's working with SQLite, then I guess it should be a good choice.Change Sqlite connector to accept connection string instead of DbConn…
Change Sqlite connector to accept connection string instead of DbConn…
Change Sqlite connector to accept connection string instead of DbConn…
Change Sqlite connector to accept connection string instead of DbConn…
.Net: Change Sqlite connector to accept connection string instead of …
Document the default thread-safety expectation for the MEVD abstractions
roji commentedon Mar 14, 2025
The Sqlite connector has been fixed to be thread-safe (#10972, accept connection string instead of DbConnection), Adam Sitnik (@adamsitnik) we need to do the same for the new SQL Server connector.
Beyond that we should add docs to IVectorStore/IVectorStoreRecordCollection to reflect that they're thread-safe unless otherwise documented (#10991).
.Net: [TINY] Document the default thread-safety expectation for the M…
markwallace-microsoft commentedon Mar 19, 2025
Only documentation is remaining