-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Count Objects not working in some classes #8502
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
Comments
Thanks for opening this issue!
|
Probably related: parse-community/parse-dashboard#1637 The issue above was reported to only happen on Postgres, not on MongoDB; same as this new issue. May be DB specific, and therefore possibly a Parse Server issue. |
it indeed is parse server issue as the count is coming from parse server only. |
i found the solution should i raise MR it can be done using |
Would this be a Parse Server or Parse Dashboard PR? |
Parse server it is |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Moving the issue to Parse Server. |
🎉 This change has been released in version 6.1.0-alpha.15 |
Reopening, the fix caused other issues, see failing CI: https://github.com/parse-community/parse-server/actions/runs/5105446713/jobs/9177489496?pr=8586. Fix has been reverted with #8588. @patelmilanun could you try again? |
Can you please help me on this. Based on what I see, I can conclude that my changes are not working for other versions of PostgreSQL like 11 to 14 with different PostGIS and only work with PostgreSQL version 15 with PostGIS 3.3. So is that mean my code isn't backward compatible and I need a workaround for older versions. |
We have all the postres tests in the CI so you can see for which versions it's failing in a PR. You could start the PR with adding a tests that demonstrates that the count is incorrect, to see which versions need a fix. Then you could apply a fix depending on the version. |
@patelmilanun I made the request in #8586 (comment) to revert your PR due to it not passing the test suite. I recommend reading #8586 (comment) as it has more insight about why the count is only an
It's possible your changes are not backwards compatible. If your version of an estimate count is not available in older versions of Postgres, IMO, it may not be worth the workaround since both are only estimates. Of course, you can look into ways to detect the postgres version and use your code over the original way if you believe your estimate is always more accurate in newer versions of postgres. |
The original issue was that classes show a count of zero. If that is due to being an estimate we can change this from "bug" to "feature request". If there is any improvement possible (such as exact count if table doesn't have many rows, and only estimate if it has many rows), then we can keep this open, otherwise we can close as designed. In any case, a count of zero while there are 4 rows looks rather unexpected. |
@cbaker6 @mtrezza My changes are related to the count being wrong so how it's affecting the test case line Apart from this I followed this guide to test it https://github.com/parse-community/parse-server/blob/alpha/CONTRIBUTING.md#postgres-with-docker which starts a docker with PostgreSQL 13.8 and PostGIS 3.2.2 and it's not failing for me. |
A feature request makes sense. The count method defaults to estimating most likely due to a count being expensive, so a good design decision IMO. The dashboard uses the estimate. When a direct query asks for count it uses the expensive count. parse-server/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js Lines 2020 to 2044 in 505dd6b
Agreed... I do believe an estimate is okay as most deployed apps will have multiple classes/tables with multiple rows. The dashboard shouldn't cause an unnecessary burden on the DB. I've seen some posts about count being expensive in MongoDB as well, but haven't looked into how the parse mongo adapter is handling this. IMO the display of the amount of rows is merely a convenience and shouldn't be depended on for an exact number. It should probably be noted somewhere in the docs so postgres users who also use the Parse Dashboard don't think it's a bug. |
@patelmilanun there are multiple tests in the same function. You should verify which one is failing, my guess is it's line 203, not the one you pointed to, but I'm guessing. If you feel your adjustment improved the results, you still have to update the test cases and justify your change of the test (this would seem odd to me because you mentioned it passes for Postgres 15, but not earlier versions): parse-server/spec/InstallationsRouter.spec.js Lines 194 to 203 in 6c5f89a
One thing to remember is the CI is there to test all supported versions as developers use many different versions in their active deployments. Just because it passes one (or locally on your system), doesn't mean it will pass all others in the CI. |
@patelmilanun You may want to look online for possible solutions, row counting being a common issue, see for example https://stackoverflow.com/questions/7943233/fast-way-to-discover-the-row-count-of-a-table-in-postgresql. Off the top of my head, a possible solution could be to get the estimate first, and if the estimate is a low number (like <1k), then do an exact count. That would require 2 DB requests, but if this is the only solution due to the design limitations of the DB then it could be an option in Parse Server. I could imagine that estimated vs. exact counting is something that is also an interesting feature for normal queries. |
But I had the same PostgreSQL as well as PostGIS version as the pipeline which is failing does have. But for me its running perfectly. I don't know how to reproduce it and as such I can't even propose a solution. |
Did you run the full tests ( |
No I didn't but after ur reply I did and i'm attaching the result of U can see that there wasn't any case which are failing for me which are failing for CI with the same exact version. |
🎉 This change has been released in version 6.3.0-beta.1 |
🎉 This change has been released in version 6.3.0-alpha.1 |
🎉 This change has been released in version 6.3.0 |
New Issue Checklist
Issue Description
Dashboard doesn't count object in most of the classes
Steps to reproduce
Since the first installation I always had this issue...
Actual Outcome
Only showing '2' in the
_Session
class, the other classes show '0'Expected Outcome
To show the total of objects in each class
Environment
Parse dashboard hosted on AWS Ubuntu EC2
Dashboard
version: 4.1.1
Safari, Safari Technology Preview Release, Firefox, Chrome
Safari 15.5, Safari Technology Preview Release 146, Firefox 100.0.2, Chrome 102.0.5005.61.
Server
5.2.1
macOS Monterrey
AWS Ubuntu EC2
Database
Postgres
14.2
AWS
Logs
The text was updated successfully, but these errors were encountered: