-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: add unique constraint restriction for KV #3723
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dracarys18
added
A-core
Area: Core flows
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
labels
Feb 20, 2024
akshay-97
approved these changes
Feb 22, 2024
jarnura
approved these changes
Feb 26, 2024
pixincreate
added a commit
that referenced
this pull request
Feb 28, 2024
…stman-runner * 'main' of github.com:juspay/hyperswitch: (22 commits) chore(version): 2024.02.28.0 chore(postman): update Postman collection files fix(connector): [AUTHORIZEDOTNET] Fix status mapping (#3845) refactor(router): added logs health and deep health (#3780) feat(roles): Change list roles, get role and authorization info api to respond with groups (#3837) fix(core): validate amount_to_capture in payment update (#3830) refactor(connector): [Square] change error message from NotSupported to NotImplemented (#2875) feat(router): add connector mit related columns to the payment methods table (#3764) ci(postman): refactor NMI postman collection (#3805) refactor(connector): [Braintree] Mask PII data (#3759) refactor(connector): [Forte] Mask PII data (#3824) refactor(compatibility): added compatibility layer request logs (#3774) refactor(payment_methods): introduce `locker_id` column in `payment_methods` table (#3760) feat(connector): mask pii information in connector request and response for stripe, aci, adyen, airwallex and authorizedotnet (#3678) chore(version): 2024.02.27.0 fix(core): do not construct request if it is already available (#3826) refactor: incorporate `hyperswitch_interface` into router (#3669) feat: add unique constraint restriction for KV (#3723) feat(connector): [Payme] Add Void flow to Payme (#3817) refactor(connector): [Cybersource] Mask PII data (#3786) ...
SanchithHegde
removed
the
S-waiting-on-review
Status: This PR has been implemented and needs to be reviewed
label
Mar 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Add constraint per table for KV.
Tables Affected:
Motivation and Context
Currently we are storing the data in redis to give a buffer time for drainer to drain the data in the database. So the problem is after drainer drains the database and the data in redis is already expired, When you insert the data with the same ID as the last it will succeed from application side but fail in drainer, So all constraints will be forgotten.
This PR fixes the above issue by using
Redis Sets
to save the constraintid's
in place. This will check Sets everytime before inserting the data and throw the Error if theid
exists.Limits of Redis Sets:
How did you test it?
ROUTER__KV_CONFIG__TTL=2
(Default is 15 in min)Payments
payment_id
. Should SucceedROUTER__KV_CONFIG__TTL
in mins and create payment with same id again. It should give Unique constraint errorRefunds
refund_id
and wait forROUTER__KV_CONFIG__TTL
in mins and create a refund with samerefund_id
it should return error with bad requestChecklist
cargo +nightly fmt --all
cargo clippy