Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kemingy
Copy link
Member

@kemingy kemingy commented Jul 4, 2025

cc @xieydd

@kemingy kemingy requested a review from Copilot July 4, 2025 09:00

This comment was marked as outdated.

@kemingy kemingy requested a review from Copilot July 4, 2025 09:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the database client to use psycopg_pool.AsyncConnectionPool for managing connections and avoids conflicts in concurrent requests. It replaces the old transaction/cursor patterns with a unified get_connection context manager and updates the pipeline and registry to use it. Tests are updated to insert and query data concurrently, and a concurrency test for the HTTP service is added.

  • Introduced select_transaction_buffer_conn and limit_to_transaction_buffer_conn to scope queries to the current transaction.
  • Replaced the single-connection model in VechordClient with a connection pool and new get_connection context manager.
  • Updated pipeline and registry modules to use pooled connections and adjusted tests for concurrent behavior.
  • Added psycopg-pool dependency in pyproject.toml.

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vechord/client.py Switched to AsyncConnectionPool, added get_connection and removed old cursor management.
vechord/registry.py Updated select calls to use select_transaction_buffer_conn.
vechord/pipeline.py Replaced transaction contexts with get_connection and buffer limiters.
tests/test_table.py Adjusted test to insert chunks concurrently and renamed test.
tests/test_service.py Added a concurrent DB transaction test for the HTTP service.
pyproject.toml Added psycopg-pool dependency.
Comments suppressed due to low confidence (2)

vechord/client.py:29

  • [nitpick] Consider renaming limit_to_transaction_buffer_conn to a shorter, more descriptive name (e.g., limit_to_tx_buffer) to improve readability and maintainability.
async def limit_to_transaction_buffer_conn(conn: AsyncConnection):

vechord/client.py:55

  • Add a docstring for get_connection explaining its behavior, including when it reuses an existing transaction-scoped connection versus retrieving one from the pool.
    async def get_connection(self):

@kemingy kemingy merged commit 9d78227 into tensorchord:main Jul 4, 2025
4 checks passed
@kemingy kemingy deleted the pool branch July 4, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant