Skip to content

Commit

Permalink
0003028: When jobs.synchronized.enable is true, sync triggers should
Browse files Browse the repository at this point in the history
only use 1 thread
  • Loading branch information
chenson42 committed Mar 29, 2017
1 parent dcd938a commit 6e3662a
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -1260,12 +1260,20 @@ protected Trigger getTriggerFromList(String triggerId, List<Trigger> triggersTha
}
return null;
}

private int getNumberOfThreadsToUseForSyncTriggers() {
int numThreads = parameterService.getInt(ParameterConstants.SYNC_TRIGGERS_THREAD_COUNT_PER_SERVER);
if (parameterService.is(ParameterConstants.SYNCHRONIZE_ALL_JOBS, false)) {
numThreads = 1;
}
return numThreads;
}

protected void inactivateTriggers(final List<Trigger> triggersThatShouldBeActive,
final StringBuilder sqlBuffer, List<TriggerHistory> activeTriggerHistories) {
final boolean ignoreCase = this.parameterService.is(ParameterConstants.DB_METADATA_IGNORE_CASE);
final Map<String, Set<Table>> tablesByTriggerId = new HashMap<String, Set<Table>>();
int numThreads = parameterService.getInt(ParameterConstants.SYNC_TRIGGERS_THREAD_COUNT_PER_SERVER);
int numThreads = getNumberOfThreadsToUseForSyncTriggers();
ExecutorService executor = Executors.newFixedThreadPool(numThreads, new SyncTriggersThreadFactory());
List<Future<?>> futures = new ArrayList<Future<?>>();

Expand Down Expand Up @@ -1507,7 +1515,7 @@ public void syncTriggers(Table table, boolean force) {
protected void updateOrCreateDatabaseTriggers(final List<Trigger> triggers, final StringBuilder sqlBuffer,
final boolean force, final boolean verifyInDatabase, final List<TriggerHistory> activeTriggerHistories,
final boolean useTableCache) {
int numThreads = parameterService.getInt(ParameterConstants.SYNC_TRIGGERS_THREAD_COUNT_PER_SERVER);
int numThreads = getNumberOfThreadsToUseForSyncTriggers();
ExecutorService executor = Executors.newFixedThreadPool(numThreads, new SyncTriggersThreadFactory());
List<Future<?>> futures = new ArrayList<Future<?>>();

Expand Down

0 comments on commit 6e3662a

Please sign in to comment.