Merge "Issue #3560 Registry objects not re-sent after fully sync" into omaha_14.2.4
Former-commit-id: 5f9298d52d0a11775588ed3742f2c2d3f19da1d0
This commit is contained in:
commit
af87813ea9
3 changed files with 34 additions and 4 deletions
|
@ -36,6 +36,7 @@ import javax.ws.rs.PathParam;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/27/2014 2769 bphillip Initial Creation
|
||||
* 8/27/2014 3560 bphillip Added updateRegistryEvents method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -106,4 +107,9 @@ public interface IRegistryFederationManager {
|
|||
public void synchronizeWithRegistry(
|
||||
@PathParam("registryId") String registryId) throws Exception;
|
||||
|
||||
@GET
|
||||
@Path("updateRegistryEvents/{registryId}/{time}")
|
||||
public void updateRegistryEvents(
|
||||
@PathParam("registryId") String registryId, @PathParam("time") String time);
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.edex.datadelivery.registry.federation.ReplicationEvent;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/19/2014 2769 bphillip Initial Creation
|
||||
* 8/27/2014 3560 bphillip Added query by event time method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -45,7 +46,12 @@ import com.raytheon.uf.edex.datadelivery.registry.federation.ReplicationEvent;
|
|||
public class ReplicationEventDao extends
|
||||
SessionManagedDao<Long, ReplicationEvent> {
|
||||
|
||||
private static final String GET_REPLICATION_EVENT_QUERY = "from ReplicationEvent event where (event.source is null or event.source != '%s') and (event.replicatedTo is null or event.replicatedTo not like '%%%s%%') order by event.eventTime asc";
|
||||
private static final String GET_REPLICATION_EVENT_QUERY = "from ReplicationEvent event " +
|
||||
"where (event.source is null or event.source != :source) " +
|
||||
"and (event.replicatedTo is null or event.replicatedTo not like :registry) " +
|
||||
"order by event.eventTime asc";
|
||||
|
||||
private static final String GET_EVENTS_BY_TIME = "from ReplicationEvent event where event.eventTime < :eventTime";
|
||||
|
||||
@Override
|
||||
protected Class<ReplicationEvent> getEntityClass() {
|
||||
|
@ -54,7 +60,11 @@ public class ReplicationEventDao extends
|
|||
|
||||
@Transactional(propagation = Propagation.MANDATORY, readOnly = true)
|
||||
public List<ReplicationEvent> getReplicationEvents(String remoteRegistry, int batchSize) {
|
||||
return this.executeHQLQuery(String.format(GET_REPLICATION_EVENT_QUERY,
|
||||
remoteRegistry, remoteRegistry),batchSize);
|
||||
return this.executeHQLQuery(GET_REPLICATION_EVENT_QUERY,batchSize,
|
||||
"source", remoteRegistry, "registry", "%"+remoteRegistry+"%");
|
||||
}
|
||||
|
||||
public List<ReplicationEvent> getEventsBeforeTime(String time){
|
||||
return this.executeHQLQuery(GET_EVENTS_BY_TIME, "eventTime", time);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.ClusterIdUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
|
@ -156,6 +157,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent;
|
|||
* 2/13/2014 2769 bphillip Refactored registry sync. Created quartz tasks to monitor registry uptime as well as subscription integrity
|
||||
* 4/11/2014 3011 bphillip Removed automatic registry sync check on startup
|
||||
* 4/15/2014 3012 dhladky Merge fixes.
|
||||
* 8/27/2014 3560 bphillip Added updateRegistryEvents method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -536,6 +538,16 @@ public class RegistryFederationManager implements IRegistryFederationManager,
|
|||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@GET
|
||||
@Path("updateRegistryEvents/{registryId}/{time}")
|
||||
public void updateRegistryEvents(@PathParam("registryId") String registryId, @PathParam("time") String time) {
|
||||
for(ReplicationEvent event: replicationEventDao.getEventsBeforeTime(time)){
|
||||
event.addReplicatedTo(registryId);
|
||||
replicationEventDao.update(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes this registry's data with the registry at the specified URL
|
||||
*
|
||||
|
@ -582,6 +594,9 @@ public class RegistryFederationManager implements IRegistryFederationManager,
|
|||
federatedRegistryMonitor.updateTime();
|
||||
StringBuilder syncMsg = new StringBuilder();
|
||||
|
||||
// Update the registry events table on the remote registry so duplicate data is not sent again
|
||||
dataDeliveryRestClient.getRegistryFederationManager(remoteRegistryUrl).updateRegistryEvents(ClusterIdUtil.getId(), String.valueOf(start));
|
||||
|
||||
syncMsg.append("Registry synchronization using [")
|
||||
.append(remoteRegistryUrl)
|
||||
.append("] completed successfully in ")
|
||||
|
@ -1256,5 +1271,4 @@ public class RegistryFederationManager implements IRegistryFederationManager,
|
|||
public NotificationServers getServers() {
|
||||
return servers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue