Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Upgrade to ES 6.7 (#19)
Browse files Browse the repository at this point in the history
* Upgrade to ES 6.7

* use ES 6.7.1
  • Loading branch information
jinsoor-amzn authored Apr 9, 2019
1 parent 335a8b4 commit 4ccb8d2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class AlertMover(
val runnable = Runnable {
monitorRunner.rescheduleAlertMover(monitorId, monitor, backoff)
}
threadPool.schedule(wait, ThreadPool.Names.SAME, runnable)
threadPool.schedule(runnable, wait, ThreadPool.Names.SAME)
} else {
logger.warn("Retries exhausted for ${monitorIdTriggerIdsTuple()}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ abstract class AlertingRestTestCase : ESRestTestCase() {
override fun restClientSettings(): Settings {
return if (isDebuggingTest || isDebuggingRemoteCluster) {
Settings.builder()
.put(CLIENT_RETRY_TIMEOUT, TimeValue.timeValueMinutes(10))
.put(CLIENT_SOCKET_TIMEOUT, TimeValue.timeValueMinutes(10))
.build()
} else {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
apply from: 'build-tools/repositories.gradle'

ext {
es_version = '6.6.2'
es_version = '6.7.1'
kotlin_version = '1.3.21'
}

Expand All @@ -41,7 +41,7 @@ apply plugin: 'jacoco'
apply from: 'build-tools/merged-coverage.gradle'

ext {
opendistroVersion = '0.8.0'
opendistroVersion = '0.9.0'
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import com.amazon.opendistroforelasticsearch.alerting.core.JobRunner
import com.amazon.opendistroforelasticsearch.alerting.core.model.ScheduledJob
import org.apache.logging.log4j.LogManager
import org.elasticsearch.common.unit.TimeValue
import org.elasticsearch.threadpool.Scheduler
import org.elasticsearch.threadpool.ThreadPool
import java.time.Duration
import java.time.Instant
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit
import java.util.stream.Collectors

Expand Down Expand Up @@ -81,7 +81,7 @@ class JobScheduler(private val threadPool: ThreadPool, private val jobRunner: Jo
val scheduledJobInfo = scheduledJobIdToInfo.getOrPut(scheduledJob.id) {
ScheduledJobInfo(scheduledJob.id, scheduledJob)
}
if (scheduledJobInfo.scheduledFuture != null) {
if (scheduledJobInfo.scheduledCancellable != null) {
// This means that the given ScheduledJob already has schedule running. We should not schedule any more.
return true
}
Expand Down Expand Up @@ -131,10 +131,10 @@ class JobScheduler(private val threadPool: ThreadPool, private val jobRunner: Jo
scheduledJobInfo.actualPreviousExecutionTime = null
scheduledJobInfo.expectedNextExecutionTime = null
var result = true
val scheduledFuture = scheduledJobInfo.scheduledFuture
val scheduledFuture = scheduledJobInfo.scheduledCancellable

if (scheduledFuture != null && !scheduledFuture.isDone) {
result = scheduledFuture.cancel(false)
if (scheduledFuture != null && !scheduledFuture.isCancelled) {
result = scheduledFuture.cancel()
}

if (result) {
Expand Down Expand Up @@ -194,8 +194,8 @@ class JobScheduler(private val threadPool: ThreadPool, private val jobRunner: Jo
}

// Finally schedule the job in the ThreadPool with next time to execute.
val scheduledFuture = threadPool.schedule(TimeValue(duration.toNanos(), TimeUnit.NANOSECONDS), ThreadPool.Names.SAME, runnable)
scheduledJobInfo.scheduledFuture = scheduledFuture
val scheduledCancellable = threadPool.schedule(runnable, TimeValue(duration.toNanos(), TimeUnit.NANOSECONDS), ThreadPool.Names.SAME)
scheduledJobInfo.scheduledCancellable = scheduledCancellable

return true
}
Expand Down Expand Up @@ -230,6 +230,6 @@ class JobScheduler(private val threadPool: ThreadPool, private val jobRunner: Jo
var descheduled: Boolean = false,
var actualPreviousExecutionTime: Instant? = null,
var expectedNextExecutionTime: Instant? = null,
var scheduledFuture: ScheduledFuture<*>? = null
var scheduledCancellable: Scheduler.ScheduledCancellable? = null
)
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

0 comments on commit 4ccb8d2

Please sign in to comment.