Skip to content

Commit

Permalink
0003861: Table reload request by channel will be treated as a full load
Browse files Browse the repository at this point in the history
and mark all outgoing batches as OK
  • Loading branch information
jumpmind-josh committed Jan 22, 2019
1 parent 2aca731 commit 80d11e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Expand Up @@ -155,7 +155,11 @@ public void setDeleteFirst(boolean deleteFirst) {
}

public boolean isFullLoadRequest() {
return ParameterConstants.ALL.equals(getTriggerId()) && ParameterConstants.ALL.equals(getRouterId());
return ParameterConstants.ALL.equals(getTriggerId()) && ParameterConstants.ALL.equals(getRouterId()) && getChannelId() == null;
}

public boolean isChannelRequest() {
return getChannelId() != null;
}

public String getIdentifier() {
Expand Down
Expand Up @@ -390,8 +390,17 @@ public void insertReloadEvents(Node targetNode, boolean reverse, List<TableReloa
boolean isFullLoad = reloadRequests == null
|| (reloadRequests.size() == 1 && reloadRequests.get(0).isFullLoadRequest());

boolean isChannelLoad = false;
String channelId = null;
if (reloadRequests != null
&& (reloadRequests.size() == 1 && reloadRequests.get(0).isChannelRequest())) {
isChannelLoad=true;
channelId = reloadRequests.get(0).getChannelId();
}

if (!reverse) {
log.info("Queueing up " + (isFullLoad ? "an initial" : "a") + " load to node " + targetNode.getNodeId());
log.info("Queueing up " + (isFullLoad ? "an initial" : "a") + " load to node " + targetNode.getNodeId()
+ (isChannelLoad ? " for channel " + channelId : ""));
} else {
log.info("Queueing up a reverse " + (isFullLoad ? "initial" : "") + " load to node " + targetNode.getNodeId());
}
Expand Down Expand Up @@ -430,10 +439,10 @@ public void insertReloadEvents(Node targetNode, boolean reverse, List<TableReloa

List<TriggerHistory> triggerHistories = new ArrayList<TriggerHistory>();

if (isFullLoad) {
if (isFullLoad || isChannelLoad) {
triggerHistories.addAll(activeHistories);
if (reloadRequests != null && reloadRequests.size() == 1) {
String channelId = reloadRequests.get(0).getChannelId();

if (channelId != null) {
List<TriggerHistory> channelTriggerHistories = new ArrayList<TriggerHistory>();

Expand Down Expand Up @@ -465,7 +474,7 @@ public void insertReloadEvents(Node targetNode, boolean reverse, List<TableReloa
createBy, transactional, transaction);
}
}
Map<String, TableReloadRequest> mapReloadRequests = convertReloadListToMap(reloadRequests, triggerRouters, isFullLoad);
Map<String, TableReloadRequest> mapReloadRequests = convertReloadListToMap(reloadRequests, triggerRouters, isFullLoad, isChannelLoad);

String symNodeSecurityReloadChannel = null;
int totalTableCount = 0;
Expand Down Expand Up @@ -586,13 +595,13 @@ private String findChannelFor(TriggerHistory history, List<TriggerRouter> trigge
}

@SuppressWarnings("unchecked")
protected Map<String, TableReloadRequest> convertReloadListToMap(List<TableReloadRequest> reloadRequests, List<TriggerRouter> triggerRouters, boolean isFullLoad) {
protected Map<String, TableReloadRequest> convertReloadListToMap(List<TableReloadRequest> reloadRequests, List<TriggerRouter> triggerRouters, boolean isFullLoad, boolean isChannelLoad) {
if (reloadRequests == null) {
return null;
}
Map<String, TableReloadRequest> reloadMap = new CaseInsensitiveMap();
for (TableReloadRequest reloadRequest : reloadRequests) {
if (!isFullLoad) {
if (!isFullLoad && !isChannelLoad) {
validate(reloadRequest, triggerRouters);
}
reloadMap.put(reloadRequest.getIdentifier(), reloadRequest);
Expand Down

0 comments on commit 80d11e9

Please sign in to comment.