mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Prevent server startup if rollbacks cause patch entry recording to fail
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21897 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -409,7 +409,6 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
|
|||||||
{
|
{
|
||||||
public String execute() throws Exception
|
public String execute() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
// downgrade integrity checking
|
// downgrade integrity checking
|
||||||
IntegrityChecker.setWarnInTransaction();
|
IntegrityChecker.setWarnInTransaction();
|
||||||
|
|
||||||
|
@@ -80,20 +80,20 @@ public class PatchExecuter extends AbstractLifecycleBean
|
|||||||
logger.info(I18NUtil.getMessage(MSG_CHECKING));
|
logger.info(I18NUtil.getMessage(MSG_CHECKING));
|
||||||
|
|
||||||
Date before = new Date(System.currentTimeMillis() - 60000L); // 60 seconds ago
|
Date before = new Date(System.currentTimeMillis() - 60000L); // 60 seconds ago
|
||||||
patchService.applyOutstandingPatches();
|
boolean applySucceeded = patchService.applyOutstandingPatches();
|
||||||
Date after = new Date(System .currentTimeMillis() + 20000L); // 20 seconds ahead
|
Date after = new Date(System .currentTimeMillis() + 20000L); // 20 seconds ahead
|
||||||
|
|
||||||
// get all the patches executed in the time
|
// get all the patches executed in the time
|
||||||
List<AppliedPatch> appliedPatches = patchService.getPatches(before, after);
|
List<AppliedPatch> appliedPatches = patchService.getPatches(before, after);
|
||||||
|
|
||||||
// don't report anything if nothing was done
|
// don't report anything if nothing was done
|
||||||
if (appliedPatches.size() == 0)
|
if (applySucceeded && appliedPatches.size() == 0)
|
||||||
{
|
{
|
||||||
logger.info(I18NUtil.getMessage(MSG_NO_PATCHES_REQUIRED));
|
logger.info(I18NUtil.getMessage(MSG_NO_PATCHES_REQUIRED));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boolean succeeded = true;
|
boolean allPassed = true;
|
||||||
// list all patches applied, including failures
|
// list all patches applied, including failures
|
||||||
for (AppliedPatch patchInfo : appliedPatches)
|
for (AppliedPatch patchInfo : appliedPatches)
|
||||||
{
|
{
|
||||||
@@ -108,12 +108,12 @@ public class PatchExecuter extends AbstractLifecycleBean
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
succeeded = false;
|
allPassed = false;
|
||||||
logger.error(I18NUtil.getMessage(MSG_FAILED, patchInfo.getId(), patchInfo.getReport()));
|
logger.error(I18NUtil.getMessage(MSG_FAILED, patchInfo.getId(), patchInfo.getReport()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// generate an error if there was a failure
|
// generate an error if there was a failure
|
||||||
if (!succeeded)
|
if (!allPassed || !applySucceeded)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Not all patches could be applied");
|
throw new AlfrescoRuntimeException("Not all patches could be applied");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user