Skip to content

Cleanup domain details when domain is deleted#4445

Merged
yadvr merged 1 commit into
apache:4.15from
ravening:cleanup_domain_details
Feb 12, 2021
Merged

Cleanup domain details when domain is deleted#4445
yadvr merged 1 commit into
apache:4.15from
ravening:cleanup_domain_details

Conversation

@ravening

@ravening ravening commented Nov 5, 2020

Copy link
Copy Markdown
Member

Description

Cleanup domain details when domain is deleted

When domain is deleted, all the settings configured under
the domain scope still exists in domain_details table.
All the entries for the domain should be deleted as well

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

Before the fix

mysql> select name,state from domain where id=254;
+--------+--------+
| name   | state  |
+--------+--------+
| domain | Active |
+--------+--------+
1 row in set (0.00 sec)

mysql> select * from domain_details where domain_id=254;
+----+-----------+---------------------------------+--------------------------+
| id | domain_id | name                            | value                    |
+----+-----------+---------------------------------+--------------------------+
| 11 |       254 | allow.duplicate.networkname     | WRXXfK4XO7HPzDmQ0MGAGw== |
| 12 |       254 | allow.empty.start.end.ipaddress | Ia4BIOohYf4W5C5FwOJe+A== |
| 13 |       254 | allow.user.expunge.recover.vm   | nRTlX/+K9wqesxm9x1zwmQ== |
+----+-----------+---------------------------------+--------------------------+
3 rows in set (0.00 sec)

mysql> select name,state from domain where id=254;
+--------+----------+
| name   | state    |
+--------+----------+
| domain | Inactive |
+--------+----------+
1 row in set (0.00 sec)

mysql> select * from domain_details where domain_id=254;
+----+-----------+---------------------------------+--------------------------+
| id | domain_id | name                            | value                    |
+----+-----------+---------------------------------+--------------------------+
| 11 |       254 | allow.duplicate.networkname     | WRXXfK4XO7HPzDmQ0MGAGw== |
| 12 |       254 | allow.empty.start.end.ipaddress | Ia4BIOohYf4W5C5FwOJe+A== |
| 13 |       254 | allow.user.expunge.recover.vm   | nRTlX/+K9wqesxm9x1zwmQ== |
+----+-----------+---------------------------------+--------------------------+
3 rows in set (0.00 sec)

After the fix

mysql> select name,state from domain where id=255;
+--------+--------+
| name   | state  |
+--------+--------+
| domain | Active |
+--------+--------+
1 row in set (0.00 sec)

mysql> select * from domain_details where domain_id=255;
+----+-----------+---------------------------------+--------------------------+
| id | domain_id | name                            | value                    |
+----+-----------+---------------------------------+--------------------------+
| 14 |       255 | allow.duplicate.networkname     | dXYs8M+ZfwHYzPwSPgjk7g== |
| 15 |       255 | allow.empty.start.end.ipaddress | kjjnH9Y+qmGfwdF11eSobg== |
| 16 |       255 | allow.user.expunge.recover.vm   | 6oE1TAZHn+o64seAhLHDng== |
+----+-----------+---------------------------------+--------------------------+
3 rows in set (0.00 sec)

mysql> select name,state from domain where id=255;
+--------+----------+
| name   | state    |
+--------+----------+
| domain | Inactive |
+--------+----------+
1 row in set (0.00 sec)

mysql> select * from domain_details where domain_id=255;
Empty set (0.00 sec)

mysql>

When domain is deleted, all the settings configured under
the domain scope still exists in domain_details table.
All the entries for the domain should be deleted as well
@DaanHoogland

Copy link
Copy Markdown
Contributor

@ravening , this sounds like something that should be done in a cascading delete in sql. I see only java changes, any thoughts?

@ravening

ravening commented Nov 6, 2020

Copy link
Copy Markdown
Member Author

@ravening , this sounds like something that should be done in a cascading delete in sql. I see only java changes, any thoughts?

Anything is fine with me as long as entries are cleaned up

@DaanHoogland

Copy link
Copy Markdown
Contributor

I think doing this in java is error prone. if the domain is marked removed it doesn't hurt to keep the details around and if the domain records is actually removed it should be removed with a cascading delete. the only possible reason to do it this way is if we have other 'child' records to domain that we do want to keep when domains are deleted.
if you look at DomainDaoImpl.remove(..), you'll find that any checks needed are done there. I think this cleanup should happen there as well.

@weizhouapache

Copy link
Copy Markdown
Member

@DaanHoogland I do not see any harmless to remove the records from db. however if you want to keep it in db, it is ok for me. @ravening

@shwstppr shwstppr added this to the 4.16.0.0 milestone Jan 25, 2021
@shwstppr

Copy link
Copy Markdown
Contributor

@ravening Moving to 4.16.0.0 milestone based on base branch please update if needed

@DaanHoogland
DaanHoogland changed the base branch from master to 4.15 January 26, 2021 08:11
@DaanHoogland DaanHoogland modified the milestones: 4.16.0.0, 4.15.1.0 Jan 26, 2021
@DaanHoogland

Copy link
Copy Markdown
Contributor

@ravening @shwstppr as this is a bug fix and based on a version before branching of I've set the version to 4.15.1

@weizhouapache

Copy link
Copy Markdown
Member

@ravening @shwstppr as this is a bug fix and based on a version before branching of I've set the version to 4.15.1

@ravening @shwstppr @DaanHoogland maybe better to merge this into 4.14 ?

@shwstppr shwstppr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@weizhouapache 👍

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2593

@DaanHoogland
DaanHoogland changed the base branch from 4.15 to 4.14 January 26, 2021 11:02
@DaanHoogland
DaanHoogland changed the base branch from 4.14 to 4.15 January 26, 2021 11:03
@DaanHoogland

Copy link
Copy Markdown
Contributor

@ravening @shwstppr as this is a bug fix and based on a version before branching of I've set the version to 4.15.1

@ravening @shwstppr @DaanHoogland maybe better to merge this into 4.14 ?

@weizhouapache it will need rebasing for that. cc @ravening

@yadvr

yadvr commented Feb 12, 2021

Copy link
Copy Markdown
Member

LGTM, business layer only changes; merging based on Travis tests. LGTM.

@yadvr
yadvr merged commit de7b131 into apache:4.15 Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants