-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: Orphaned encrypted_value records #701
Conversation
- When a credential was deleted, its related encrypted_value records were not being deleted. - Implemented a trigger to make sure that those records are deleted. [#182121168]
We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story. The labels on this github issue will be updated when the story is started. |
...rces/db/migration/mysql/V57_2__delete_related_encrypted_value_when_credential_is_deleted.sql
Outdated
Show resolved
Hide resolved
...rces/db/migration/mysql/V57_2__delete_related_encrypted_value_when_credential_is_deleted.sql
Outdated
Show resolved
Hide resolved
...rces/db/migration/mysql/V57_2__delete_related_encrypted_value_when_credential_is_deleted.sql
Outdated
Show resolved
Hide resolved
...rces/db/migration/mysql/V57_2__delete_related_encrypted_value_when_credential_is_deleted.sql
Outdated
Show resolved
Hide resolved
...src/test/java/org/cloudfoundry/credhub/services/DefaultCredentialVersionDataServiceTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/cloudfoundry/credhub/services/DefaultCredentialVersionDataServiceTest.java
Show resolved
Hide resolved
f3a4de3
to
fc35826
Compare
Rewrote mysql trigger to use cursor instead of temp table. Also got rid of previous commit with test code change as the added code to the existing test cases had issues giving inconsistent result. Will add new test cases instead. |
- Rewrote the trigger not to use temporary tables. [#182121168]
e57a34d
to
84a2735
Compare
- MySQL trigger to delete associated encrypted_value records when credential_versions are deleted - Implemented triggers on both credential and credential_version table because a credential_version record can be deleted not only when a credential is deleted but also directly. - This will cause h2 & postgresql test cases to fail until triggers are implemented for those databases. [#182121168] Co-authored-by: Bruce Ricard <[email protected]>
84a2735
to
7ea712c
Compare
- Added PostgreSQL trigger to delete associated encrypted_value records when credential_versions are deleted. [#182121168]
0788cb4
to
82cef8d
Compare
* Do not assert on the count of the "encrypted_value" table when using the H2 in-memory test database. Co-Authored-by: Bruce Ricard <[email protected]> [#182121168](https://www.pivotaltracker.com/story/show/182121168)
* To help debug by logging whether the assertion runs or not Co-Authored-by: Bruce Ricard <[email protected]> [#182121168](https://www.pivotaltracker.com/story/show/182121168)
Co-Authored-by: Bruce Ricard <[email protected]>
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.
Amazing work
This PR attempts to resolve #231 |
[#182121168]
There will be more commits, including tests, triggers for other databases and indexes to address delete operation performance.