Skip to content
Permalink
Browse files

0003857: NodeService.findNode(...) (cached versus non-cached), where to

use correct one
  • Loading branch information...
philipmarzullo
philipmarzullo committed Jan 17, 2019
1 parent 764fbfd commit 456427e15c24486495e74e6fdd993a614eb89bc7
@@ -145,7 +145,7 @@ public void write(CsvData data) {
snapshotEvents.add(snapshot);
} else if (eventType == DataEventType.RELOAD) {
String targetNodeId = context.getBatch().getTargetNodeId();
Node targetNode = nodeService.findNode(targetNodeId);
Node targetNode = nodeService.findNode(targetNodeId, true);
List<FileTriggerRouter> fileTriggerRouters = fileSyncService
.getFileTriggerRoutersForCurrentNode(false);
for (FileTriggerRouter fileTriggerRouter : fileTriggerRouters) {
@@ -634,7 +634,7 @@ public boolean extractOnlyOutgoingBatch(String nodeId, long batchId, Writer writ
if (Constants.UNROUTED_NODE_ID.equals(nodeId)) {
targetNode = new Node(nodeId, parameterService.getNodeGroupId());
} else {
targetNode = nodeService.findNode(nodeId);
targetNode = nodeService.findNode(nodeId, true);
}
if (targetNode != null) {
OutgoingBatch batch = outgoingBatchService.findOutgoingBatch(batchId, nodeId);
@@ -1447,7 +1447,7 @@ protected void transferFromStaging(ExtractMode mode, BatchType batchType, Outgoi
String line = null;
while ((line = reader.readLine()) != null) {
if (line.startsWith(CsvConstants.BATCH)) {
if (nodeService.findNode(batch.getNodeId()).isVersionGreaterThanOrEqualTo(3, 9, 0)) {
if (nodeService.findNode(batch.getNodeId(), true).isVersionGreaterThanOrEqualTo(3, 9, 0)) {
writer.write(getBatchStatsColumns());
writer.newLine();
writer.write(getBatchStats(batch));
@@ -1482,7 +1482,7 @@ protected void transferFromStaging(ExtractMode mode, BatchType batchType, Outgoi
boolean batchStatsWritten = false;
String prevBuffer = "";
while ((numCharsRead = reader.read(buffer)) != -1) {
if (!batchStatsWritten && nodeService.findNode(batch.getNodeId()).isVersionGreaterThanOrEqualTo(3, 9, 0)) {
if (!batchStatsWritten && nodeService.findNode(batch.getNodeId(), true).isVersionGreaterThanOrEqualTo(3, 9, 0)) {
batchStatsWritten = writeBatchStats(writer, buffer, numCharsRead, prevBuffer, batch);
prevBuffer = new String(buffer);
} else {
@@ -1702,7 +1702,7 @@ public boolean extractBatchRange(Writer writer, String nodeId, long startBatchId
for (long batchId = startBatchId; batchId <= endBatchId; batchId++) {
OutgoingBatch batch = outgoingBatchService.findOutgoingBatch(batchId, nodeId);
if (batch != null) {
Node targetNode = nodeService.findNode(nodeId);
Node targetNode = nodeService.findNode(nodeId, true);
if (targetNode == null && Constants.UNROUTED_NODE_ID.equals(nodeId)) {
targetNode = new Node();
targetNode.setNodeId("-1");
@@ -1732,7 +1732,7 @@ public boolean extractBatchRange(Writer writer, String nodeId, Date startBatchTi
startBatchTime, endBatchTime, channelIds);
List<OutgoingBatch> list = batches.getBatches();
for (OutgoingBatch outgoingBatch : list) {
Node targetNode = nodeService.findNode(nodeId);
Node targetNode = nodeService.findNode(nodeId, true);
if (targetNode == null && Constants.UNROUTED_NODE_ID.equals(nodeId)) {
targetNode = new Node();
targetNode.setNodeId("-1");
@@ -1981,7 +1981,7 @@ public void execute(NodeCommunication nodeCommunication, RemoteNodeStatus status
continue;
}
Node identity = nodeService.findIdentity();
Node targetNode = nodeService.findNode(nodeCommunication.getNodeId());
Node targetNode = nodeService.findNode(nodeCommunication.getNodeId(), true);
log.info(
"Extracting batches for request {}. Starting at batch {}. Ending at batch {}",
new Object[] { request.getRequestId(), request.getStartBatchId(),
@@ -2633,7 +2633,7 @@ protected void init(Batch batch, List<SelectFromTableEvent> initialLoadEvents) {
this.selectFromTableEventsToSend = new ArrayList<SelectFromTableEvent>(
initialLoadEvents);
this.batch = batch;
this.node = nodeService.findNode(batch.getTargetNodeId());
this.node = nodeService.findNode(batch.getTargetNodeId(), true);
if (node == null) {
throw new SymmetricException("Could not find a node represented by %s",
this.batch.getTargetNodeId());
@@ -1853,7 +1853,7 @@ private void insertNodeSecurityUpdate(ISqlTransaction transaction, String nodeId
}

public void sendScript(String nodeId, String script, boolean isLoad) {
Node targetNode = engine.getNodeService().findNode(nodeId);
Node targetNode = engine.getNodeService().findNode(nodeId, true);
TriggerHistory history = engine.getTriggerRouterService()
.findTriggerHistoryForGenericSync();
Data data = new Data(history.getSourceTableName(), DataEventType.BSH,
@@ -1870,7 +1870,7 @@ public void sendScript(String nodeId, String script, boolean isLoad) {
public boolean sendSchema(String nodeId, String catalogName, String schemaName,
String tableName, boolean isLoad) {
Node sourceNode = engine.getNodeService().findIdentity();
Node targetNode = engine.getNodeService().findNode(nodeId);
Node targetNode = engine.getNodeService().findNode(nodeId, true);
if (targetNode == null) {
log.error("Could not send schema to the node {}. The target node does not exist", nodeId);
return false;
@@ -1902,7 +1902,7 @@ public boolean sendSchema(String nodeId, String catalogName, String schemaName,
public String sendSQL(String nodeId, String catalogName, String schemaName, String tableName,
String sql) {
Node sourceNode = engine.getNodeService().findIdentity();
Node targetNode = engine.getNodeService().findNode(nodeId);
Node targetNode = engine.getNodeService().findNode(nodeId, true);
if (targetNode == null) {
return "Unknown node " + nodeId;
}
@@ -105,7 +105,7 @@ public String findIdentityNodeId() {
@Override
public String getExternalId(String nodeId) {
String externalId = null;
Node node = findNode(nodeId);
Node node = findNode(nodeId, true);
if (node != null) {
externalId = node.getExternalId();
}
@@ -799,7 +799,7 @@ public void checkForOfflineNodes() {
}
long cutOffTimeMillis = clientNodeCurrentTime.getTime() - offlineNodeDetectionMillis;
if (time == null || time.getTime() < cutOffTimeMillis) {
offlineNodeList.add(findNode(nodeId));
offlineNodeList.add(findNode(nodeId, true));
}
}
}
@@ -355,7 +355,7 @@ public void processTableRequestLoads(Node source, ProcessInfo processInfo, Map<

Map<String, List<TableReloadRequest>> requestsSplitByLoad = new HashMap<String, List<TableReloadRequest>>();
for (TableReloadRequest load : loadsToProcess) {
Node targetNode = engine.getNodeService().findNode(load.getTargetNodeId());
Node targetNode = engine.getNodeService().findNode(load.getTargetNodeId(), true);
if (!useExtractJob || streamToFile) {
if (load.isFullLoadRequest() && isValidLoadTarget(load.getTargetNodeId())) {
List<TableReloadRequest> fullLoad = new ArrayList<TableReloadRequest>();
@@ -393,7 +393,7 @@ public void processTableRequestLoads(Node source, ProcessInfo processInfo, Map<
}

for (Map.Entry<String, List<TableReloadRequest>> entry : requestsSplitByLoad.entrySet()) {
Node targetNode = engine.getNodeService().findNode(entry.getKey().split("::")[0]);
Node targetNode = engine.getNodeService().findNode(entry.getKey().split("::")[0], true);
ITriggerRouterService triggerRouterService = engine.getTriggerRouterService();
List<TriggerRouter> triggerRouters = triggerRoutersByTargetNodeGroupId.get(targetNode.getNodeGroupId());
if (triggerRouters == null) {
@@ -964,7 +964,7 @@ public final PullDataResults getPullData(
IDataExtractorService dataExtractorService = engine.getDataExtractorService();
IStatisticManager statisticManager = engine.getStatisticManager();
INodeService nodeService = engine.getNodeService();
org.jumpmind.symmetric.model.Node targetNode = nodeService.findNode(nodeId);
org.jumpmind.symmetric.model.Node targetNode = nodeService.findNode(nodeId, true);

if (securityVerified(nodeId, engine, securityToken)) {
ProcessInfo processInfo = statisticManager.newProcessInfo(new ProcessInfoKey(

0 comments on commit 456427e

Please sign in to comment.
You can’t perform that action at this time.