mirror of https://github.com/apache/druid.git
Fix default TaskResource for RealtimeIndexTasks.
It was supposed to be the same as the task id, but it wasn't because "makeTaskId" has a random component.
This commit is contained in:
parent
c82b680cd4
commit
a355bfb7a9
|
@ -56,19 +56,25 @@ public abstract class AbstractTask implements Task
|
||||||
|
|
||||||
protected AbstractTask(String id, String dataSource, Map<String, Object> context)
|
protected AbstractTask(String id, String dataSource, Map<String, Object> context)
|
||||||
{
|
{
|
||||||
this(id, id, new TaskResource(id, 1), dataSource, context);
|
this(id, null, null, dataSource, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractTask(String id, String groupId, String dataSource, Map<String, Object> context)
|
protected AbstractTask(String id, String groupId, String dataSource, Map<String, Object> context)
|
||||||
{
|
{
|
||||||
this(id, groupId, new TaskResource(id, 1), dataSource, context);
|
this(id, groupId, null, dataSource, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractTask(String id, String groupId, TaskResource taskResource, String dataSource, Map<String, Object> context)
|
protected AbstractTask(
|
||||||
|
String id,
|
||||||
|
String groupId,
|
||||||
|
TaskResource taskResource,
|
||||||
|
String dataSource,
|
||||||
|
Map<String, Object> context
|
||||||
|
)
|
||||||
{
|
{
|
||||||
this.id = Preconditions.checkNotNull(id, "id");
|
this.id = Preconditions.checkNotNull(id, "id");
|
||||||
this.groupId = Preconditions.checkNotNull(groupId, "groupId");
|
this.groupId = groupId == null ? id : groupId;
|
||||||
this.taskResource = Preconditions.checkNotNull(taskResource, "resource");
|
this.taskResource = taskResource == null ? new TaskResource(id, 1) : taskResource;
|
||||||
this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource");
|
this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource");
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class RealtimeIndexTask extends AbstractTask
|
||||||
super(
|
super(
|
||||||
id == null ? makeTaskId(fireDepartment) : id,
|
id == null ? makeTaskId(fireDepartment) : id,
|
||||||
String.format("index_realtime_%s", makeDatasource(fireDepartment)),
|
String.format("index_realtime_%s", makeDatasource(fireDepartment)),
|
||||||
taskResource == null ? new TaskResource(makeTaskId(fireDepartment), 1) : taskResource,
|
taskResource,
|
||||||
makeDatasource(fireDepartment),
|
makeDatasource(fireDepartment),
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|
|
@ -274,6 +274,13 @@ public class RealtimeIndexTaskTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(timeout = 60_000L)
|
||||||
|
public void testDefaultResource() throws Exception
|
||||||
|
{
|
||||||
|
final RealtimeIndexTask task = makeRealtimeTask(null);
|
||||||
|
Assert.assertEquals(task.getId(), task.getTaskResource().getAvailabilityGroup());
|
||||||
|
}
|
||||||
|
|
||||||
@Test(timeout = 60_000L)
|
@Test(timeout = 60_000L)
|
||||||
public void testBasics() throws Exception
|
public void testBasics() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue