mirror of https://github.com/apache/druid.git
Empty task intervals, and empty lock intervals, aren't useful.
So prevent them from being created, through checks in AbstractFixedIntervalTask and TaskLockbox.tryLock.
This commit is contained in:
parent
566a3a6112
commit
846c3da4ab
|
@ -21,6 +21,7 @@ package io.druid.indexing.common.task;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import io.druid.indexing.common.actions.LockTryAcquireAction;
|
import io.druid.indexing.common.actions.LockTryAcquireAction;
|
||||||
import io.druid.indexing.common.actions.TaskActionClient;
|
import io.druid.indexing.common.actions.TaskActionClient;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
|
@ -58,7 +59,8 @@ public abstract class AbstractFixedIntervalTask extends AbstractTask
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
super(id, groupId, taskResource, dataSource);
|
super(id, groupId, taskResource, dataSource);
|
||||||
this.interval = interval;
|
this.interval = Preconditions.checkNotNull(interval, "interval");
|
||||||
|
Preconditions.checkArgument(interval.toDurationMillis() > 0, "interval empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package io.druid.indexing.overlord;
|
package io.druid.indexing.overlord;
|
||||||
|
|
||||||
|
import com.google.api.client.repackaged.com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -109,6 +110,11 @@ public class TaskLockbox
|
||||||
for (final Pair<Task, TaskLock> taskAndLock : byVersionOrdering.sortedCopy(storedLocks)) {
|
for (final Pair<Task, TaskLock> taskAndLock : byVersionOrdering.sortedCopy(storedLocks)) {
|
||||||
final Task task = taskAndLock.lhs;
|
final Task task = taskAndLock.lhs;
|
||||||
final TaskLock savedTaskLock = taskAndLock.rhs;
|
final TaskLock savedTaskLock = taskAndLock.rhs;
|
||||||
|
if (savedTaskLock.getInterval().toDurationMillis() <= 0) {
|
||||||
|
// "Impossible", but you never know what crazy stuff can be restored from storage.
|
||||||
|
log.warn("WTF?! Got lock with empty interval for task: %s", task.getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
uniqueTaskIds.add(task.getId());
|
uniqueTaskIds.add(task.getId());
|
||||||
final Optional<TaskLock> acquiredTaskLock = tryLock(
|
final Optional<TaskLock> acquiredTaskLock = tryLock(
|
||||||
task,
|
task,
|
||||||
|
@ -205,6 +211,7 @@ public class TaskLockbox
|
||||||
giant.lock();
|
giant.lock();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Preconditions.checkArgument(interval.toDurationMillis() > 0, "interval empty");
|
||||||
final String dataSource = task.getDataSource();
|
final String dataSource = task.getDataSource();
|
||||||
final List<TaskLockPosse> foundPosses = findLockPossesForInterval(dataSource, interval);
|
final List<TaskLockPosse> foundPosses = findLockPossesForInterval(dataSource, interval);
|
||||||
final TaskLockPosse posseToUse;
|
final TaskLockPosse posseToUse;
|
||||||
|
|
Loading…
Reference in New Issue