[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r221497091 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -42,28 +45,69 @@ @Nullable private final String errorMsg; + public TaskStatusPlus( + String id, + String type, // nullable for backward compatibility + DateTime createdTime, + DateTime queueInsertionTime, + @Nullable TaskState statusCode, + @Nullable RunnerTaskState runnerStatusCode, + @Nullable Long duration, + TaskLocation location, + @Nullable String dataSource, // nullable for backward compatibility + @Nullable String errorMsg + ) + { +this( +id, +type, +createdTime, +queueInsertionTime, +statusCode, +statusCode, +runnerStatusCode, +duration, +location, +dataSource, +errorMsg +); + } + + @JsonCreator public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, // nullable for backward compatibility @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, - @JsonProperty("statusCode") @Nullable TaskState state, + @JsonProperty("statusCode") @Nullable TaskState statusCode, + @Deprecated @JsonProperty("status") @Nullable TaskState status, // present for backwards compatibility @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, // nullable for backward compatibility @JsonProperty("errorMsg") @Nullable String errorMsg ) { -if (state != null && state.isComplete()) { +if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); -this.state = state; +//checks for deserialization safety +if (statusCode != null && status == null) { + this.statusCode = statusCode; +} else if (statusCode == null && status != null) { + this.statusCode = status; +} else { + if (statusCode != null && status != null && statusCode != status) { +log.error("statusCode[%s] and status[%s] must be same", statusCode, status); +throw new RuntimeException("statusCode and status must match"); Review comment: okay This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r221497039 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -42,28 +47,71 @@ @Nullable private final String errorMsg; + public TaskStatusPlus( + String id, + String type, // nullable for backward compatibility + DateTime createdTime, + DateTime queueInsertionTime, + @Nullable TaskState statusCode, + @Nullable RunnerTaskState runnerStatusCode, + @Nullable Long duration, + TaskLocation location, + @Nullable String dataSource, // nullable for backward compatibility + @Nullable String errorMsg + ) + { +this( +id, +type, +createdTime, +queueInsertionTime, +statusCode, +statusCode, +runnerStatusCode, +duration, +location, +dataSource, +errorMsg +); + } + + @JsonCreator public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, // nullable for backward compatibility @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, - @JsonProperty("statusCode") @Nullable TaskState state, + @JsonProperty("statusCode") @Nullable TaskState statusCode, + @Deprecated @JsonProperty("status") @Nullable TaskState status, // present for backwards compatibility @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, // nullable for backward compatibility @JsonProperty("errorMsg") @Nullable String errorMsg ) { -if (state != null && state.isComplete()) { +if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); -this.state = state; +//checks for deserialization safety +if (statusCode != null && status == null) { + this.statusCode = statusCode; + this.status = statusCode; +} else if (statusCode == null && status != null) { + this.statusCode = status; + this.status = status; +} else { + if (statusCode != null && status != null && statusCode != status) { +log.error("statusCode[%s] and status[%s] must be same", statusCode, status); Review comment: sure This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r221438124 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -22,18 +22,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; +import org.apache.druid.java.util.common.logger.Logger; import org.joda.time.DateTime; import javax.annotation.Nullable; import java.util.Objects; public class TaskStatusPlus { + private static final Logger log = new Logger(TaskStatusPlus.class); + private final String id; private final String type; private final DateTime createdTime; private final DateTime queueInsertionTime; - private final TaskState state; + private final TaskState statusCode; + @Deprecated + private final TaskState status; Review comment: ok, yes that can work This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r221410555 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -42,28 +47,71 @@ @Nullable private final String errorMsg; + public TaskStatusPlus( + String id, + String type, // nullable for backward compatibility + DateTime createdTime, + DateTime queueInsertionTime, + @Nullable TaskState statusCode, + @Nullable RunnerTaskState runnerStatusCode, + @Nullable Long duration, + TaskLocation location, + @Nullable String dataSource, // nullable for backward compatibility + @Nullable String errorMsg + ) + { +this( +id, +type, +createdTime, +queueInsertionTime, +statusCode, +statusCode, +runnerStatusCode, +duration, +location, +dataSource, +errorMsg +); + } + + @JsonCreator public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, // nullable for backward compatibility @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, - @JsonProperty("statusCode") @Nullable TaskState state, + @JsonProperty("statusCode") @Nullable TaskState statusCode, + @Deprecated @JsonProperty("status") @Nullable TaskState status, // present for backwards compatibility @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, // nullable for backward compatibility @JsonProperty("errorMsg") @Nullable String errorMsg ) { -if (state != null && state.isComplete()) { +if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); -this.state = state; +//checks for deserialization safety +if (statusCode != null && status == null) { + this.statusCode = statusCode; + this.status = statusCode; +} else if (statusCode == null && status != null) { + this.statusCode = status; + this.status = status; +} else { + if (statusCode != null && status != null && statusCode != status) { +log.error("statusCode[%s] and status[%s] must be same", statusCode, status); Review comment: I do not think there can be a mismatch, added a RuntimeException. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r221410391 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -22,18 +22,23 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; +import org.apache.druid.java.util.common.logger.Logger; import org.joda.time.DateTime; import javax.annotation.Nullable; import java.util.Objects; public class TaskStatusPlus { + private static final Logger log = new Logger(TaskStatusPlus.class); + private final String id; private final String type; private final DateTime createdTime; private final DateTime queueInsertionTime; - private final TaskState state; + private final TaskState statusCode; + @Deprecated + private final TaskState status; Review comment: I think both variables are required with `@JsonProperty`, else the serialization/deserialization can fail. for eg if `status` is present in the json, then deserialization fails. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r219657962 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -42,28 +47,71 @@ @Nullable private final String errorMsg; - @JsonCreator public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, // nullable for backward compatibility @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, - @JsonProperty("statusCode") @Nullable TaskState state, + @JsonProperty("statusCode") @Nullable TaskState statusCode, + @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerStatusCode, + @JsonProperty("duration") @Nullable Long duration, + @JsonProperty("location") TaskLocation location, + @JsonProperty("dataSource") @Nullable String dataSource, // nullable for backward compatibility + @JsonProperty("errorMsg") @Nullable String errorMsg + ) + { +this( +id, +type, +createdTime, +queueInsertionTime, +statusCode, +statusCode, +runnerStatusCode, +duration, +location, +dataSource, +errorMsg +); + } + + + @JsonCreator + private TaskStatusPlus( + @JsonProperty("id") String id, + @JsonProperty("type") @Nullable String type, // nullable for backward compatibility + @JsonProperty("createdTime") DateTime createdTime, + @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, + @JsonProperty("statusCode") @Nullable TaskState statusCode, + @Deprecated @JsonProperty("status") @Nullable TaskState status, // present for backwards compatibility @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, // nullable for backward compatibility @JsonProperty("errorMsg") @Nullable String errorMsg ) { -if (state != null && state.isComplete()) { +if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); -this.state = state; +//checks for deserialization safety +if (statusCode != null && status == null) { + this.state = statusCode; Review comment: ok This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r219657909 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -44,13 +47,42 @@ @Nullable private final String errorMsg; - @JsonCreator public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, // nullable for backward compatibility @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, - @JsonProperty("statusCode") @Nullable TaskState state, + @JsonProperty("statusCode") @Nullable TaskState statusCode, Review comment: right, will remove the annotations. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r219355823 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -49,6 +51,7 @@ public TaskStatusPlus( @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState state, + @Deprecated @JsonProperty("status") @Nullable TaskState status, // present for backwards compatibility Review comment: added the checks This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r219355832 ## File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java ## @@ -267,6 +267,7 @@ public Response getTaskStatus(@PathParam("taskid") String taskid) // TaskStorage API doesn't yet allow it. DateTimes.EPOCH, taskInfo.getStatus().getStatusCode(), + taskInfo.getStatus().getStatusCode(), Review comment: yes, that's a good suggestion, should we make the existing constructor private as well This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[GitHub] surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333)
surekhasaharan commented on a change in pull request #6334: make 0.13 tasks API backwards compatible with 0.12 (#6333) URL: https://github.com/apache/incubator-druid/pull/6334#discussion_r219354254 ## File path: api/src/main/java/org/apache/druid/indexer/TaskStatusPlus.java ## @@ -49,6 +51,7 @@ public TaskStatusPlus( @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState state, Review comment: done This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org