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

[Bug] listPaginated not returning all results #266

Open
2 tasks done
harrisonlinowes opened this issue Aug 28, 2024 · 5 comments
Open
2 tasks done

[Bug] listPaginated not returning all results #266

harrisonlinowes opened this issue Aug 28, 2024 · 5 comments
Labels
bug Something isn't working status:on-roadmap This has been picked up by the team and is on our roadmap

Comments

@harrisonlinowes
Copy link

Is this a new bug?
In other words: Is this an error, flaw, failure or fault? Please search Github issues and check our Community Forum to see if someone has already reported the bug you encountered.

If this is a request for help or troubleshooting code in your own Pinecone project, please join the Pinecone Community Forum.

  • I believe this is a new bug
  • I have searched the existing Github issues and Community Forum, and I could not find an existing post for this bug

Describe the bug
When calling the listPaginated() function with a prefix id, I am not able to receive all the expected results. I was able to validate this by calling the analogous function in python which returned different results.

Typescript code:

const recordsWithPrefix = [];
const response: ListResponse = await index.listPaginated({
  prefix: prefix,
});
recordsWithPrefix.push(...extractIdFromResponse(response));
let nextPage = response.pagination?.next;

while (nextPage !== undefined) {
  const nextResponse: ListResponse = await index.listPaginated({
    prefix: prefix,
    paginationToken: nextPage,
  });
  recordsWithPrefix.push(...extractIdFromResponse(response));
  nextPage = nextResponse.pagination?.next;
}

Python Code:

index = pc.Index("my-index")
allRecordIds = []
for ids in index.list(prefix="my_prefix"):
  allRecordIds += ids

Error information
The results from the two snippets of code above should be equivalent however they are not. The python code returns all expected record ids while the typescript code only returns a subset of ids.

Steps to reproduce the issue locally
See code above.

Environment

  • OS and version: Mac
  • Node version: v20.15.0
  • Typescript SDK version: 3.0.1

Additional context
Add any other context about the problem here.

@harrisonlinowes harrisonlinowes added the bug Something isn't working label Aug 28, 2024
@github-actions github-actions bot added the status:needs-triage An issue that needs to be triaged by the Pinecone team label Aug 28, 2024
@anawishnoff
Copy link
Contributor

Thanks for opening - the team is investigating this issue and will follow up

@anawishnoff anawishnoff added status:on-roadmap This has been picked up by the team and is on our roadmap and removed status:needs-triage An issue that needs to be triaged by the Pinecone team labels Sep 6, 2024
@max-tano
Copy link

max-tano commented Sep 10, 2024

+1 our team would really like this fixed too

@harrisonlinowes
Copy link
Author

Hi, is there any update on this?

@aulorbe
Copy link
Collaborator

aulorbe commented Oct 29, 2024

Hi, is there any update on this?

Speak of the devil! It turns out that this issue was caused by a bug on our core DB. And coincidentally that team literally just deployed the fix for it.

Will test via the TS client now and get back to you if all is clear.

(The bug was that pagination tokens were being non-deterministically returned from the core DB, so the differences you saw btwn TS and Python were actually a product of a race condition, not differences in the clients themselves.)

@aulorbe
Copy link
Collaborator

aulorbe commented Oct 31, 2024

Okay! I've confirmed their fix works on my end. Will you try now on your end and let me know if you're still seeing the error 🤞 ?

aulorbe added a commit that referenced this issue Nov 1, 2024
## Problem

The core DB previously had [a race-condition
bug](https://app.asana.com/0/1203260648987893/1207992392793971/f) that
resulted in [pagination tokens being non-deterministically returned to
the user](#266)
when they'd call the `listPaginated` endpoint (not just in the TS
client).

## Solution

The core DB team has [fixed this
bug](pinecone-io/pinecone-db#7285). Now that
it's fixed, this PR updates previously-commented-out tests + updates the
README to be more precise regarding how this method works.

## Type of Change

- [x] 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)
- [x] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)

## Test Plan

CI passes.

---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1208246198758491
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status:on-roadmap This has been picked up by the team and is on our roadmap
Projects
None yet
Development

No branches or pull requests

4 participants