This is an automated email from the ASF dual-hosted git repository.
akashrn5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git
The following commit(s) were added to refs/heads/master by this push:
new fdcfcbf [CARBONDATA-3616]: Load and drop table operations fail when
index server is stopped with indexserver and prepriming property enabled
fdcfcbf is described below
commit fdcfcbfe29ea87be6260508aa8a5426b3567c07c
Author: Vikram Ahuja <[email protected]>
AuthorDate: Wed Dec 11 10:39:26 2019 +0530
[CARBONDATA-3616]: Load and drop table operations fail when index server is
stopped with indexserver
and prepriming property enabled
Modification Reason: If index server is stopped and all it's properties are
enabled,
then it tries to connect to the index Server.
Modification Content: Added try catch while prpriming and trying to clear
datamaps.
This closes #3506
---
.../org/apache/carbondata/core/datamap/DataMapUtil.java | 9 ++++++++-
.../command/indexserver/PrePrimingListener.scala | 16 +++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git
a/core/src/main/java/org/apache/carbondata/core/datamap/DataMapUtil.java
b/core/src/main/java/org/apache/carbondata/core/datamap/DataMapUtil.java
index a9020e7..1a1200c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datamap/DataMapUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/datamap/DataMapUtil.java
@@ -116,7 +116,14 @@ public class DataMapUtil {
DistributableDataMapFormat dataMapFormat =
new DistributableDataMapFormat(carbonTable,
validAndInvalidSegmentsInfo.getValidSegments(),
invalidSegment, true, dataMapToClear);
- dataMapJob.execute(dataMapFormat);
+ try {
+ dataMapJob.execute(dataMapFormat);
+ } catch (Exception e) {
+ // Consider a scenario where clear datamap job is called from drop table
+ // and index server crashes, in this no exception should be thrown and
+ // drop table should complete.
+ LOGGER.error("Failed to execute Datamap clear Job", e);
+ }
}
public static void executeClearDataMapJob(CarbonTable carbonTable, String
jobClassName)
diff --git
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/indexserver/PrePrimingListener.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/indexserver/PrePrimingListener.scala
index 4d5e633..0c2e4cf 100644
---
a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/indexserver/PrePrimingListener.scala
+++
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/indexserver/PrePrimingListener.scala
@@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.command.indexserver
import scala.collection.JavaConverters._
+import org.apache.carbondata.common.logging.LogServiceFactory
import org.apache.carbondata.core.datamap.{DistributableDataMapFormat, Segment}
import org.apache.carbondata.events.{Event, IndexServerLoadEvent,
OperationContext, OperationEventListener}
@@ -26,6 +27,9 @@ import org.apache.carbondata.indexserver.IndexServer
// Listener for the PrePriming Event. This listener calls the index server
using an Asynccall
object PrePrimingEventListener extends OperationEventListener {
+
+ private val LOGGER = LogServiceFactory.getLogService(this.getClass.getName)
+
override def onEvent(event: Event,
operationContext: OperationContext): Unit = {
val prePrimingEvent = event.asInstanceOf[IndexServerLoadEvent]
@@ -40,7 +44,17 @@ object PrePrimingEventListener extends
OperationEventListener {
false,
true)
if (prePrimingEvent.segment.length != 0) {
- IndexServer.getClient.getCount(dataMapFormat)
+ try {
+ IndexServer.getClient.getCount(dataMapFormat)
+ }
+ catch {
+ // Consider a scenario where prepriming is in progress and the index
server crashes, in
+ // this case since we should not fail the corresponding operation
where pre-priming is
+ // triggered. Because prepriming is an optimization for cache loading
prior to query,
+ // so no exception should be thrown.
+ case ex: Exception =>
+ LOGGER.error(s"Prepriming failed for table
${carbonTable.getTableName} ", ex)
+ }
}
}
}