Skip to content

Commit

Permalink
0004071: Added method to retrieve active load status only
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmind-josh committed Aug 19, 2019
1 parent ffa2568 commit e86d7b1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
Expand Up @@ -63,6 +63,8 @@ public interface IDataService {

public List<TableReloadStatus> getTableReloadStatus();

public List<TableReloadStatus> getActiveTableReloadStatus();

public TableReloadStatus getTableReloadStatusByLoadId(long loadId);

public List<TableReloadStatus> getTableReloadStatusByTarget(String targetNodeId);
Expand Down
Expand Up @@ -350,6 +350,11 @@ public List<TableReloadStatus> getTableReloadStatus() {
new TableReloadStatusMapper());
}

public List<TableReloadStatus> getActiveTableReloadStatus() {
return sqlTemplateDirty.query(getSql("selectActiveTableReloadStatus"),
new TableReloadStatusMapper());
}

public TableReloadStatus getTableReloadStatusByLoadId(long loadId) {
return sqlTemplateDirty.queryForObject(getSql("selectTableReloadStatusByLoadId"),
new TableReloadStatusMapper(), loadId);
Expand Down Expand Up @@ -1579,7 +1584,9 @@ private int insertFileSyncBatchForReload(Node targetNode, long loadId, String cr
.getTriggerRouterForCurrentNode(fileSyncSnapshotHistory.getTriggerId(),
routerid, true);

if(!isFullLoad && reloadRequests != null && reloadRequests.get(fileSyncSnapshotTriggerRouter.getTriggerId() + fileSyncSnapshotTriggerRouter.getRouterId()) == null){
if(!isFullLoad && reloadRequests != null
&& reloadRequests.get(fileSyncSnapshotTriggerRouter.getTriggerId() + fileSyncSnapshotTriggerRouter.getRouterId()) == null
&& !isReloadRequestForFileChannel(reloadRequests)){
return totalBatchCount;
}

Expand Down Expand Up @@ -1615,6 +1622,14 @@ private int insertFileSyncBatchForReload(Node targetNode, long loadId, String cr
return totalBatchCount;
}

private boolean isReloadRequestForFileChannel(Map<String, TableReloadRequest> reloadRequests) {
for (TableReloadRequest reloadRequest : reloadRequests.values()) {
if (reloadRequest.getChannelId() != null && engine.getConfigurationService().getChannel(reloadRequest.getChannelId()).isFileSyncFlag()) {
return true;
}
}
return false;
}
private TriggerHistory lookupTriggerHistory(Trigger trigger) {
TriggerHistory history = engine.getTriggerRouterService()
.getNewestTriggerHistoryForTrigger(trigger.getTriggerId(),
Expand Down Expand Up @@ -3041,5 +3056,4 @@ public String mapRow(Row row) {
return null;
}
}

}
Expand Up @@ -49,7 +49,7 @@ public DataServiceSqlMap(IDatabasePlatform platform, Map<String, String> replace
+ " before_custom_sql, reload_time, processed, channel_id, last_update_by, last_update_time "
+ " from $(table_reload_request) "
+ " order by load_id desc, last_update_time desc");

putSql("selectTableReloadRequestsByLoadId", "select source_node_id, target_node_id, load_id, "
+ " create_table, delete_first, reload_select, channel_id, "
+ " before_custom_sql, processed, "
Expand Down Expand Up @@ -79,6 +79,18 @@ public DataServiceSqlMap(IDatabasePlatform platform, Map<String, String> replace
+ " from $(table_reload_status) "
+ " order by load_id desc, completed, last_update_time desc");

putSql("selectActiveTableReloadStatus", "select source_node_id, target_node_id, load_id, "
+ " end_data_batch_id, start_data_batch_id, "
+ " setup_batch_count, data_batch_count, finalize_batch_count, "
+ " setup_batch_loaded, data_batch_loaded, finalize_batch_loaded, "
+ " table_count, rows_loaded, rows_count, "
+ " completed, cancelled, "
+ " start_time, end_time, last_update_time, last_update_by, "
+ " error_flag, sql_state, sql_code, sql_message "
+ " from $(table_reload_status) "
+ " where completed = 0 and cancelled = 0"
+ " order by load_id desc, completed, last_update_time desc");

putSql("selectTableReloadStatusByLoadId", "select source_node_id, target_node_id, load_id, "
+ " end_data_batch_id, start_data_batch_id, "
+ " setup_batch_count, data_batch_count, finalize_batch_count, "
Expand Down

0 comments on commit e86d7b1

Please sign in to comment.