Add regression test for recreating dropped encrypt rule#38685
Conversation
terrymanu
left a comment
There was a problem hiding this comment.
Merge Verdict: Not Mergeable
Reviewed Scope: PR #38685 latest head 3905e54, 3 changed files: standalone metadata unit test and RDL E2E XML fixtures.
Not Reviewed Scope: I did not run Maven tests locally; I relied on PR CI plus diff/source inspection.
Need Expert Review: No special security/parser/concurrency review needed for this test-only PR.
Positive feedback: the added coverage is aimed at the right path. It covers named rule item deletion through DatabaseRuleItem("named", "foo_rule"), and the RDL case exercises CREATE -> DROP -> CREATE -> SHOW for the same encrypt rule name, matching issue #38657’s stale runtime metadata symptom.
Newly Introduced Issues
[P1] Diff check fails on trailing whitespace
Symptom: git diff --check 6d761e5...apache/pr/38685 exits 2.
Evidence: mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistServiceTest.java:215: trailing whitespace.
Risk: this conflicts with the project submission gate in CODE_OF_CONDUCT.md (line 17), especially the requirements that coding standards and build/style steps complete successfully.
Recommended action: please remove the trailing whitespace and rerun git diff --check.
Next Steps
Remove the whitespace-only issue in StandaloneMetaDataManagerPersistServiceTest.java.
Rerun:
git diff --check
xmllint --noout test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml test/e2e/sql/src/test/resources/cases/rdl/dataset/distsql_rdl/create_recreated_encrypt_rule.xml
the two scoped Maven commands listed in the PR, preferably with -am.
Adjusted Verified locally:
GitHub checks are green, including |
terrymanu
left a comment
There was a problem hiding this comment.
Decision
- Merge Verdict: Not Mergeable
- Reviewed Scope: PR #38685 latest head
c6f6466dee91979cecb46ff2ffea477764e91a3f; changed files undermode/type/standalone/core/src/test/java/.../StandaloneMetaDataManagerPersistServiceTest.java,test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml, andtest/e2e/sql/src/test/resources/cases/rdl/dataset/distsql_rdl/create_recreated_encrypt_rule.xml. - Not Reviewed Scope: I did not run the full Maven suite or manually reproduce the original Proxy PostgreSQL + MySQL repository topology from #38657.
- Need Expert Review: No special parser/security review is needed; this is a metadata/runtime refresh regression-coverage question.
Positive Feedback
- The added coverage is in the right direction.
StandaloneMetaDataManagerPersistServiceTest.java:195now verifies that both unique and named rule item deletion paths triggerDatabaseRuleItemManager.drop(...).test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml:41adds the important same-nameCREATE -> DROP -> CREATE -> SHOWregression path, which matches the duplicate-rule symptom in #38657.
Major Issues
-
[P1] The original DML rewrite symptom is still not directly validated (
test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml:41)- Symptom: The new E2E case validates same-name recreation after
DROP ENCRYPT RULE, but #38657 also reports that afterDROP ENCRYPT RULE test02,SHOW ENCRYPT RULESno longer shows the rule while subsequentINSERTis still encrypted. - Risk: The duplicate-name failure and the unexpected encryption both depend on stale runtime
EncryptRulestate, but they are observed through different high-frequency paths. The duplicate check uses rule table names, while DML rewrite enters throughEncryptSQLRewriteContextDecoratorandEncryptRule.findEncryptTable(...). Without a post-drop DML assertion, this PR can prevent the duplicate-create regression while still leaving the original rewrite symptom unproven. - Action: Please add regression coverage for
CREATE ENCRYPT RULE -> INSERT encrypted -> DROP ENCRYPT RULE -> SHOW no rule -> INSERT should no longer be rewritten/encrypted. If the SQL E2E framework cannot express the repository/topology exactly, please add the closest production-path integration/unit coverage and document the topology gap in the PR.
- Symptom: The new E2E case validates same-name recreation after
-
[P2] The
LOAD SINGLE TABLEfollow-up from #38657 is not covered (test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml:43)- Symptom: The issue reports an additional sequence after drop:
LOAD SINGLE TABLE ..., then insert failure, then same-name recreate failure. The current added test only runsCREATE -> DROPininitial-sql, then recreates and shows the rule. - Risk:
LOAD SINGLE TABLEtouches metadata reload behavior, which is adjacent to the stale metadata root cause. If this path has a separate interaction with standalone persisted metadata, the current test does not prove it. - Action: Please either extend the regression scenario to include the
LOAD SINGLE TABLEsequence from #38657, or add a short explanation with evidence that this path is already covered by another test and cannot affect the stale encrypt rule state.
- Symptom: The issue reports an additional sequence after drop:
Next Steps
- Add one regression that proves DML rewrite is disabled after dropping the encrypt rule.
- Add or justify coverage for the
LOAD SINGLE TABLEfollow-up path from #38657. - Rerun the existing scoped checks with
-am, plus the affected SQL E2E case. - Keep the existing named-rule-item deletion test; it is useful and should stay.
Multi-Round Comparison
- Previous blocker fixed: the trailing whitespace issue from the earlier review no longer reproduces;
git diff --check 6d761e53884e37bff7af1d2047221088565bbbdc...apache/pr/38685is clean. - Remaining blocker: current coverage still proves only part of #38657’s reported behavior, not the full original symptom chain.
Evidence Supplement
git diff --check 6d761e53884e37bff7af1d2047221088565bbbdc...apache/pr/38685passed.xmllint --nooutpassed for the two changed XML resources.- GitHub checks on latest head show relevant
Check - Spotless,Check - License,Check - CheckStyle,CI, anddistsql_rdlE2E jobs passing.
|
Addressed the latest review in commit Changes:
Verified locally:
GitHub Actions checks are green for the pushed commit, including |
terrymanu
left a comment
There was a problem hiding this comment.
Decision
- Merge Verdict: Not Mergeable
- Reviewed Scope: PR #38685 latest head
3678c2751adfb7664106607cbf468c65a8f5eb00; changed tests and RDL fixtures underfeatures/encrypt/core,mode/type/standalone/core, andtest/e2e/sql. I also checked the related metadata-drop and encrypt rewrite paths. - Not Reviewed Scope: I did not run Maven locally or manually reproduce the exact PostgreSQL-protocol Proxy + MySQL repository topology from #38657. No parser, dependency, or production source changes were present.
- Need Expert Review: No special parser/security/supply-chain review is needed for this test-only PR.
Positive Feedback
- The latest revision closes the previous functional coverage gaps. It now covers named rule item deletion, same-name encrypt rule recreation,
LOAD SINGLE TABLE *.*after drop, and post-drop DML rewrite behavior. - The added E2E cases in
test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml:50andtest/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-create.xml:62are aligned with the stale runtime metadata symptoms from #38657. - GitHub Actions on the latest head show the relevant
CI,Check - Spotless,Check - License,Check - CheckStyle, anddistsql_rdlE2E jobs passing.
Major Issues
- [P1] Latest head still fails
git diff --check(features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/context/EncryptSQLRewriteContextDecoratorTest.java:88)- Symptom:
git diff --check apache/master...apache/pr/38685exits with code 2 and reports trailing whitespace at lines 88 and 101. - Risk: This conflicts with the project submission/style gate in
CODE_OF_CONDUCT.md:18andCODE_OF_CONDUCT.md:19, and it repeats the same class of formatting issue that was already requested in an earlier review round. - Action: Please remove the trailing spaces on the blank lines around the new test/helper, then rerun
git diff --check apache/master...apache/pr/38685.
- Symptom:
Next Steps
- Remove the trailing whitespace at
EncryptSQLRewriteContextDecoratorTest.java:88andEncryptSQLRewriteContextDecoratorTest.java:101. - Rerun
git diff --check apache/master...apache/pr/38685. - Keep the current DML and
LOAD SINGLE TABLEregression coverage; I did not find another functional blocker in this pass.
Multi-Round Comparison
- Fixed: the earlier whitespace issue in
StandaloneMetaDataManagerPersistServiceTest.javais gone. - Fixed: the previous DML rewrite coverage blocker is addressed by
EncryptSQLRewriteContextDecoratorTest.java:89and the new RDL DML dataset. - Fixed: the previous
LOAD SINGLE TABLEcoverage blocker is addressed by the new RDL cases ate2e-rdl-create.xml:50ande2e-rdl-create.xml:62. - Newly introduced issue: the latest head adds trailing whitespace in
EncryptSQLRewriteContextDecoratorTest.java, so the PR is still not mergeable until the diff check is clean.
|
Addressed the latest whitespace review in commit The post-drop encrypt rewrite regression is now folded into the existing Verified locally:
|
|
CI update after the latest push:
That job failed during environment setup while downloading Maven from Maven Central:
I tried to rerun the failed job, but GitHub requires repository admin permissions for this workflow rerun. Could a maintainer rerun the failed job when available? |
Fixes #38657
Summary
Motivation
This covers the issue reported in #38657, where dropping an encrypt rule could remove it from persisted metadata while runtime metadata still behaved as if the rule existed.
Test Plan