mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Alfresco -> Alfresco deployment is smarter.
- The source store is implicitly snapshotted before deployment begins. - The destination (remote) store is implicitly snapshotted before deployment begins and again when the deployment is finished. - This means that comparison of GUIDs on directories can be used to short circuit the tree comparison. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5636 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -945,6 +945,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!--
|
||||||
<bean id="deploymentServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
<bean id="deploymentServiceReadTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
||||||
<property name="advice">
|
<property name="advice">
|
||||||
<ref bean="retryingReadTxnAdvice"/>
|
<ref bean="retryingReadTxnAdvice"/>
|
||||||
@@ -955,6 +956,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
-->
|
||||||
|
|
||||||
<bean id="deploymentServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
<bean id="deploymentServiceWriteTxnAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
||||||
<property name="advice">
|
<property name="advice">
|
||||||
@@ -963,6 +965,7 @@
|
|||||||
<property name="mappedNames">
|
<property name="mappedNames">
|
||||||
<list>
|
<list>
|
||||||
<value>deployDifferenceFS</value>
|
<value>deployDifferenceFS</value>
|
||||||
|
<value>deployDifference</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
@@ -979,7 +982,6 @@
|
|||||||
<property name="interceptorNames">
|
<property name="interceptorNames">
|
||||||
<list>
|
<list>
|
||||||
<value>deploymentServiceWriteTxnAdvisor</value>
|
<value>deploymentServiceWriteTxnAdvisor</value>
|
||||||
<value>deploymentServiceReadTxnAdvisor</value>
|
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -143,35 +143,36 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
{
|
{
|
||||||
DeploymentService depService = (DeploymentService)fContext.getBean("DeploymentService");
|
DeploymentService depService = (DeploymentService)fContext.getBean("DeploymentService");
|
||||||
setupBasicTree();
|
setupBasicTree();
|
||||||
TestDeploymentCallback callback = new TestDeploymentCallback();
|
// TestDeploymentCallback callback = new TestDeploymentCallback();
|
||||||
fService.createStore("target");
|
fService.createStore("target");
|
||||||
DeploymentReport report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, callback);
|
DeploymentReport report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
assertEquals(fService.lookup(-1, "main:/a/b/c/foo").getGuid(),
|
assertEquals(fService.lookup(-1, "main:/a/b/c/foo").getGuid(),
|
||||||
fService.lookup(-1, "target:/a/b/c/foo").getGuid());
|
fService.lookup(-1, "target:/a/b/c/foo").getGuid());
|
||||||
assertEquals(fService.lookup(-1, "main:/a/b/c/bar").getGuid(),
|
assertEquals(fService.lookup(-1, "main:/a/b/c/bar").getGuid(),
|
||||||
fService.lookup(-1, "target:/a/b/c/bar").getGuid());
|
fService.lookup(-1, "target:/a/b/c/bar").getGuid());
|
||||||
fService.createFile("main:/a/b", "biz").close();
|
fService.createFile("main:/a/b", "biz").close();
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, true, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, true, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
System.out.println(recursiveList("target", -1, true));
|
System.out.println(recursiveList("target", -1, true));
|
||||||
assertNull(fService.lookup(-1, "target:/a/b/biz"));
|
assertNull(fService.lookup(-1, "target:/a/b/biz"));
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
assertEquals(fService.lookup(-1, "main:/a/b/biz").getGuid(),
|
assertEquals(fService.lookup(-1, "main:/a/b/biz").getGuid(),
|
||||||
fService.lookup(-1, "target:/a/b/biz").getGuid());
|
fService.lookup(-1, "target:/a/b/biz").getGuid());
|
||||||
fService.removeNode("main:/a/b/c/foo");
|
fService.removeNode("main:/a/b/c/foo");
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, true, false, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, true, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
assertNotNull(fService.lookup(-1, "target:/a/b/c/foo"));
|
assertNotNull(fService.lookup(-1, "target:/a/b/c/foo"));
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
assertNull(fService.lookup(-1, "target:/a/b/c/foo"));
|
assertNull(fService.lookup(-1, "target:/a/b/c/foo"));
|
||||||
fService.removeNode("main:/a/b/c/bar");
|
fService.removeNode("main:/a/b/c/bar");
|
||||||
fService.createDirectory("main:/a/b/c", "bar");
|
fService.createDirectory("main:/a/b/c", "bar");
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target2:/wiggly/diggly", true, false, false, callback);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, false, null);
|
||||||
|
depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target2:/wiggly/diggly", true, false, false, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@@ -112,6 +112,11 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
dstPath);
|
dstPath);
|
||||||
callback.eventOccurred(event);
|
callback.eventOccurred(event);
|
||||||
}
|
}
|
||||||
|
if (version < 0)
|
||||||
|
{
|
||||||
|
String storeName = srcPath.substring(0, srcPath.indexOf(":"));
|
||||||
|
version = fAVMService.createSnapshot(storeName, null, null);
|
||||||
|
}
|
||||||
// Get the root of the deployment from this server.
|
// Get the root of the deployment from this server.
|
||||||
AVMNodeDescriptor srcRoot = fAVMService.lookup(version, srcPath);
|
AVMNodeDescriptor srcRoot = fAVMService.lookup(version, srcPath);
|
||||||
if (srcRoot == null)
|
if (srcRoot == null)
|
||||||
@@ -143,6 +148,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
snapshot = remote.createSnapshot(storePath[0], "PreDeploy", "Pre Deployment Snapshot");
|
snapshot = remote.createSnapshot(storePath[0], "PreDeploy", "Pre Deployment Snapshot");
|
||||||
|
|
||||||
}
|
}
|
||||||
// Get the root of the deployment on the destination server.
|
// Get the root of the deployment on the destination server.
|
||||||
AVMNodeDescriptor dstRoot = remote.lookup(-1, dstPath);
|
AVMNodeDescriptor dstRoot = remote.lookup(-1, dstPath);
|
||||||
@@ -163,6 +169,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
copyDirectory(version, srcRoot, dstParent, remote);
|
copyDirectory(version, srcRoot, dstParent, remote);
|
||||||
|
remote.createSnapshot(storePath[0], "Deployment", "Post Deployment Snapshot.");
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
event = new DeploymentEvent(DeploymentEvent.Type.END,
|
event = new DeploymentEvent(DeploymentEvent.Type.END,
|
||||||
@@ -180,6 +187,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
deployDirectoryPush(version, srcRoot, dstRoot, remote, dontDelete, dontDo, report, callback);
|
deployDirectoryPush(version, srcRoot, dstRoot, remote, dontDelete, dontDo, report, callback);
|
||||||
|
remote.createSnapshot(storePath[0], "Deployment", "Post Deployment Snapshot.");
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
DeploymentEvent event = new DeploymentEvent(DeploymentEvent.Type.END,
|
DeploymentEvent event = new DeploymentEvent(DeploymentEvent.Type.END,
|
||||||
@@ -197,7 +205,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
{
|
{
|
||||||
AVMSyncService syncService = getSyncService(hostName, port);
|
AVMSyncService syncService = getSyncService(hostName, port);
|
||||||
List<AVMDifference> diffs = syncService.compare(snapshot, dstPath, -1, dstPath, null);
|
List<AVMDifference> diffs = syncService.compare(snapshot, dstPath, -1, dstPath, null);
|
||||||
syncService.update(diffs, null, false, false, true, true, "Abortd Deployment", "Aborted Deployment");
|
syncService.update(diffs, null, false, false, true, true, "Aborted Deployment", "Aborted Deployment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ee)
|
catch (Exception ee)
|
||||||
@@ -227,6 +235,14 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
DeploymentReport report,
|
DeploymentReport report,
|
||||||
DeploymentCallback callback)
|
DeploymentCallback callback)
|
||||||
{
|
{
|
||||||
|
if (src.getGuid().equals(dst.getGuid()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!dontDo && !dontDelete)
|
||||||
|
{
|
||||||
|
copyMetadata(version, src, dst, remote);
|
||||||
|
}
|
||||||
// Get the listing for the source.
|
// Get the listing for the source.
|
||||||
SortedMap<String, AVMNodeDescriptor> srcList = fAVMService.getDirectoryListing(src);
|
SortedMap<String, AVMNodeDescriptor> srcList = fAVMService.getDirectoryListing(src);
|
||||||
// Get the listing for the destination.
|
// Get the listing for the destination.
|
||||||
|
Reference in New Issue
Block a user