[ https://issues.apache.org/jira/browse/HIVE-21194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16766948#comment-16766948 ]
Seung-Hyun Cheong edited comment on HIVE-21194 at 2/13/19 9:04 AM: ------------------------------------------------------------------- I'm using HDP 3.1.1. And the version of hive in HDP 3.1.1 is 3.1.0. But it's also contains several patches. (Ref. [https://docs.hortonworks.com/HDPDocuments/HDP3/HDP-3.1.0/release-notes/content/patch_hive.html]) To build exactly same hive-druid-handler, I checked out the commit "2ff9c5229d1470afab12258862f801cf14dc2a2d". {code:java} git checkout 2ff9c5229d1470afab12258862f801cf14dc2a2d{code} The fixed DruidStorageHandler.java {code:java} Index: druid-handler/src/java/org/apache/hadoop/hive/druid/DruidStorageHandler.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- druid-handler/src/java/org/apache/hadoop/hive/druid/DruidStorageHandler.java (revision b0d01eb68a604bb6efb68455193803f0651dc265) +++ druid-handler/src/java/org/apache/hadoop/hive/druid/DruidStorageHandler.java (date 1550046272509) @@ -98,6 +98,7 @@ import org.jboss.netty.handler.codec.http.HttpMethod; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; import org.joda.time.Period; import org.skife.jdbi.v2.exceptions.CallbackFailedException; import org.slf4j.Logger; @@ -752,7 +753,7 @@ @Override public void configureOutputJobProperties(TableDesc tableDesc, Map<String, String> jobProperties) { jobProperties.put(Constants.DRUID_DATA_SOURCE, tableDesc.getTableName()); - jobProperties.put(DruidConstants.DRUID_SEGMENT_VERSION, new DateTime().toString()); + jobProperties.put(DruidConstants.DRUID_SEGMENT_VERSION, new DateTime(DateTimeZone.UTC).toString()); jobProperties.put(DruidConstants.DRUID_JOB_WORKING_DIRECTORY, getStagingWorkingDir().toString()); // DruidOutputFormat will write segments in an intermediate directory jobProperties.put(DruidConstants.DRUID_SEGMENT_INTERMEDIATE_DIRECTORY, {code} Building jar {code:java} export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=256M" mvn clean install -DskipTests {code} I deployed fixed jar to all nodes, and restarted hive service. Now, the version of the segment inserted after patched is UTC. !https://media.oss.navercorp.com/user/7420/files/25a18e30-2fb0-11e9-829a-6fc37a382da9! Finally, KillTask worked properly. {code:java} { "task": "kill_upload_2019-02-12T00:00:00.000Z_2019-02-13T00:00:00.000Z_2019-02-13T08:00:08.754Z", "status": { "id": "kill_upload_2019-02-12T00:00:00.000Z_2019-02-13T00:00:00.000Z_2019-02-13T08:00:08.754Z", "status": "SUCCESS", "duration": 7084 } } {code} was (Author: seunghyun.cheong): I'm using HDP 3.1.1. And the version of hive in HDP 3.1.1 is 3.1.0. But it's also contains several patches. (Ref. [https://docs.hortonworks.com/HDPDocuments/HDP3/HDP-3.1.0/release-notes/content/patch_hive.html]) To build exactly same hive-druid-handler, I checked out the commit "2ff9c5229d1470afab12258862f801cf14dc2a2d". {code:java} git checkout 2ff9c5229d1470afab12258862f801cf14dc2a2d{code} The fixed DruidStorageHandler.java !image-2019-02-13-17-53-24-488.png! Building jar {code:java} export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=256M" mvn clean install -DskipTests {code} I deployed fixed jar to all nodes, and restarted hive service. Now, the version of the segment inserted after patched is UTC. !https://media.oss.navercorp.com/user/7420/files/25a18e30-2fb0-11e9-829a-6fc37a382da9! Finally, KillTask worked properly. {code:java} { "task": "kill_upload_2019-02-12T00:00:00.000Z_2019-02-13T00:00:00.000Z_2019-02-13T08:00:08.754Z", "status": { "id": "kill_upload_2019-02-12T00:00:00.000Z_2019-02-13T00:00:00.000Z_2019-02-13T08:00:08.754Z", "status": "SUCCESS", "duration": 7084 } } {code} > DruidStorageHandler should set a version of segment to UTC > ---------------------------------------------------------- > > Key: HIVE-21194 > URL: https://issues.apache.org/jira/browse/HIVE-21194 > Project: Hive > Issue Type: Bug > Components: Druid integration > Affects Versions: 3.1.0 > Reporter: Seung-Hyun Cheong > Assignee: Seung-Hyun Cheong > Priority: Minor > Attachments: HIVE-21194.patch, image-2019-02-01-16-31-56-958.png, > image-2019-02-01-16-32-17-093.png, image-2019-02-13-17-53-24-488.png > > > h1. Exception while running a KillTask > {code:java} > 2019-01-30T16:58:35,354 ERROR [task-runner-0-priority-0] > io.druid.indexing.overlord.ThreadPoolTaskRunner - Exception while running > task[KillTask{id=kill_upload_2018-12-31T00:00:00.000Z_2019-02-05T00:00:00.000Z_2019-02-01T16:52:31.851Z, > type=kill, dataSource=upload}] > io.druid.java.util.common.ISE: WTF?! Unused > segment[upload_2019-01-01T00:00:00.000Z_2019-01-02T00:00:00.000Z_2019-01-31T01:12:32.289+09:00] > has version[2019-01-31T01:12:32.289+09:00] > task > version[2019-01-30T16:58:29.992Z] > at io.druid.indexing.common.task.KillTask.run(KillTask.java:94) > ~[druid-indexing-service-0.12.1.3.1.0.0-78.jar:0.12.1.3.1.0.0-78] > at > io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:444) > [druid-indexing-service-0.12.1.3.1.0.0-78.jar:0.12.1.3.1.0.0-78] > at > io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:416) > [druid-indexing-service-0.12.1.3.1.0.0-78.jar:0.12.1.3.1.0.0-78] > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > [?:1.8.0_112] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > [?:1.8.0_112] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > [?:1.8.0_112] > at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112] > {code} > > h1. Reason > h3. KillTask compares versions > [KillTask.java#L88|https://github.com/apache/incubator-druid/blob/master/indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillTask.java#L88] > {code:java} > if (unusedSegment.getVersion().compareTo(myLock.getVersion()) > 0) { > throw new ISE( > "WTF?! Unused segment[%s] has version[%s] > task version[%s]", > unusedSegment.getId(), > unusedSegment.getVersion(), > myLock.getVersion() > ); > } > {code} > > h3. KillTask version (UTC, e.g. "2019-01-30T16:58:29.992Z") > [TaskLockbox.java#L593|https://github.com/apache/incubator-druid/blob/8eae26fd4e7572060d112864dd3d5f6a865b9c89/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L593] > {code:java} > version = DateTimes.nowUtc().toString(); > {code} > > h3. Segment version (UTC+9, e.g. "2019-01-31T01:12:32.289+09:00") > [DruidStorageHandler.java#L755|https://github.com/apache/hive/blob/master/druid-handler/src/java/org/apache/hadoop/hive/druid/DruidStorageHandler.java#L755] > {code:java} > jobProperties.put(DruidConstants.DRUID_SEGMENT_VERSION, new > DateTime().toString()); > {code} > > > h1. Suggestion > h3. Because druid uses UTC only, DruidStorageHandler should set a version of > segment to UTC. > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)