-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore: Transaction PG - Insert/Save and Read ops #37313
Conversation
WalkthroughThe changes in this pull request involve significant refactoring of the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/aspect/TransactionAspect.java (2)
32-32
: Declare OBJECTID_PATTERN as static finalTo avoid unnecessary instance creation and indicate that it's a constant, declare
OBJECTID_PATTERN
asprivate static final
.Apply this change:
- Pattern OBJECTID_PATTERN = Pattern.compile("^[0-9a-fA-F]{24}$"); + private static final Pattern OBJECTID_PATTERN = Pattern.compile("^[0-9a-fA-F]{24}$");
49-51
: Extract MethodSignature to a local variableYou're casting
joinPoint.getSignature()
toMethodSignature
multiple times. Extract it to a variable to improve readability and efficiency.Example:
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); if (isReadOp(entityData, methodSignature)) { // ... }Also applies to: 79-81
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/aspect/TransactionAspect.java
(3 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java
(1 hunks)
🔇 Additional comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/FieldNameCE.java (1)
218-218
: LGTM! Good addition for read operations.
The GET
constant follows the naming pattern of other operation constants and aligns with the transaction read operations being implemented.
app/server/appsmith-server/src/main/java/com/appsmith/server/aspect/TransactionAspect.java (1)
67-67
: Verify the default return when no conditions are met
Currently returning Mono.empty()
or Flux.empty()
if no conditions match. Confirm if this is intended or if you should proceed with the original method invocation.
Also applies to: 97-97
|
||
public static final String GET = "get"; | ||
|
||
public static final String SAVE = "save"; |
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.
Remove duplicate constant SAVE
.
The constant SAVE
duplicates the existing CREATE
constant (line 217) with the same value "save"
. Having two constants for the same operation can lead to inconsistent usage.
Apply this diff to remove the duplicate:
- public static final String SAVE = "save";
And update any new code to use the existing CREATE
constant.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
public static final String SAVE = "save"; |
transactionContext.put(id, dbOps); | ||
} | ||
return obj; | ||
transactionContext.putIfAbsent(id, dbOps); |
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.
Add null check before updating transactionContext
Ensure id
is not null before adding to transactionContext
to prevent potential NullPointerException
.
Apply this change:
- transactionContext.putIfAbsent(id, dbOps);
+ if (id != null) {
+ transactionContext.putIfAbsent(id, dbOps);
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
transactionContext.putIfAbsent(id, dbOps); | |
if (id != null) { | |
transactionContext.putIfAbsent(id, dbOps); | |
} |
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
This PR has been closed because of inactivity. |
Description
Tip
Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).
Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.
Fixes #
Issue Number
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
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?
Summary by CodeRabbit
New Features
GET
andSAVE
.Bug Fixes
Refactor