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

feat: support shadow type match value #433

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

PangXing
Copy link
Contributor

What this PR does:
support shadow type match value (insert/update/delete)

Which issue(s) this PR fixes:
[Shadow config]
shadow_rule:
tables:
- name: employees.student
enable: true
match_rules:
- operation: [insert, select]
match_type: hint
attributes:
- value: "shadow"
- operation: [update]
match_type: value
attributes:
- column: uid
value: 10000
- operation: [delete]
match_type: regex
attributes:
- column: name
value: "^hanmeimei$"

Test Cases:
[hint mode]
/*A! shadow(shadow) */ INSERT INTO student(id,uid,score,name,nickname,gender,birth_year) values (1,10000,100,'lilei','shadow test',1,1980);
/*A! shadow(shadow) */ SELECT COUNT(1) FROM student WHERE uid = 10000;
[value mode]
UPDATE student SET name = 'hanmeimei' WHERE uid = 10000;
[regex mode]
DELETE FROM student WHERE uid = 10000 AND name = 'hanmeimei';

Fixes #364

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@dongzl dongzl added the shadow Shadow table. label Sep 28, 2022
@jjeffcaii jjeffcaii changed the title support shadow type match value feat: support shadow type match value Sep 28, 2022
@AlexStocks AlexStocks merged commit 9e78982 into arana-db:feat/shadow Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shadow Shadow table.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants