Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)

118657 adavis: Merged 5.0.2-CLOUD42 (Cloud ) to 5.0.N (5.0.4)
      118656 adavis: Merged 5.0.2-CLOUD (Cloud ) to 5.0.2-CLOUD42 (Cloud )
         118655 adavis: Merged 5.0.2-PLUS (5.0.2-PLUS) to 5.0.2-CLOUD (Cloud )
            118542 amorarasu: Merged DEV to 5.0.2-PLUS (5.0.2-PLUS)
               117462 118473 amorarasu: MNT-15147: Cloud 40 Upgrade takes too long
                  - Make the patch.fixPersonSizeCurrentType to not apply to tenants
                  - Added support for making patch.addUnmovableAspect deferred


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@118716 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2015-11-27 09:17:00 +00:00
parent 721b1640e7
commit f7ac2331dd
6 changed files with 51 additions and 7 deletions

View File

@@ -1084,6 +1084,10 @@
<property name="behaviourFilter" > <property name="behaviourFilter" >
<ref bean="policyBehaviourFilter"/> <ref bean="policyBehaviourFilter"/>
</property> </property>
<property name="jobLockService" >
<ref bean="jobLockService" />
</property>
<property name="deferred"><value>${system.patch.addUnmovableAspect.deferred}</value></property>
</bean> </bean>
<bean id="patch.deleteClassifibleAspectForFailedThumbnail" class="org.alfresco.repo.admin.patch.impl.GenericDeleteAspectForTypePatch" <bean id="patch.deleteClassifibleAspectForFailedThumbnail" class="org.alfresco.repo.admin.patch.impl.GenericDeleteAspectForTypePatch"
@@ -1191,6 +1195,7 @@
<property name="fixesFromSchema"><value>0</value></property> <property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>9007</value></property> <property name="fixesToSchema"><value>9007</value></property>
<property name="targetSchema"><value>9008</value></property> <property name="targetSchema"><value>9008</value></property>
<property name="applyToTenants"><value>false</value></property>
<property name="patchDAO"> <property name="patchDAO">
<ref bean="patchDAO"/> <ref bean="patchDAO"/>
</property> </property>

View File

@@ -1045,6 +1045,12 @@ system.patch.sharedFolder.deferred=false
# Default value is run new years day 2030 i.e. not run. # Default value is run new years day 2030 i.e. not run.
system.patch.sharedFolder.cronExpression=0 0 0 ? 1 1 2030 system.patch.sharedFolder.cronExpression=0 0 0 ? 1 1 2030
#
# Default values for deferring the running of the addUnmovableAspect patch
#
system.patch.addUnmovableAspect.deferred=false
system.patch.addUnmovableAspect.cronExpression=0 0 0 ? 1 1 2030
# #
# Use a canned query when requested to search for people if " [hint:useCQ]" is provided in search term # Use a canned query when requested to search for people if " [hint:useCQ]" is provided in search term
# #

View File

@@ -299,4 +299,32 @@
<property name="startDelayMinutes" value="${system.cronJob.startDelayMinutes}" /> <property name="startDelayMinutes" value="${system.cronJob.startDelayMinutes}" />
</bean> </bean>
<!-- Add Unmovable aspect to site patch -->
<bean id="patchAddUnmovableAspectJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>org.alfresco.repo.admin.patch.AsynchronousPatch$AsynchronousPatchJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="asynchronousPatch">
<ref bean="patch.addUnmovableAspect" />
</entry>
</map>
</property>
</bean>
<bean id="patchAddUnmovableAspectTrigger" class="org.alfresco.util.CronTriggerBean">
<property name="jobDetail">
<ref bean="patchAddUnmovableAspectJobDetail" />
</property>
<property name="scheduler">
<ref bean="schedulerFactory" />
</property>
<property name="cronExpression">
<value>${system.patch.addUnmovableAspect.cronExpression}</value>
</property>
<property name="startDelayMinutes">
<value>${system.cronJob.startDelayMinutes}</value>
</property>
</bean>
</beans> </beans>

View File

@@ -51,13 +51,13 @@ public interface PatchService
* Apply all outstanding patches that are relevant to the repo. If there is a failure, then the patches that were * Apply all outstanding patches that are relevant to the repo. If there is a failure, then the patches that were
* applied will remain so, but the process will not attempt to apply any further patches. * applied will remain so, but the process will not attempt to apply any further patches.
* *
* @return Returns true if all outstanding patches were applied, or false if the process was termintated before all * @return Returns true if all outstanding patches were applied, or false if the process was terminated before all
* patches could be applied. * patches could be applied.
*/ */
public boolean applyOutstandingPatches(); public boolean applyOutstandingPatches();
/** /**
* Apply the specified patch that is relevant to the repo. * Apply the specified patch that is relevant to the repo, regardless of the <b>deferred</b> flag.
* *
* @param patch the patch object * @param patch the patch object
* @return true if the specified patch and its dependencies were applied, or * @return true if the specified patch and its dependencies were applied, or

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2014 Alfresco Software Limited. * Copyright (C) 2005-2015 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -183,6 +183,10 @@ public class PatchServiceImpl implements PatchService
// go through all the patches and apply them where necessary // go through all the patches and apply them where necessary
for (Patch patch : sortedPatches) for (Patch patch : sortedPatches)
{ {
if(patch.isDeferred())
{
continue;
}
// apply the patch // apply the patch
success = applyPatchAndDependencies(patch, appliedPatchesById); success = applyPatchAndDependencies(patch, appliedPatchesById);
if (!success) if (!success)
@@ -284,9 +288,9 @@ public class PatchServiceImpl implements PatchService
AppliedPatch appliedPatch = appliedPatchesById.get(id); AppliedPatch appliedPatch = appliedPatchesById.get(id);
if (appliedPatch != null && appliedPatch.getSucceeded()) if (appliedPatch != null && appliedPatch.getSucceeded())
{ {
if (appliedPatch.getWasExecuted() && appliedPatch.getSucceeded()) if (appliedPatch.getWasExecuted())
{ {
// It was sucessfully executed // It was successfully executed
return true; return true;
} }
// We give the patch another chance // We give the patch another chance
@@ -549,6 +553,7 @@ public class PatchServiceImpl implements PatchService
patch.getId(), patch.getId(),
I18NUtil.getMessage(patch.getDescription())); I18NUtil.getMessage(patch.getDescription()));
logger.info(msg); logger.info(msg);
// the patch is executed regardless of the deferred flag value
report = (patch.isDeferred()) ? patch.applyAsync() : patch.apply(); report = (patch.isDeferred()) ? patch.applyAsync() : patch.apply();
state = STATE.APPLIED; state = STATE.APPLIED;
} }

View File

@@ -25,7 +25,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.admin.patch.AbstractPatch; import org.alfresco.repo.admin.patch.AsynchronousPatch;
import org.alfresco.repo.batch.BatchProcessWorkProvider; import org.alfresco.repo.batch.BatchProcessWorkProvider;
import org.alfresco.repo.batch.BatchProcessor; import org.alfresco.repo.batch.BatchProcessor;
import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.BehaviourFilter;
@@ -47,7 +47,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @author Alex Mukha * @author Alex Mukha
* *
*/ */
public class AddUnmovableAspectToSitesPatch extends AbstractPatch public class AddUnmovableAspectToSitesPatch extends AsynchronousPatch
{ {
private static Log logger = LogFactory.getLog(AddUnmovableAspectToSitesPatch.class); private static Log logger = LogFactory.getLog(AddUnmovableAspectToSitesPatch.class);
private static final String MSG_SUCCESS = "patch.addUnmovableAspect.result"; private static final String MSG_SUCCESS = "patch.addUnmovableAspect.result";