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: Added indices for cross referencing changes #35401

Merged
merged 4 commits into from
Aug 5, 2024
Merged

Conversation

nidhi-nair
Copy link
Contributor

@nidhi-nair nidhi-nair commented Aug 5, 2024

Description

Creates indices for new cross referencing structure for CE domains.

Skipping EE since those domains do not have any indices yet.

Fixes #35396

Automation

/ok-to-test tags=""

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced database indexing for improved data retrieval performance in key application areas.
    • Introduced a migration script that manages the creation of compound indexes for specific collections.
  • Bug Fixes

    • Implemented error handling for index operations to improve reliability and troubleshooting.
  • Chores

    • Prepared for future rollback functionality in the migration process.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Important

Review skipped

Auto reviews are limited to specific labels.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The introduction of Migration058AddIndexesToBranchAwareDomains significantly enhances MongoDB indexing for critical collections within the application. This migration script optimizes data retrieval by establishing compound indexes on the NewPage, NewAction, and ActionCollection domains. Leveraging the Mongock framework, the asynchronous execution of index creation tasks not only improves performance but also incorporates error handling and provisions for future rollback capabilities.

Changes

File & Method Change Summary
com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java New class Migration058AddIndexesToBranchAwareDomains added; methods for index creation and rollback introduced, enhancing database performance.

Poem

In a realm of data where queries roam,
New indexes rise, a performance home.
Migration scripts dance, swift and bright,
Enhancing retrieval, making it right.
With Mongo's embrace, we soar and thrive,
In the code's gentle flow, our dreams come alive! ✨


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.

@github-actions github-actions bot added the Bug Something isn't working label Aug 5, 2024
@nidhi-nair nidhi-nair requested review from sondermanish and removed request for sharat87 and abhvsn August 5, 2024 07:50
Copy link
Contributor

@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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c0664e2 and e92f372.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java (1 hunks)
Additional context used
Learnings (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java (2)
Learnt from: trishaanand
PR: appsmithorg/appsmith#30087
File: app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration043AddIndexActionCollectionPageID.java:27-28
Timestamp: 2024-01-08T07:11:52.229Z
Learning: The user has clarified that the migration `Migration043AddIndexActionCollectionPageID` is not critical and does not require a rollback strategy.
Learnt from: mohanarpit
PR: appsmithorg/appsmith#29676
File: app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration039AddCompoundIndexForDatasourceStorage.java:18-18
Timestamp: 2023-12-18T07:46:35.484Z
Learning: The team does not practice including the author's name in the `@ChangeUnit` annotation.
Additional comments not posted (7)
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java (7)

1-13: Good job on the package and import statements!

All necessary imports are included and no unnecessary imports are present.


20-28: Well done on the class declaration and constructor!

The class is correctly annotated and the constructor initializes the required fields.


30-31: The rollbackExecution method is correctly implemented as empty.

This follows the team's practice for non-critical migrations.


33-61: Great work on the executeMigration method!

The method correctly creates indices for the specified collections using reactive programming and handles errors appropriately.


63-82: Excellent implementation of the createNewPageIndex method!

The method correctly creates the index for the NewPage collection and handles errors appropriately.


84-103: Great job on the createNewActionIndex method!

The method correctly creates the index for the NewAction collection and handles errors appropriately.


105-125: Well done on the createActionCollectionIndex method!

The method correctly creates the index for the ActionCollection collection and handles errors appropriately.

}

private void createNewPageIndex() {
String indexName = "baseId_branchName_compound_index";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Since it's common for all three domains, let's take this out?
same for the index?

sondermanish
sondermanish previously approved these changes Aug 5, 2024
Copy link
Contributor

@sondermanish sondermanish left a comment

Choose a reason for hiding this comment

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

Approved with a nit

Copy link
Contributor

@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.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e92f372 and 905ea4e.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/db/ce/Migration058AddIndexesToBranchAwareDomains.java

@nidhi-nair nidhi-nair merged commit fdcfb7c into release Aug 5, 2024
14 checks passed
@nidhi-nair nidhi-nair deleted the fix/idx-baseId branch August 5, 2024 08:03
@github-actions github-actions bot added Backend This marks the issue or pull request to reference server code Cross Referencing Resources Issues part of the default resources tech debt initiative Git Platform Issues related to the git & the app platform Git Product Issues related to version control product Task A simple Todo labels Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend This marks the issue or pull request to reference server code Bug Something isn't working Cross Referencing Resources Issues part of the default resources tech debt initiative Git Platform Issues related to the git & the app platform Git Product Issues related to version control product Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Create indices for cross referencing change
2 participants