Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new config per connection #178

Merged
merged 2 commits into from
Feb 13, 2025
Merged

Conversation

rohanshah18
Copy link
Contributor

@rohanshah18 rohanshah18 commented Feb 5, 2025

Problem

When connecting to multiple indexes using the same Pinecone instance, the connections for each index are cached in a ConcurrentHashMap called connectionsMap, which maps an indexName to its corresponding PineconeConnection. However, after establishing connections for multiple indexes, all entries in the map incorrectly point to the most recently created PineconeConnection instead of maintaining separate connections for each index.

Solution

When assigning a host to the PineconeConfig object, which is passed as input for establishing a gRPC connection, create a new PineconeConfig instance instead of modifying the existing one. Otherwise, all connection objects stored in the connectionsMap will share the same PineconeConfig instance, causing them to reference the most recently created PineconeConnection instead of maintaining separate configurations for each index.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Added integration test.

@rohanshah18 rohanshah18 marked this pull request as ready for review February 7, 2025 16:27
@rohanshah18 rohanshah18 merged commit b4cc92c into main Feb 13, 2025
8 of 9 checks passed
@rohanshah18 rohanshah18 deleted the rshah/per-connection-config branch February 13, 2025 17:34
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