Project

General

Profile

Actions

Defect #2159

closed

Notification agenda can't be read when Sender identity is deleted - missing referential integrity

Added by Ondrej Husník over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Ondrej Husník
Category:
Notification
Target version:
Start date:
03/27/2020
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Notification agenda can't be read when Sender identity is deleted. Recipient identity seems to be OK

Actions #1

Updated by Ondrej Husník over 4 years ago

  • Status changed from New to Needs feedback
  • Assignee changed from Ondrej Husník to Radek Tomiška
  • % Done changed from 0 to 90

Referential integrity is maintained, during identity deletion, by removing sender identity UUID from notifications where deleted identity was set.
Please check my solution and provide me a feedback.

https://github.com/bcvsolutions/CzechIdMng/pull/103/commits/81bdc34fe0202d2b5071f0c386133528480ddee5

Actions #2

Updated by Radek Tomiška over 4 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Radek Tomiška to Ondrej Husník
  • % Done changed from 90 to 70

I did code review. I'm not sure updating all notification recipients is the good way. There is a lot of notifications and their recipient (10k in my database - e.g. notifications for managers with more subordinates). Add please annotation @NotFound(action = NotFoundAction.IGNORE) instead of updating all recipients - meaning remains the same.

Actions #3

Updated by Ondrej Husník over 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Ondrej Husník to Radek Tomiška

Following the review results, the approach to ref. integrity maintaining was changed. Annotation @NotFound(action = NotFoundAction.IGNORE) now works as prevention from hibernate exception throwing.

Unfortunately, during my attempt to modify created test, I wasn't able to break it even though above mentioned annotation was removed and Identity, previously set as identitySender to IdmNotificationDto, was also deleted. Calling 'find' method of the IdmNotificationLogService doesn't throw (actually Hibernate itself) expected exception.

Please, could you check my test and try to reproduce it on your environment? @NotFound(action = NotFoundAction.IGNORE) is necessary to remove first. Thank you in advance.

https://github.com/bcvsolutions/CzechIdMng/pull/103/commits/48fce6dd9d9f7707039c7d929165982120dd0b48

Actions #4

Updated by Radek Tomiška over 4 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Radek Tomiška to Ondrej Husník
  • % Done changed from 70 to 100

I did test and code review, it works and code looks nice, thx!

About question above - hibernate context (~cache) is used here. If @Transactional annotation is removed (context has transaction scope by default), then notification is reloaded properly. This is side effect of this annotation usage, i didn't know about it (so annotation could be used just in place like this, where no logic is related, it could be dangerous otherwise). Edit: the behavior is same with or without @NotFound annotation, so it's about @Transactional behvior itself.

Merged into develop with some trivial review notes:
https://github.com/bcvsolutions/CzechIdMng/pull/103/commits/507cf7d4ddb0244e2e0ad17b78b6025249c5e67a#diff-492aaae7554afb2d5b50c002154be612

Actions #5

Updated by Vít Švanda over 4 years ago

  • Tracker changed from Task to Defect
Actions #6

Updated by Radek Tomiška over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF