You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by dk...@apache.org on 2023/01/25 14:42:52 UTC
[hive] branch master updated: HIVE-26793: Create a new configuration to override 'no compaction' for tables (Kokila N, reviewed by Denys Kuzmenko, Laszlo Vegh)
This is an automated email from the ASF dual-hosted git repository.
dkuzmenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 63486b18ca5 HIVE-26793: Create a new configuration to override 'no compaction' for tables (Kokila N, reviewed by Denys Kuzmenko, Laszlo Vegh)
63486b18ca5 is described below
commit 63486b18ca5a4dfc01d37484e0ea4b7cca42c580
Author: kokila-19 <35...@users.noreply.github.com>
AuthorDate: Wed Jan 25 20:12:37 2023 +0530
HIVE-26793: Create a new configuration to override 'no compaction' for tables (Kokila N, reviewed by Denys Kuzmenko, Laszlo Vegh)
Closes #3822
---
.../ql/txn/compactor/TestCompactionMetrics2.java | 83 ++++++++++++++++++
.../hive/ql/txn/compactor/TestCompactorBase.java | 3 -
.../hive/ql/txn/compactor/TestInitiator2.java | 99 ++++++++++++++++++++++
.../hadoop/hive/ql/txn/compactor/Initiator.java | 20 +++--
.../ql/txn/compactor/TestCompactionMetrics.java | 2 +-
.../metastore/api/hive_metastoreConstants.java | 2 +-
.../hive/metastore/utils/MetaStoreUtils.java | 27 ++++--
.../hadoop/hive/metastore/HMSMetricsListener.java | 39 +++++----
8 files changed, 243 insertions(+), 32 deletions(-)
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics2.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics2.java
new file mode 100644
index 00000000000..a107692c353
--- /dev/null
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics2.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.txn.compactor;
+
+import org.apache.hadoop.hive.metastore.HMSMetricsListener;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.metastore.metrics.Metrics;
+import org.apache.hadoop.hive.metastore.metrics.MetricsConstants;
+import org.apache.hadoop.hive.metastore.txn.TxnUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+public class TestCompactionMetrics2 extends CompactorTest {
+ @Test
+ public void testWritesToDisabledCompactionDatabase() throws Exception {
+ MetastoreConf.setVar(conf, MetastoreConf.ConfVars.TRANSACTIONAL_EVENT_LISTENERS, HMSMetricsListener.class.getName());
+ txnHandler = TxnUtils.getTxnStore(conf);
+
+ String dbName = "test";
+ Map<String, String> dbParams = new HashMap<String, String>(1);
+ dbParams.put("NO_AUTO_COMPACTION", "true");
+ ms.createDatabase(new Database(dbName, "", null, dbParams));
+
+ Map<String, String> params = new HashMap<>();
+ params.put(hive_metastoreConstants.NO_AUTO_COMPACT, "false");
+ Table t = newTable(dbName, "comp_disabled", false, params);
+ burnThroughTransactions(dbName, t.getTableName(), 1, null, null);
+ burnThroughTransactions(dbName, t.getTableName(), 1, null, new HashSet<>(
+ Collections.singletonList(2L)));
+
+ Assert.assertEquals(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE + " value incorrect",
+ 2, Metrics.getOrCreateGauge(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE).intValue());
+ }
+
+ @Test
+ public void testWritesToEnabledCompactionDatabase() throws Exception {
+ MetastoreConf.setVar(conf, MetastoreConf.ConfVars.TRANSACTIONAL_EVENT_LISTENERS, HMSMetricsListener.class.getName());
+ txnHandler = TxnUtils.getTxnStore(conf);
+
+ String dbName = "test1";
+ Map<String, String> dbParams = new HashMap<String, String>(1);
+ dbParams.put("no_auto_compaction", "false");
+ ms.createDatabase(new Database(dbName, "", null, dbParams));
+
+ Map<String, String> params = new HashMap<>();
+ params.put(hive_metastoreConstants.NO_AUTO_COMPACT, "true");
+ Table t = newTable(dbName, "comp_enabled", false, params);
+ burnThroughTransactions(dbName, t.getTableName(), 1, null, null);
+ burnThroughTransactions(dbName, t.getTableName(), 1, null, new HashSet<>(
+ Collections.singletonList(2L)));
+
+ Assert.assertEquals(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE + " value incorrect",
+ 0, Metrics.getOrCreateGauge(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE).intValue());
+ }
+
+ @Override
+ boolean useHive130DeltaDirName() {
+ return false;
+ }
+}
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactorBase.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactorBase.java
index e7ecca78354..8b6e57c8d0f 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactorBase.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactorBase.java
@@ -181,8 +181,5 @@ class TestCompactorBase {
writer.close();
}
}
-
}
-
-
}
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator2.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator2.java
new file mode 100644
index 00000000000..18fd05b9fde
--- /dev/null
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator2.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.txn.compactor;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.*;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class TestInitiator2 extends CompactorTest {
+ @Test
+ public void dbNoAutoCompactSetTrue() throws Exception {
+ String dbName = "test";
+ Map<String, String> dbParams = new HashMap<String, String>(1);
+ dbParams.put("no_auto_compaction", "true");
+ Database db = new Database(dbName, "", null, dbParams);
+ ms.createDatabase(db);
+ Map<String, String> parameters = new HashMap<>(1);
+ parameters.put("no_auto_compaction", "true");
+ Table t = newTable(dbName, "dbnacst", false, parameters);
+
+ HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD, 10);
+
+ for (int i = 0; i < 11; i++) {
+ long txnid = openTxn();
+ LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, dbName);
+ comp.setTablename("dbnacst");
+ comp.setOperationType(DataOperationType.UPDATE);
+ List<LockComponent> components = new ArrayList<LockComponent>(1);
+ components.add(comp);
+ LockRequest req = new LockRequest(components, "me", "localhost");
+ req.setTxnid(txnid);
+ txnHandler.lock(req);
+ txnHandler.abortTxn(new AbortTxnRequest(txnid));
+ }
+
+ startInitiator();
+
+ ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+ Assert.assertEquals(0, rsp.getCompactsSize());
+ }
+
+ @Test
+ public void dbNoAutoCompactSetFalseUpperCase() throws Exception {
+ String dbName = "test1";
+ Map<String, String> params = new HashMap<String, String>(1);
+ params.put("NO_AUTO_COMPACTION", "false");
+ Database db = new Database(dbName, "", null, params);
+ ms.createDatabase(db);
+ Map<String, String> parameters = new HashMap<>(1);
+ parameters.put("no_auto_compaction", "true");
+ Table t = newTable(dbName, "dbnacsf", false, parameters);
+
+ HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD, 10);
+
+ for (int i = 0; i < 11; i++) {
+ long txnid = openTxn();
+ LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, dbName);
+ comp.setTablename("dbnacsf");
+ comp.setOperationType(DataOperationType.UPDATE);
+ List<LockComponent> components = new ArrayList<LockComponent>(1);
+ components.add(comp);
+ LockRequest req = new LockRequest(components, "me", "localhost");
+ req.setTxnid(txnid);
+ txnHandler.lock(req);
+ txnHandler.abortTxn(new AbortTxnRequest(txnid));
+ }
+
+ startInitiator();
+
+ ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+ Assert.assertEquals(1, rsp.getCompactsSize());
+ }
+
+ @Override
+ boolean useHive130DeltaDirName() {
+ return false;
+ }
+}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
index 42de37668bc..73fc18592f3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
@@ -55,6 +55,7 @@ import org.apache.hadoop.hive.metastore.txn.CompactionInfo;
import org.apache.hadoop.hive.metastore.txn.TxnCommonUtils;
import org.apache.hadoop.hive.metastore.txn.TxnStore;
import org.apache.hadoop.hive.metastore.txn.TxnUtils;
+import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils;
import org.apache.hadoop.hive.ql.io.AcidDirectory;
import org.apache.hadoop.hive.ql.io.AcidUtils;
import org.apache.hadoop.hive.ql.io.AcidUtils.ParsedDirectory;
@@ -87,8 +88,6 @@ import java.util.stream.Collectors;
import static org.apache.hadoop.hive.conf.Constants.COMPACTOR_INTIATOR_THREAD_NAME_FORMAT;
import static org.apache.hadoop.hive.metastore.HMSHandler.getMSForConf;
-import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog;
-import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.isNoAutoCompactSet;
/**
* A class to initiate compactions. This will run in a separate thread.
@@ -306,7 +305,7 @@ public class Initiator extends MetaStoreCompactorThread {
private Database resolveDatabase(CompactionInfo ci) throws MetaException, NoSuchObjectException {
try {
- return getMSForConf(conf).getDatabase(getDefaultCatalog(conf), ci.dbname);
+ return getMSForConf(conf).getDatabase(MetaStoreUtils.getDefaultCatalog(conf), ci.dbname);
} catch (NoSuchObjectException e) {
LOG.error("Unable to find database " + ci.dbname + ", " + e.getMessage());
throw e;
@@ -671,13 +670,22 @@ public class Initiator extends MetaStoreCompactorThread {
return false;
}
- if (isNoAutoCompactSet(t.getParameters())) {
- LOG.info("Table " + tableName(t) + " marked " + hive_metastoreConstants.TABLE_NO_AUTO_COMPACT +
- "=true so we will not compact it.");
+ Map<String, String> dbParams = computeIfAbsent(ci.dbname, () -> resolveDatabase(ci)).getParameters();
+ if (MetaStoreUtils.isNoAutoCompactSet(dbParams, t.getParameters())) {
+ if (Boolean.parseBoolean(MetaStoreUtils.getNoAutoCompact(dbParams))) {
+ skipDBs.add(ci.dbname);
+ LOG.info("DB " + ci.dbname + " marked " + hive_metastoreConstants.NO_AUTO_COMPACT +
+ "=true so we will not compact it.");
+ } else {
+ skipTables.add(ci.getFullTableName());
+ LOG.info("Table " + tableName(t) + " marked " + hive_metastoreConstants.NO_AUTO_COMPACT +
+ "=true so we will not compact it.");
+ }
return false;
}
if (AcidUtils.isInsertOnlyTable(t.getParameters()) && !HiveConf
.getBoolVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_COMPACT_MM)) {
+ skipTables.add(ci.getFullTableName());
LOG.info("Table " + tableName(t) + " is insert only and " + HiveConf.ConfVars.HIVE_COMPACTOR_COMPACT_MM.varname
+ "=false so we will not compact it.");
return false;
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics.java b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics.java
index 4428e15c27d..24c625139ec 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCompactionMetrics.java
@@ -836,7 +836,7 @@ public class TestCompactionMetrics extends CompactorTest {
String dbName = "default";
Map<String, String> params = new HashMap<>();
- params.put(hive_metastoreConstants.TABLE_NO_AUTO_COMPACT, "true");
+ params.put(hive_metastoreConstants.NO_AUTO_COMPACT, "true");
Table disabledTbl = newTable(dbName, "comp_disabled", false, params);
burnThroughTransactions(disabledTbl.getDbName(), disabledTbl.getTableName(), 1, null, null);
burnThroughTransactions(disabledTbl.getDbName(), disabledTbl.getTableName(), 1, null, new HashSet<>(
diff --git a/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/hive_metastoreConstants.java b/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/hive_metastoreConstants.java
index e4cc6f74044..02eed33ce8d 100644
--- a/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/hive_metastoreConstants.java
+++ b/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/hive_metastoreConstants.java
@@ -63,7 +63,7 @@ package org.apache.hadoop.hive.metastore.api;
public static final java.lang.String TABLE_IS_TRANSACTIONAL = "transactional";
- public static final java.lang.String TABLE_NO_AUTO_COMPACT = "no_auto_compaction";
+ public static final java.lang.String NO_AUTO_COMPACT = "no_auto_compaction";
public static final java.lang.String TABLE_TRANSACTIONAL_PROPERTIES = "transactional_properties";
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java
index 0df401be7d1..00c278ec51b 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java
@@ -1152,15 +1152,30 @@ public class MetaStoreUtils {
/**
* Because TABLE_NO_AUTO_COMPACT was originally assumed to be NO_AUTO_COMPACT and then was moved
* to no_auto_compact, we need to check it in both cases.
+ * Check the database level no_auto_compact , if present it is given priority else table level no_auto_compact is considered.
*/
- public static boolean isNoAutoCompactSet(Map<String, String> parameters) {
- String noAutoCompact =
- parameters.get(hive_metastoreConstants.TABLE_NO_AUTO_COMPACT);
+ public static boolean isNoAutoCompactSet(Map<String, String> dbParameters, Map<String, String> tblParameters) {
+ String dbNoAutoCompact = getNoAutoCompact(dbParameters);
+ if (dbNoAutoCompact == null) {
+ LOG.debug("Using table configuration '" + hive_metastoreConstants.NO_AUTO_COMPACT + "' for compaction");
+ String noAutoCompact = getNoAutoCompact(tblParameters);
+ return Boolean.parseBoolean(noAutoCompact);
+ }
+ LOG.debug("Using database configuration '" + hive_metastoreConstants.NO_AUTO_COMPACT + "' for compaction");
+ return Boolean.parseBoolean(dbNoAutoCompact);
+ }
+
+ /**
+ * Get no_auto_compact property by checking in both lower and upper cases
+ * @param parameters
+ * @return true/false if set, null if there is no NO_AUTO_COMPACT set in database level config,
+ */
+ public static String getNoAutoCompact(Map<String, String> parameters) {
+ String noAutoCompact = parameters.get(hive_metastoreConstants.NO_AUTO_COMPACT);
if (noAutoCompact == null) {
- noAutoCompact =
- parameters.get(hive_metastoreConstants.TABLE_NO_AUTO_COMPACT.toUpperCase());
+ return parameters.get(hive_metastoreConstants.NO_AUTO_COMPACT.toUpperCase());
}
- return noAutoCompact != null && noAutoCompact.equalsIgnoreCase("true");
+ return noAutoCompact;
}
public static String getHostFromId(String id) {
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSMetricsListener.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSMetricsListener.java
index 5e94c2c875e..6d5756885df 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSMetricsListener.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSMetricsListener.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.metastore;
import com.codahale.metrics.Counter;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
@@ -37,6 +38,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
+import java.util.Map;
/**
* Report metrics of metadata added, deleted by this Hive Metastore.
@@ -97,30 +99,37 @@ public class HMSMetricsListener extends MetaStoreEventListener {
@Override
public void onAllocWriteId(AllocWriteIdEvent allocWriteIdEvent, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException {
- if (MetastoreConf.getBoolVar(getConf(), MetastoreConf.ConfVars.METASTORE_ACIDMETRICS_EXT_ON)) {
- Table table = getTable(allocWriteIdEvent);
- // In the case of CTAS, the table is created after write ids are allocated, so we'll skip metrics collection.
- if (table != null && MetaStoreUtils.isNoAutoCompactSet(table.getParameters())) {
- int noAutoCompactSet =
- Metrics.getOrCreateGauge(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE).incrementAndGet();
- if (noAutoCompactSet >=
- MetastoreConf.getIntVar(getConf(),
- MetastoreConf.ConfVars.COMPACTOR_NUMBER_OF_DISABLED_COMPACTION_TABLES_THRESHOLD)) {
- LOGGER.warn("There has been a write to table " + table.getDbName() + "." + table.getTableName() +
- " where auto-compaction is disabled (tblproperties (\"no_auto_compact\"=\"true\")).");
- }
+ if (MetastoreConf.getBoolVar(getConf(), MetastoreConf.ConfVars.METASTORE_ACIDMETRICS_EXT_ON) && isNoAutoCompactSet(allocWriteIdEvent)) {
+ int numOfWritesToDisabledCompactionTable = Metrics.getOrCreateGauge(MetricsConstants.WRITES_TO_DISABLED_COMPACTION_TABLE).incrementAndGet();
+ if (numOfWritesToDisabledCompactionTable >= MetastoreConf.getIntVar(getConf(), MetastoreConf.ConfVars.COMPACTOR_NUMBER_OF_DISABLED_COMPACTION_TABLES_THRESHOLD)) {
+ LOGGER.warn("There has been a write to table " + allocWriteIdEvent.getDbName() + "." + allocWriteIdEvent.getTableName() + " where auto-compaction is disabled \"no_auto_compact\"=\"true\".");
}
}
}
- private Table getTable(AllocWriteIdEvent allocWriteIdEvent) throws MetaException {
+ private Boolean isNoAutoCompactSet(AllocWriteIdEvent allocWriteIdEvent) throws MetaException {
String catalog = MetaStoreUtils.getDefaultCatalog(getConf());
String dbName = allocWriteIdEvent.getDbName();
String tableName = allocWriteIdEvent.getTableName();
+
+ RawStore rawStore;
if (allocWriteIdEvent.getIHMSHandler() != null) {
- return allocWriteIdEvent.getIHMSHandler().getMS().getTable(catalog, dbName, tableName);
+ rawStore = allocWriteIdEvent.getIHMSHandler().getMS();
} else {
- return HMSHandler.getMSForConf(getConf()).getTable(catalog, dbName, tableName);
+ rawStore = HMSHandler.getMSForConf(getConf());
+ }
+ Map<String, String> dbParameters;
+ try {
+ dbParameters = rawStore.getDatabase(catalog, dbName).getParameters();
+ } catch (NoSuchObjectException e) {
+ LOGGER.error("Unable to find database " + dbName + ", " + e.getMessage());
+ throw new MetaException(String.valueOf(e));
+ }
+ Table table = rawStore.getTable(catalog, dbName, tableName);
+ // In the case of CTAS, the table is created after write ids are allocated, so we'll skip metrics collection.
+ if (table != null) {
+ return MetaStoreUtils.isNoAutoCompactSet(dbParameters, table.getParameters());
}
+ return false;
}
}