Eli Mesika has posted comments on this change. Change subject: core: backup awareness, full backup check ......................................................................
Patch Set 1: (3 comments) https://gerrit.ovirt.org/#/c/40543/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EngineBackupAwarenessManager.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EngineBackupAwarenessManager.java: Line 26: @Singleton Line 27: public class EngineBackupAwarenessManager { Line 28: private static final Logger log = LoggerFactory.getLogger(EngineBackupAwarenessManager.class); Line 29: private static final String DB_SCOPE = "db"; Line 30: private static final String FILES_SCOPE = "files"; > this this seems to grow, please have it in enum. Done Line 31: private volatile boolean active; Line 32: @Inject Line 33: private AuditLogDirector auditLogDirector; Line 34: @Inject Line 73: private void doBackupCheck() { Line 74: AuditLogableBase alert = new AuditLogableBase(); Line 75: Line 76: //try to get last backup record Line 77: EngineBackupLog lastDbBackup = engineBackupLogDao.getLastSuccessfulEngineBackup(DB_SCOPE); > although one-lines, this is a repeated logic that can be "methodized" by: Done Line 78: EngineBackupLog lastFilesBackup = engineBackupLogDao.getLastSuccessfulEngineBackup(FILES_SCOPE); Line 79: if (lastDbBackup == null || lastFilesBackup == null) { Line 80: auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); Line 81: } else { Line 83: Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Line 84: Date lastDbBackupDate = lastDbBackup.getDoneAt(); Line 85: Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Line 86: Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; Line 87: long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); > please format the two lines above, as they exceed 120 chars. Done Line 88: if (diffInDays > backupAlertPeriodInDays) { Line 89: alert.addCustomValue("Date", lastFullBackupDate.toString()); Line 90: auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); Line 91: } -- To view, visit https://gerrit.ovirt.org/40543 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I71a8b2b4278db039518f7bfc9b684f390ca449fe Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Peřina <mper...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches