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

Fix FindDocInfosByKeys when keys is empty #945

Merged
merged 3 commits into from
Jul 26, 2024
Merged

Fix FindDocInfosByKeys when keys is empty #945

merged 3 commits into from
Jul 26, 2024

Conversation

blurfx
Copy link
Member

@blurfx blurfx commented Jul 26, 2024

What this PR does / why we need it:

Fix the mongodb query keys slice to return an empty slice if it is empty.

Currently, FindDocInfosByKeys throws a query error when passing an empty slice of keys.

Which issue(s) this PR fixes:

Fixes #943

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • Bug Fixes
    • Improved robustness of the document retrieval process by preventing unnecessary database queries when no document keys are provided, resulting in a more efficient and responsive application.
  • Tests
    • Added a new test case to ensure the function correctly handles scenarios where an empty slice of keys is provided, enhancing the reliability of the document retrieval functionality.

Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

The recent changes enhance the FindDocInfosByKeys method in the Client struct by incorporating a guard clause to manage empty docKeys slices. This adjustment prevents unnecessary database queries and mitigates server crashes when the method is called without keys. By returning an empty slice along with a nil error in such scenarios, the codebase becomes more robust and improves overall error handling.

Changes

Files Change Summary
server/backend/database/mongo/client.go Introduced a conditional check in FindDocInfosByKeys to return an empty slice if docKeys is empty.
server/backend/database/testcases/testcases.go Added a test case for handling empty key slices in FindDocInfosByKeys, ensuring correct behavior.

Assessment against linked issues

Objective Addressed Explanation
Error occurs with empty docKeys argument (#943)

Poem

In the world of code, where rabbits play,
A guard clause hops in, brightening the day! 🐇
No more crashes, just a gentle return,
With empty keys, a smooth lesson learned.
So let’s celebrate this clever fix,
In the garden of code, we find our tricks! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b1f9e00 and 03f21da.

Files selected for processing (1)
  • server/backend/database/mongo/client.go (1 hunks)
Additional comments not posted (1)
server/backend/database/mongo/client.go (1)

772-774: LGTM! But verify the function usage in the codebase.

The code changes are approved. The added guard clause correctly handles the case where docKeys is an empty slice, preventing unnecessary database queries and avoiding potential server crashes.

However, ensure that all function calls to FindDocInfosByKeys properly handle the case where an empty slice is returned.

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.53%. Comparing base (b1f9e00) to head (41bdc77).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #945      +/-   ##
==========================================
+ Coverage   51.51%   51.53%   +0.01%     
==========================================
  Files          71       71              
  Lines       10583    10586       +3     
==========================================
+ Hits         5452     5455       +3     
  Misses       4585     4585              
  Partials      546      546              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 03f21da and c31cd6f.

Files selected for processing (1)
  • server/backend/database/testcases/testcases.go (1 hunks)
Additional context used
golangci-lint
server/backend/database/testcases/testcases.go

150-150: missing ',' before newline in argument list

(typecheck)

GitHub Check: build
server/backend/database/testcases/testcases.go

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )


[failure] 150-150:
missing ',' before newline in argument list (typecheck)

GitHub Check: sharding_test
server/backend/database/testcases/testcases.go

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )

Additional comments not posted (1)
server/backend/database/testcases/testcases.go (1)

130-150: LGTM! Ensure correct handling of empty key slices.

The new test case correctly verifies that FindDocInfosByKeys handles an empty slice of keys by returning an empty result without errors.

Tools
golangci-lint

150-150: missing ',' before newline in argument list

(typecheck)

GitHub Check: build

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )


[failure] 150-150:
missing ',' before newline in argument list (typecheck)

GitHub Check: sharding_test

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )

Comments failed to post (1)
server/backend/database/testcases/testcases.go

150-150: Fix the syntax error.

There is a syntax error due to a missing comma before the newline in the argument list.

-  }
+  })

Committable suggestion was skipped due to low confidence.

Tools
golangci-lint

150-150: missing ',' before newline in argument list

(typecheck)

GitHub Check: build

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )


[failure] 150-150:
missing ',' before newline in argument list (typecheck)

GitHub Check: sharding_test

[failure] 150-150:
syntax error: unexpected newline in argument list; possibly missing comma or )

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Benchmark

Benchmark suite Current: 02616d2 Previous: 03f21da Ratio
BenchmarkDocument/constructor_test 1513 ns/op 1337 B/op 24 allocs/op 1509 ns/op 1337 B/op 24 allocs/op 1.00
BenchmarkDocument/constructor_test - ns/op 1513 ns/op 1509 ns/op 1.00
BenchmarkDocument/constructor_test - B/op 1337 B/op 1337 B/op 1
BenchmarkDocument/constructor_test - allocs/op 24 allocs/op 24 allocs/op 1
BenchmarkDocument/status_test 1050 ns/op 1305 B/op 22 allocs/op 960.9 ns/op 1305 B/op 22 allocs/op 1.09
BenchmarkDocument/status_test - ns/op 1050 ns/op 960.9 ns/op 1.09
BenchmarkDocument/status_test - B/op 1305 B/op 1305 B/op 1
BenchmarkDocument/status_test - allocs/op 22 allocs/op 22 allocs/op 1
BenchmarkDocument/equals_test 8406 ns/op 7273 B/op 132 allocs/op 7628 ns/op 7273 B/op 132 allocs/op 1.10
BenchmarkDocument/equals_test - ns/op 8406 ns/op 7628 ns/op 1.10
BenchmarkDocument/equals_test - B/op 7273 B/op 7273 B/op 1
BenchmarkDocument/equals_test - allocs/op 132 allocs/op 132 allocs/op 1
BenchmarkDocument/nested_update_test 16953 ns/op 12139 B/op 262 allocs/op 17021 ns/op 12139 B/op 262 allocs/op 1.00
BenchmarkDocument/nested_update_test - ns/op 16953 ns/op 17021 ns/op 1.00
BenchmarkDocument/nested_update_test - B/op 12139 B/op 12139 B/op 1
BenchmarkDocument/nested_update_test - allocs/op 262 allocs/op 262 allocs/op 1
BenchmarkDocument/delete_test 22683 ns/op 15364 B/op 341 allocs/op 25092 ns/op 15364 B/op 341 allocs/op 0.90
BenchmarkDocument/delete_test - ns/op 22683 ns/op 25092 ns/op 0.90
BenchmarkDocument/delete_test - B/op 15364 B/op 15364 B/op 1
BenchmarkDocument/delete_test - allocs/op 341 allocs/op 341 allocs/op 1
BenchmarkDocument/object_test 8669 ns/op 6817 B/op 120 allocs/op 8801 ns/op 6817 B/op 120 allocs/op 0.99
BenchmarkDocument/object_test - ns/op 8669 ns/op 8801 ns/op 0.99
BenchmarkDocument/object_test - B/op 6817 B/op 6817 B/op 1
BenchmarkDocument/object_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/array_test 29196 ns/op 11946 B/op 276 allocs/op 29272 ns/op 11947 B/op 276 allocs/op 1.00
BenchmarkDocument/array_test - ns/op 29196 ns/op 29272 ns/op 1.00
BenchmarkDocument/array_test - B/op 11946 B/op 11947 B/op 1.00
BenchmarkDocument/array_test - allocs/op 276 allocs/op 276 allocs/op 1
BenchmarkDocument/text_test 30712 ns/op 14715 B/op 469 allocs/op 30745 ns/op 14717 B/op 469 allocs/op 1.00
BenchmarkDocument/text_test - ns/op 30712 ns/op 30745 ns/op 1.00
BenchmarkDocument/text_test - B/op 14715 B/op 14717 B/op 1.00
BenchmarkDocument/text_test - allocs/op 469 allocs/op 469 allocs/op 1
BenchmarkDocument/text_composition_test 29067 ns/op 18422 B/op 484 allocs/op 29229 ns/op 18420 B/op 484 allocs/op 0.99
BenchmarkDocument/text_composition_test - ns/op 29067 ns/op 29229 ns/op 0.99
BenchmarkDocument/text_composition_test - B/op 18422 B/op 18420 B/op 1.00
BenchmarkDocument/text_composition_test - allocs/op 484 allocs/op 484 allocs/op 1
BenchmarkDocument/rich_text_test 81021 ns/op 38476 B/op 1148 allocs/op 81596 ns/op 38477 B/op 1148 allocs/op 0.99
BenchmarkDocument/rich_text_test - ns/op 81021 ns/op 81596 ns/op 0.99
BenchmarkDocument/rich_text_test - B/op 38476 B/op 38477 B/op 1.00
BenchmarkDocument/rich_text_test - allocs/op 1148 allocs/op 1148 allocs/op 1
BenchmarkDocument/counter_test 17502 ns/op 10722 B/op 244 allocs/op 17623 ns/op 10722 B/op 244 allocs/op 0.99
BenchmarkDocument/counter_test - ns/op 17502 ns/op 17623 ns/op 0.99
BenchmarkDocument/counter_test - B/op 10722 B/op 10722 B/op 1
BenchmarkDocument/counter_test - allocs/op 244 allocs/op 244 allocs/op 1
BenchmarkDocument/text_edit_gc_100 1290017 ns/op 870913 B/op 16752 allocs/op 1333171 ns/op 870984 B/op 16753 allocs/op 0.97
BenchmarkDocument/text_edit_gc_100 - ns/op 1290017 ns/op 1333171 ns/op 0.97
BenchmarkDocument/text_edit_gc_100 - B/op 870913 B/op 870984 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 16752 allocs/op 16753 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 52544924 ns/op 50536576 B/op 181715 allocs/op 51477615 ns/op 50536207 B/op 181713 allocs/op 1.02
BenchmarkDocument/text_edit_gc_1000 - ns/op 52544924 ns/op 51477615 ns/op 1.02
BenchmarkDocument/text_edit_gc_1000 - B/op 50536576 B/op 50536207 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 181715 allocs/op 181713 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 1883196 ns/op 1528819 B/op 15604 allocs/op 1902565 ns/op 1528860 B/op 15604 allocs/op 0.99
BenchmarkDocument/text_split_gc_100 - ns/op 1883196 ns/op 1902565 ns/op 0.99
BenchmarkDocument/text_split_gc_100 - B/op 1528819 B/op 1528860 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 15604 allocs/op 15604 allocs/op 1
BenchmarkDocument/text_split_gc_1000 112295155 ns/op 135078400 B/op 182208 allocs/op 112646870 ns/op 135077647 B/op 182195 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 - ns/op 112295155 ns/op 112646870 ns/op 1.00
BenchmarkDocument/text_split_gc_1000 - B/op 135078400 B/op 135077647 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 182208 allocs/op 182195 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 16696999 ns/op 10182480 B/op 40674 allocs/op 16374506 ns/op 10184603 B/op 40679 allocs/op 1.02
BenchmarkDocument/text_delete_all_10000 - ns/op 16696999 ns/op 16374506 ns/op 1.02
BenchmarkDocument/text_delete_all_10000 - B/op 10182480 B/op 10184603 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40674 allocs/op 40679 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 298523619 ns/op 142686504 B/op 411706 allocs/op 309037084 ns/op 142651048 B/op 411606 allocs/op 0.97
BenchmarkDocument/text_delete_all_100000 - ns/op 298523619 ns/op 309037084 ns/op 0.97
BenchmarkDocument/text_delete_all_100000 - B/op 142686504 B/op 142651048 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411706 allocs/op 411606 allocs/op 1.00
BenchmarkDocument/text_100 221162 ns/op 120036 B/op 5081 allocs/op 222998 ns/op 120037 B/op 5081 allocs/op 0.99
BenchmarkDocument/text_100 - ns/op 221162 ns/op 222998 ns/op 0.99
BenchmarkDocument/text_100 - B/op 120036 B/op 120037 B/op 1.00
BenchmarkDocument/text_100 - allocs/op 5081 allocs/op 5081 allocs/op 1
BenchmarkDocument/text_1000 2374212 ns/op 1169024 B/op 50085 allocs/op 2420925 ns/op 1169024 B/op 50085 allocs/op 0.98
BenchmarkDocument/text_1000 - ns/op 2374212 ns/op 2420925 ns/op 0.98
BenchmarkDocument/text_1000 - B/op 1169024 B/op 1169024 B/op 1
BenchmarkDocument/text_1000 - allocs/op 50085 allocs/op 50085 allocs/op 1
BenchmarkDocument/array_1000 1235856 ns/op 1091437 B/op 11832 allocs/op 1244620 ns/op 1091466 B/op 11832 allocs/op 0.99
BenchmarkDocument/array_1000 - ns/op 1235856 ns/op 1244620 ns/op 0.99
BenchmarkDocument/array_1000 - B/op 1091437 B/op 1091466 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11832 allocs/op 11832 allocs/op 1
BenchmarkDocument/array_10000 13505240 ns/op 9799855 B/op 120296 allocs/op 14010425 ns/op 9800278 B/op 120298 allocs/op 0.96
BenchmarkDocument/array_10000 - ns/op 13505240 ns/op 14010425 ns/op 0.96
BenchmarkDocument/array_10000 - B/op 9799855 B/op 9800278 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120296 allocs/op 120298 allocs/op 1.00
BenchmarkDocument/array_gc_100 148486 ns/op 132717 B/op 1260 allocs/op 151169 ns/op 132718 B/op 1260 allocs/op 0.98
BenchmarkDocument/array_gc_100 - ns/op 148486 ns/op 151169 ns/op 0.98
BenchmarkDocument/array_gc_100 - B/op 132717 B/op 132718 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1260 allocs/op 1260 allocs/op 1
BenchmarkDocument/array_gc_1000 1393599 ns/op 1159166 B/op 12877 allocs/op 1431933 ns/op 1159061 B/op 12876 allocs/op 0.97
BenchmarkDocument/array_gc_1000 - ns/op 1393599 ns/op 1431933 ns/op 0.97
BenchmarkDocument/array_gc_1000 - B/op 1159166 B/op 1159061 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12877 allocs/op 12876 allocs/op 1.00
BenchmarkDocument/counter_1000 201052 ns/op 193079 B/op 5771 allocs/op 203786 ns/op 193080 B/op 5771 allocs/op 0.99
BenchmarkDocument/counter_1000 - ns/op 201052 ns/op 203786 ns/op 0.99
BenchmarkDocument/counter_1000 - B/op 193079 B/op 193080 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5771 allocs/op 5771 allocs/op 1
BenchmarkDocument/counter_10000 2175001 ns/op 2088012 B/op 59778 allocs/op 2203579 ns/op 2088014 B/op 59778 allocs/op 0.99
BenchmarkDocument/counter_10000 - ns/op 2175001 ns/op 2203579 ns/op 0.99
BenchmarkDocument/counter_10000 - B/op 2088012 B/op 2088014 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59778 allocs/op 59778 allocs/op 1
BenchmarkDocument/object_1000 1389654 ns/op 1428164 B/op 9849 allocs/op 1448050 ns/op 1427974 B/op 9849 allocs/op 0.96
BenchmarkDocument/object_1000 - ns/op 1389654 ns/op 1448050 ns/op 0.96
BenchmarkDocument/object_1000 - B/op 1428164 B/op 1427974 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9849 allocs/op 9849 allocs/op 1
BenchmarkDocument/object_10000 15306726 ns/op 12167972 B/op 100568 allocs/op 15836975 ns/op 12166838 B/op 100564 allocs/op 0.97
BenchmarkDocument/object_10000 - ns/op 15306726 ns/op 15836975 ns/op 0.97
BenchmarkDocument/object_10000 - B/op 12167972 B/op 12166838 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100568 allocs/op 100564 allocs/op 1.00
BenchmarkDocument/tree_100 1026839 ns/op 943701 B/op 6101 allocs/op 1080835 ns/op 943704 B/op 6101 allocs/op 0.95
BenchmarkDocument/tree_100 - ns/op 1026839 ns/op 1080835 ns/op 0.95
BenchmarkDocument/tree_100 - B/op 943701 B/op 943704 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6101 allocs/op 6101 allocs/op 1
BenchmarkDocument/tree_1000 74979939 ns/op 86460333 B/op 60115 allocs/op 79806064 ns/op 86460422 B/op 60114 allocs/op 0.94
BenchmarkDocument/tree_1000 - ns/op 74979939 ns/op 79806064 ns/op 0.94
BenchmarkDocument/tree_1000 - B/op 86460333 B/op 86460422 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60115 allocs/op 60114 allocs/op 1.00
BenchmarkDocument/tree_10000 9693673831 ns/op 8580669232 B/op 600217 allocs/op 9724154365 ns/op 8580986448 B/op 600268 allocs/op 1.00
BenchmarkDocument/tree_10000 - ns/op 9693673831 ns/op 9724154365 ns/op 1.00
BenchmarkDocument/tree_10000 - B/op 8580669232 B/op 8580986448 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600217 allocs/op 600268 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 75701511 ns/op 87510282 B/op 75266 allocs/op 76313898 ns/op 87510300 B/op 75264 allocs/op 0.99
BenchmarkDocument/tree_delete_all_1000 - ns/op 75701511 ns/op 76313898 ns/op 0.99
BenchmarkDocument/tree_delete_all_1000 - B/op 87510282 B/op 87510300 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 75266 allocs/op 75264 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_100 3762348 ns/op 4147775 B/op 15141 allocs/op 3800338 ns/op 4146661 B/op 15140 allocs/op 0.99
BenchmarkDocument/tree_edit_gc_100 - ns/op 3762348 ns/op 3800338 ns/op 0.99
BenchmarkDocument/tree_edit_gc_100 - B/op 4147775 B/op 4146661 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 15141 allocs/op 15140 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_1000 299420599 ns/op 383746984 B/op 154845 allocs/op 315103916 ns/op 383744860 B/op 154857 allocs/op 0.95
BenchmarkDocument/tree_edit_gc_1000 - ns/op 299420599 ns/op 315103916 ns/op 0.95
BenchmarkDocument/tree_edit_gc_1000 - B/op 383746984 B/op 383744860 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 154845 allocs/op 154857 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 2515404 ns/op 2412397 B/op 11125 allocs/op 2684625 ns/op 2412486 B/op 11125 allocs/op 0.94
BenchmarkDocument/tree_split_gc_100 - ns/op 2515404 ns/op 2684625 ns/op 0.94
BenchmarkDocument/tree_split_gc_100 - B/op 2412397 B/op 2412486 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 11125 allocs/op 11125 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 182512046 ns/op 222250386 B/op 121995 allocs/op 190592039 ns/op 222252225 B/op 121999 allocs/op 0.96
BenchmarkDocument/tree_split_gc_1000 - ns/op 182512046 ns/op 190592039 ns/op 0.96
BenchmarkDocument/tree_split_gc_1000 - B/op 222250386 B/op 222252225 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 121995 allocs/op 121999 allocs/op 1.00
BenchmarkRPC/client_to_server 388295349 ns/op 17781562 B/op 175403 allocs/op 388657660 ns/op 17255021 B/op 175433 allocs/op 1.00
BenchmarkRPC/client_to_server - ns/op 388295349 ns/op 388657660 ns/op 1.00
BenchmarkRPC/client_to_server - B/op 17781562 B/op 17255021 B/op 1.03
BenchmarkRPC/client_to_server - allocs/op 175403 allocs/op 175433 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server 642517484 ns/op 32660660 B/op 321055 allocs/op 634482974 ns/op 32288308 B/op 321527 allocs/op 1.01
BenchmarkRPC/client_to_client_via_server - ns/op 642517484 ns/op 634482974 ns/op 1.01
BenchmarkRPC/client_to_client_via_server - B/op 32660660 B/op 32288308 B/op 1.01
BenchmarkRPC/client_to_client_via_server - allocs/op 321055 allocs/op 321527 allocs/op 1.00
BenchmarkRPC/attach_large_document 1293759811 ns/op 1896282000 B/op 8942 allocs/op 1327983215 ns/op 1908562952 B/op 8900 allocs/op 0.97
BenchmarkRPC/attach_large_document - ns/op 1293759811 ns/op 1327983215 ns/op 0.97
BenchmarkRPC/attach_large_document - B/op 1896282000 B/op 1908562952 B/op 0.99
BenchmarkRPC/attach_large_document - allocs/op 8942 allocs/op 8900 allocs/op 1.00
BenchmarkRPC/adminCli_to_server 560490912 ns/op 35952696 B/op 289512 allocs/op 550865532 ns/op 35958036 B/op 289527 allocs/op 1.02
BenchmarkRPC/adminCli_to_server - ns/op 560490912 ns/op 550865532 ns/op 1.02
BenchmarkRPC/adminCli_to_server - B/op 35952696 B/op 35958036 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 289512 allocs/op 289527 allocs/op 1.00
BenchmarkLocker 64.12 ns/op 16 B/op 1 allocs/op 64.3 ns/op 16 B/op 1 allocs/op 1.00
BenchmarkLocker - ns/op 64.12 ns/op 64.3 ns/op 1.00
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel 40.59 ns/op 0 B/op 0 allocs/op 39.32 ns/op 0 B/op 0 allocs/op 1.03
BenchmarkLockerParallel - ns/op 40.59 ns/op 39.32 ns/op 1.03
BenchmarkLockerParallel - B/op 0 B/op 0 B/op 1
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkLockerMoreKeys 155.3 ns/op 15 B/op 0 allocs/op 155.4 ns/op 15 B/op 0 allocs/op 1.00
BenchmarkLockerMoreKeys - ns/op 155.3 ns/op 155.4 ns/op 1.00
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkChange/Push_10_Changes 3969296 ns/op 121107 B/op 1284 allocs/op 3940848 ns/op 121362 B/op 1284 allocs/op 1.01
BenchmarkChange/Push_10_Changes - ns/op 3969296 ns/op 3940848 ns/op 1.01
BenchmarkChange/Push_10_Changes - B/op 121107 B/op 121362 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1284 allocs/op 1284 allocs/op 1
BenchmarkChange/Push_100_Changes 14910317 ns/op 571249 B/op 6655 allocs/op 14485267 ns/op 572895 B/op 6654 allocs/op 1.03
BenchmarkChange/Push_100_Changes - ns/op 14910317 ns/op 14485267 ns/op 1.03
BenchmarkChange/Push_100_Changes - B/op 571249 B/op 572895 B/op 1.00
BenchmarkChange/Push_100_Changes - allocs/op 6655 allocs/op 6654 allocs/op 1.00
BenchmarkChange/Push_1000_Changes 119159751 ns/op 5318444 B/op 63148 allocs/op 115914517 ns/op 5349906 B/op 63149 allocs/op 1.03
BenchmarkChange/Push_1000_Changes - ns/op 119159751 ns/op 115914517 ns/op 1.03
BenchmarkChange/Push_1000_Changes - B/op 5318444 B/op 5349906 B/op 0.99
BenchmarkChange/Push_1000_Changes - allocs/op 63148 allocs/op 63149 allocs/op 1.00
BenchmarkChange/Pull_10_Changes 2960328 ns/op 100013 B/op 1004 allocs/op 2985439 ns/op 100683 B/op 1005 allocs/op 0.99
BenchmarkChange/Pull_10_Changes - ns/op 2960328 ns/op 2985439 ns/op 0.99
BenchmarkChange/Pull_10_Changes - B/op 100013 B/op 100683 B/op 0.99
BenchmarkChange/Pull_10_Changes - allocs/op 1004 allocs/op 1005 allocs/op 1.00
BenchmarkChange/Pull_100_Changes 4424651 ns/op 264397 B/op 3475 allocs/op 4519950 ns/op 265961 B/op 3475 allocs/op 0.98
BenchmarkChange/Pull_100_Changes - ns/op 4424651 ns/op 4519950 ns/op 0.98
BenchmarkChange/Pull_100_Changes - B/op 264397 B/op 265961 B/op 0.99
BenchmarkChange/Pull_100_Changes - allocs/op 3475 allocs/op 3475 allocs/op 1
BenchmarkChange/Pull_1000_Changes 8817683 ns/op 1488365 B/op 29853 allocs/op 8771095 ns/op 1492922 B/op 29854 allocs/op 1.01
BenchmarkChange/Pull_1000_Changes - ns/op 8817683 ns/op 8771095 ns/op 1.01
BenchmarkChange/Pull_1000_Changes - B/op 1488365 B/op 1492922 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 29853 allocs/op 29854 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot 17366909 ns/op 709951 B/op 6657 allocs/op 16879729 ns/op 706253 B/op 6654 allocs/op 1.03
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 17366909 ns/op 16879729 ns/op 1.03
BenchmarkSnapshot/Push_3KB_snapshot - B/op 709951 B/op 706253 B/op 1.01
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6657 allocs/op 6654 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot 122298137 ns/op 5689827 B/op 63157 allocs/op 119620221 ns/op 5671334 B/op 63149 allocs/op 1.02
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 122298137 ns/op 119620221 ns/op 1.02
BenchmarkSnapshot/Push_30KB_snapshot - B/op 5689827 B/op 5671334 B/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 63157 allocs/op 63149 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot 6499555 ns/op 920093 B/op 15511 allocs/op 6492098 ns/op 921727 B/op 15510 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6499555 ns/op 6492098 ns/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 920093 B/op 921727 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 15511 allocs/op 15510 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot 16011205 ns/op 7146489 B/op 150107 allocs/op 15570777 ns/op 7158701 B/op 150105 allocs/op 1.03
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 16011205 ns/op 15570777 ns/op 1.03
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 7146489 B/op 7158701 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 150107 allocs/op 150105 allocs/op 1.00
BenchmarkSync/memory_sync_10_test 7824 ns/op 1286 B/op 38 allocs/op 6989 ns/op 1286 B/op 38 allocs/op 1.12
BenchmarkSync/memory_sync_10_test - ns/op 7824 ns/op 6989 ns/op 1.12
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test 51997 ns/op 8635 B/op 273 allocs/op 50671 ns/op 8643 B/op 273 allocs/op 1.03
BenchmarkSync/memory_sync_100_test - ns/op 51997 ns/op 50671 ns/op 1.03
BenchmarkSync/memory_sync_100_test - B/op 8635 B/op 8643 B/op 1.00
BenchmarkSync/memory_sync_100_test - allocs/op 273 allocs/op 273 allocs/op 1
BenchmarkSync/memory_sync_1000_test 592093 ns/op 74328 B/op 2118 allocs/op 577630 ns/op 74197 B/op 2111 allocs/op 1.03
BenchmarkSync/memory_sync_1000_test - ns/op 592093 ns/op 577630 ns/op 1.03
BenchmarkSync/memory_sync_1000_test - B/op 74328 B/op 74197 B/op 1.00
BenchmarkSync/memory_sync_1000_test - allocs/op 2118 allocs/op 2111 allocs/op 1.00
BenchmarkSync/memory_sync_10000_test 7331797 ns/op 741723 B/op 20549 allocs/op 7087796 ns/op 735712 B/op 20282 allocs/op 1.03
BenchmarkSync/memory_sync_10000_test - ns/op 7331797 ns/op 7087796 ns/op 1.03
BenchmarkSync/memory_sync_10000_test - B/op 741723 B/op 735712 B/op 1.01
BenchmarkSync/memory_sync_10000_test - allocs/op 20549 allocs/op 20282 allocs/op 1.01
BenchmarkTextEditing 5125977246 ns/op 3901905648 B/op 18743158 allocs/op 5217370992 ns/op 3901893680 B/op 18743155 allocs/op 0.98
BenchmarkTextEditing - ns/op 5125977246 ns/op 5217370992 ns/op 0.98
BenchmarkTextEditing - B/op 3901905648 B/op 3901893680 B/op 1.00
BenchmarkTextEditing - allocs/op 18743158 allocs/op 18743155 allocs/op 1.00
BenchmarkTree/10000_vertices_to_protobuf 3608592 ns/op 6262995 B/op 70025 allocs/op 3523273 ns/op 6262970 B/op 70025 allocs/op 1.02
BenchmarkTree/10000_vertices_to_protobuf - ns/op 3608592 ns/op 3523273 ns/op 1.02
BenchmarkTree/10000_vertices_to_protobuf - B/op 6262995 B/op 6262970 B/op 1.00
BenchmarkTree/10000_vertices_to_protobuf - allocs/op 70025 allocs/op 70025 allocs/op 1
BenchmarkTree/10000_vertices_from_protobuf 156378198 ns/op 442172602 B/op 290039 allocs/op 155531265 ns/op 442170216 B/op 290038 allocs/op 1.01
BenchmarkTree/10000_vertices_from_protobuf - ns/op 156378198 ns/op 155531265 ns/op 1.01
BenchmarkTree/10000_vertices_from_protobuf - B/op 442172602 B/op 442170216 B/op 1.00
BenchmarkTree/10000_vertices_from_protobuf - allocs/op 290039 allocs/op 290038 allocs/op 1.00
BenchmarkTree/20000_vertices_to_protobuf 8038908 ns/op 12716924 B/op 140028 allocs/op 7683583 ns/op 12717034 B/op 140028 allocs/op 1.05
BenchmarkTree/20000_vertices_to_protobuf - ns/op 8038908 ns/op 7683583 ns/op 1.05
BenchmarkTree/20000_vertices_to_protobuf - B/op 12716924 B/op 12717034 B/op 1.00
BenchmarkTree/20000_vertices_to_protobuf - allocs/op 140028 allocs/op 140028 allocs/op 1
BenchmarkTree/20000_vertices_from_protobuf 702138384 ns/op 1697272564 B/op 580090 allocs/op 687367638 ns/op 1697267800 B/op 580042 allocs/op 1.02
BenchmarkTree/20000_vertices_from_protobuf - ns/op 702138384 ns/op 687367638 ns/op 1.02
BenchmarkTree/20000_vertices_from_protobuf - B/op 1697272564 B/op 1697267800 B/op 1.00
BenchmarkTree/20000_vertices_from_protobuf - allocs/op 580090 allocs/op 580042 allocs/op 1.00
BenchmarkTree/30000_vertices_to_protobuf 12553905 ns/op 19318323 B/op 210030 allocs/op 12217966 ns/op 19318346 B/op 210031 allocs/op 1.03
BenchmarkTree/30000_vertices_to_protobuf - ns/op 12553905 ns/op 12217966 ns/op 1.03
BenchmarkTree/30000_vertices_to_protobuf - B/op 19318323 B/op 19318346 B/op 1.00
BenchmarkTree/30000_vertices_to_protobuf - allocs/op 210030 allocs/op 210031 allocs/op 1.00
BenchmarkTree/30000_vertices_from_protobuf 1661382450 ns/op 3752036264 B/op 870049 allocs/op 1619747693 ns/op 3752052552 B/op 870050 allocs/op 1.03
BenchmarkTree/30000_vertices_from_protobuf - ns/op 1661382450 ns/op 1619747693 ns/op 1.03
BenchmarkTree/30000_vertices_from_protobuf - B/op 3752036264 B/op 3752052552 B/op 1.00
BenchmarkTree/30000_vertices_from_protobuf - allocs/op 870049 allocs/op 870050 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

server/backend/database/mongo/client.go Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c31cd6f and 02616d2.

Files selected for processing (2)
  • server/backend/database/mongo/client.go (1 hunks)
  • server/backend/database/testcases/testcases.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • server/backend/database/mongo/client.go
  • server/backend/database/testcases/testcases.go

@hackerwins hackerwins merged commit bcb246b into main Jul 26, 2024
4 checks passed
@hackerwins hackerwins deleted the fix/943 branch July 26, 2024 08:26
raararaara pushed a commit that referenced this pull request Oct 7, 2024
Fix the mongodb query keys slice to return an empty slice if it is
empty. Currently, FindDocInfosByKeys throws a query error when passing
an empty slice of keys.

---------

Co-authored-by: Youngteac Hong <susukang98@gmail.com>
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.

Error occurs when executing FindDocInfosByKeys query with empty docKeys argument
2 participants