-
Notifications
You must be signed in to change notification settings - Fork 4
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
protect against stray snapshot-details without snapshot #70
base: 4.15
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1097,6 +1097,10 @@ public void doInTransactionWithoutResult(TransactionStatus status) { | |
final List<SnapshotDetailsVO> snapshotList = _snapshotDetailsDao.findDetails(AsyncJob.Constants.MS_ID, Long.toString(msid), false); | ||
for (final SnapshotDetailsVO snapshotDetailsVO : snapshotList) { | ||
SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotDetailsVO.getResourceId(), DataStoreRole.Primary); | ||
if (snapshot == null) { | ||
_snapshotDetailsDao.remove(snapshotDetailsVO.getId()); | ||
continue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DaanHoogland here the snapshot details is scanned for 'MS_ID' only, and the associated snapshot object (if exists) holding this detail is transitioned to failed/error state. So, I think it is safe to remove detail 'MS_ID' only (not sure if any other detail is being process elsewhere). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore my last comment. Above ^^ remove stmt is correct as the record is being removed by details record id, and it is safe. |
||
} | ||
snapshotSrv.processEventOnSnapshotObject(snapshot, Snapshot.Event.OperationFailed); | ||
_snapshotDetailsDao.removeDetail(snapshotDetailsVO.getResourceId(), AsyncJob.Constants.MS_ID); | ||
} | ||
|
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.
@DaanHoogland make sure 'null' returned here is checked, wherever this method is called.
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.
Note that at line 94/97 null is returned as well. It is called 20 times, not including tests. if the snapshot is null and an SnapshotInfo object is returned with a null snapshot field it will result in runtime exceptions if it is used. I agree that errors may occur in different placec, but not more errors will occur. I'll spend some time researching thos 20 callers.
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.
added two null checks. I think these are superfluent, but they wont hurt.