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

Added a check for bidirectional replication for matching prefix #7524

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

achouhan09
Copy link
Member

Explain the changes

  1. Replication Validation - Block bi-directional replication for matching prefixes

const replication_rules = req.rpc_params.replication_policy.rules;
// num of rules in configuration must be in defined limits
if (replication_rules.length > config.BUCKET_REPLICATION_MAX_RULES ||
replication_rules.length < 1) throw new RpcError('INVALID_REPLICATION_POLICY', 'Number of rules is invalid');

const rule_ids = [];
const pref_by_dst_bucket = {};
const src_bucket = req.system.buckets_by_name && req.system.buckets_by_name[req.name];
Copy link
Contributor

@liranmauda liranmauda Oct 5, 2023

Choose a reason for hiding this comment

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

why not get it from the rule in this request?
At this point we do not care about the bucket, only about it's name

Copy link
Member Author

Choose a reason for hiding this comment

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

Here, as in rules bucket id is stored in the DB so we need the bucket id instead of name to compare.

Copy link
Contributor

@liranmauda liranmauda left a comment

Choose a reason for hiding this comment

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

Some comments + please add some tests

@achouhan09 achouhan09 force-pushed the bidir_val branch 2 times, most recently from a07a84d to 9d63c0e Compare October 10, 2023 06:11
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 10, 2023
@achouhan09 achouhan09 marked this pull request as ready for review October 10, 2023 06:45
@achouhan09 achouhan09 force-pushed the bidir_val branch 11 times, most recently from 7491ae6 to c0bf229 Compare October 17, 2023 11:37
src/server/system_services/replication_store.js Outdated Show resolved Hide resolved
src/server/system_services/bucket_server.js Outdated Show resolved Hide resolved
src/server/system_services/bucket_server.js Show resolved Hide resolved
src/server/system_services/bucket_server.js Show resolved Hide resolved
src/server/system_services/bucket_server.js Show resolved Hide resolved
src/server/system_services/replication_store.js Outdated Show resolved Hide resolved
…g prefixes

2. Added tests for bidirectional replication validation

Signed-off-by: Aayush Chouhan <aayush.chouhan97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants