-
Notifications
You must be signed in to change notification settings - Fork 409
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
Implement collStats
for SQLite
#3295
Implement collStats
for SQLite
#3295
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3295 +/- ##
==========================================
+ Coverage 75.09% 75.22% +0.12%
==========================================
Files 400 400
Lines 23196 23374 +178
==========================================
+ Hits 17420 17582 +162
- Misses 4756 4765 +9
- Partials 1020 1027 +7
Flags with carried forward coverage won't be shown. Click here to find out more. |
@chilagrow this pull request has merge conflicts. |
The numbers look fine
|
@chilagrow this pull request has merge conflicts. |
internal/backends/collection.go
Outdated
defer observability.FuncCall(ctx)() | ||
|
||
res, err := cc.c.Stats(ctx, params) | ||
checkError(err, ErrorCodeCollectionDoesNotExist) |
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.
Let's do the same thing as with Database's Stats: return zero-filled struct without error. That's how we handled that "error" in the handler anyway, so why return an error at all?
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.
For collStats
command, indeed it returns zero-filled struct.
However, aggregation $collStats
stage returns command error on non-existing name space, and existing compat test would fail if error isn't returned.
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.
Then, could we do the opposite and return ErrorCodeDatabaseDoesNotExist
in Database.Stats
? That would make both Stats
method consistent
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.
That would work, let me do that 👍
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.
No questions about the implementation (apart from what Alexey already asked).
I have a couple of questions about how we check errors, but it's about the new backend in general, not about this particular PR, so I'll ask on Slack.
@@ -93,7 +93,7 @@ func (h *Handler) MsgCollStats(ctx context.Context, msg *wire.OpMsg) (*wire.OpMs | |||
} | |||
|
|||
pairs = append(pairs, | |||
"storageSize", stats.SizeTotal/scale, | |||
"storageSize", stats.SizeCollection/scale, |
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.
Fix
storageSize does not include index size. See totalIndexSize for index sizing.
https://www.mongodb.com/docs/manual/reference/command/collStats/#mongodb-data-collStats.storageSize
internal/backends/collection.go
Outdated
defer observability.FuncCall(ctx)() | ||
|
||
res, err := cc.c.Stats(ctx, params) | ||
checkError(err, ErrorCodeCollectionDoesNotExist) |
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.
For collStats
command, indeed it returns zero-filled struct.
However, aggregation $collStats
stage returns command error on non-existing name space, and existing compat test would fail if error isn't returned.
@chilagrow this pull request has merge conflicts. |
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.
#3295 (comment) + plus there is a conflict now
@rumyantseva what are your questions? |
Description
Closes #3259.
Readiness checklist
task all
, and it passed.@FerretDB/core
), Milestone (Next
), Labels, Project and project's Sprint fields.