-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix: storage used should not count failed uploads #1430
Conversation
AND u.deleted_at is null | ||
AND p.status = 'Pinned' | ||
GROUP BY c.cid, | ||
c.dag_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we group by c.dag_size
here? Will that not mean that if two files have the same dag size that one of them will be ignored?
I tried removing this line, and the tests still pass. Should we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.dag_size
is used in the SELECT
, so I'm pretty sure the expression need to be in the group_by
.
I'm not sure why the tests were not failing for you 🤔, you should get column "c.dag_size" must appear in the GROUP BY clause or be used in an aggregate function
.
Will that not mean that if two files have the same dag size that one of them will be ignored?
I don't think. The dag_size is a column on content
and we're already grouping on the primary key cid
so that adding the dag_size
shouldn't really changed the returned rows but rather just make it available to the aggreate SUM
.
Other than my one comment above, I think this all looks good. |
packages/db/postgres/migrations/016-user-used-storage-count-pinned-only.sql
Outdated
Show resolved
Hide resolved
…nned-only.sql Co-authored-by: Adam Alton <adamalton@gmail.com>
Resolves #1198