mirror of https://github.com/apache/druid.git
change endpoints for killing segments
This commit is contained in:
parent
d252059e4a
commit
9e88197845
|
@ -33,7 +33,10 @@ import com.metamx.druid.client.ServerInventoryManager;
|
||||||
import com.metamx.druid.coordination.DruidClusterInfo;
|
import com.metamx.druid.coordination.DruidClusterInfo;
|
||||||
import com.metamx.druid.db.DatabaseRuleManager;
|
import com.metamx.druid.db.DatabaseRuleManager;
|
||||||
import com.metamx.druid.db.DatabaseSegmentManager;
|
import com.metamx.druid.db.DatabaseSegmentManager;
|
||||||
|
import com.metamx.druid.master.DruidMaster;
|
||||||
import com.metamx.druid.master.rules.Rule;
|
import com.metamx.druid.master.rules.Rule;
|
||||||
|
import com.metamx.druid.merge.ClientKillQuery;
|
||||||
|
import org.joda.time.Interval;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -58,6 +61,7 @@ import java.util.TreeSet;
|
||||||
@Path("/info")
|
@Path("/info")
|
||||||
public class InfoResource
|
public class InfoResource
|
||||||
{
|
{
|
||||||
|
private final DruidMaster master;
|
||||||
private final ServerInventoryManager serverInventoryManager;
|
private final ServerInventoryManager serverInventoryManager;
|
||||||
private final DatabaseSegmentManager databaseSegmentManager;
|
private final DatabaseSegmentManager databaseSegmentManager;
|
||||||
private final DatabaseRuleManager databaseRuleManager;
|
private final DatabaseRuleManager databaseRuleManager;
|
||||||
|
@ -65,12 +69,14 @@ public class InfoResource
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InfoResource(
|
public InfoResource(
|
||||||
|
DruidMaster master,
|
||||||
ServerInventoryManager serverInventoryManager,
|
ServerInventoryManager serverInventoryManager,
|
||||||
DatabaseSegmentManager databaseSegmentManager,
|
DatabaseSegmentManager databaseSegmentManager,
|
||||||
DatabaseRuleManager databaseRuleManager,
|
DatabaseRuleManager databaseRuleManager,
|
||||||
DruidClusterInfo druidClusterInfo
|
DruidClusterInfo druidClusterInfo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
this.master = master;
|
||||||
this.serverInventoryManager = serverInventoryManager;
|
this.serverInventoryManager = serverInventoryManager;
|
||||||
this.databaseSegmentManager = databaseSegmentManager;
|
this.databaseSegmentManager = databaseSegmentManager;
|
||||||
this.databaseRuleManager = databaseRuleManager;
|
this.databaseRuleManager = databaseRuleManager;
|
||||||
|
@ -362,11 +368,17 @@ public class InfoResource
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/datasources/{dataSourceName}")
|
@Path("/datasources/{dataSourceName}")
|
||||||
public Response deleteDataSource(
|
public Response deleteDataSource(
|
||||||
@PathParam("dataSourceName") final String dataSourceName
|
@PathParam("dataSourceName") final String dataSourceName,
|
||||||
|
@QueryParam("kill") final String kill,
|
||||||
|
@QueryParam("interval") final String interval
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!databaseSegmentManager.removeDatasource(dataSourceName)) {
|
if (kill != null && Boolean.valueOf(kill)) {
|
||||||
return Response.status(Response.Status.NOT_FOUND).build();
|
master.killSegments(new ClientKillQuery(dataSourceName, new Interval(interval)));
|
||||||
|
} else {
|
||||||
|
if (!databaseSegmentManager.removeDatasource(dataSourceName)) {
|
||||||
|
return Response.status(Response.Status.NOT_FOUND).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
|
|
|
@ -111,15 +111,6 @@ public class MasterResource
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
|
||||||
@Path("/kill")
|
|
||||||
@Consumes("application/json")
|
|
||||||
public Response killSegments(ClientKillQuery killQuery)
|
|
||||||
{
|
|
||||||
master.killSegments(killQuery);
|
|
||||||
return Response.ok().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/loadstatus")
|
@Path("/loadstatus")
|
||||||
@Produces("application/json")
|
@Produces("application/json")
|
||||||
|
|
|
@ -20,14 +20,9 @@ $(document).ready(function() {
|
||||||
Yes : function() {
|
Yes : function() {
|
||||||
var selected = $('#datasources option:selected').text();
|
var selected = $('#datasources option:selected').text();
|
||||||
var interval = $('#interval').val();
|
var interval = $('#interval').val();
|
||||||
var toSend = {
|
|
||||||
"dataSource" : selected,
|
|
||||||
"interval" : interval
|
|
||||||
}
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'DELETE',
|
||||||
url:'/master/kill',
|
url:'/info/datasources/' + selected +'?kill=true&interval=' + interval,
|
||||||
data: JSON.stringify(toSend),
|
|
||||||
contentType:"application/json; charset=utf-8",
|
contentType:"application/json; charset=utf-8",
|
||||||
dataType:"json",
|
dataType:"json",
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
|
|
Loading…
Reference in New Issue