@Override public boolean openTransaction() { return rawStore.openTransaction(); }
@Override public void add_runtime_stats(RuntimeStat stat) throws TException { startFunction("store_runtime_stats"); Exception ex = null; boolean success = false; RawStore ms = getMS(); try { ms.openTransaction(); ms.addRuntimeStat(stat); success = ms.commitTransaction(); } catch (Exception e) { LOG.error("Caught exception", e); ex = e; throw e; } finally { if (!success) { ms.rollbackTransaction(); } endFunction("store_runtime_stats", success, ex); } }
@Override public void add_serde(SerDeInfo serde) throws TException { startFunction("create_serde", ": " + serde.getName()); Exception ex = null; boolean success = false; RawStore ms = getMS(); try { ms.openTransaction(); ms.addSerde(serde); success = ms.commitTransaction(); } catch (MetaException|AlreadyExistsException e) { LOG.error("Caught exception creating serde", e); ex = e; throw e; } finally { if (!success) { ms.rollbackTransaction(); } endFunction("create_serde", success, ex); } }
firePreEvent(new PreCreateISchemaEvent(this, schema)); Map<String, String> transactionalListenersResponses = Collections.emptyMap(); ms.openTransaction(); try { ms.createISchema(schema);
@Override public void alter_function(String dbName, String funcName, Function newFunc) throws TException { String[] parsedDbName = parseDbName(dbName, conf); validateForAlterFunction(parsedDbName[DB_NAME], funcName, newFunc); boolean success = false; RawStore ms = getMS(); try { ms.openTransaction(); ms.alterFunction(parsedDbName[CAT_NAME], parsedDbName[DB_NAME], funcName, newFunc); success = ms.commitTransaction(); } catch (InvalidObjectException e) { // Throwing MetaException instead of InvalidObjectException as the InvalidObjectException // is not defined for the alter_function method in the Thrift interface. throwMetaException(e); } finally { if (!success) { ms.rollbackTransaction(); } } }
ms.openTransaction(); try { ms.dropSchemaVersion(version);
ms.openTransaction(); try { ms.addSchemaVersion(schemaVersion);
ms.openTransaction(); ms.alterDatabase(parsedDbName[CAT_NAME], parsedDbName[DB_NAME], newDB);
try { String[] parsedDbName = parseDbName(db_name, conf); ms.openTransaction(); startPartitionFunction("markPartitionForEvent", parsedDbName[CAT_NAME], parsedDbName[DB_NAME], tbl_name, partName);
boolean ret = false, committed = false; getMS().openTransaction(); try { List<String> partVals = getPartValsFromName(getMS(), parsedDbName[CAT_NAME], parsedDbName[DB_NAME], tableName, convertedPartName);
firePreEvent(new PreAlterSchemaVersionEvent(this, oldSchemaVersion, newSchemaVersion)); Map<String, String> transactionalListenersResponses = Collections.emptyMap(); ms.openTransaction(); try { ms.alterSchemaVersion(rqst.getSchemaVersion(), newSchemaVersion);
private void create_type_core(final RawStore ms, final Type type) throws AlreadyExistsException, MetaException, InvalidObjectException { if (!MetaStoreUtils.validateName(type.getName(), null)) { throw new InvalidObjectException("Invalid type name"); } boolean success = false; try { ms.openTransaction(); if (is_type_exists(ms, type.getName())) { throw new AlreadyExistsException("Type " + type.getName() + " already exists"); } ms.createType(type); success = ms.commitTransaction(); } finally { if (!success) { ms.rollbackTransaction(); } } }
ms.openTransaction(); try { ms.alterISchema(rqst.getName(), rqst.getNewSchema());
try { String catName = func.isSetCatName() ? func.getCatName() : getDefaultCatalog(conf); ms.openTransaction(); Database db = ms.getDatabase(catName, func.getDbName()); if (db == null) {
private void updateTablePartitionColStats(RawStore rawStore, String catName, String dbName, String tblName) { boolean committed = false; rawStore.openTransaction(); try { Table table = rawStore.getTable(catName, dbName, tblName); List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table); List<String> partNames = rawStore.listPartitionNames(catName, dbName, tblName, (short) -1); // Get partition column stats for this table Deadline.startTimer("getPartitionColumnStatistics"); List<ColumnStatistics> partitionColStats = rawStore.getPartitionColumnStatistics(catName, dbName, tblName, partNames, colNames); Deadline.stopTimer(); sharedCache.refreshPartitionColStatsInCache(catName, dbName, tblName, partitionColStats); List<Partition> parts = rawStore.getPartitionsByNames(catName, dbName, tblName, partNames); // Also save partitions for consistency as they have the stats state. for (Partition part : parts) { sharedCache.alterPartitionInCache(catName, dbName, tblName, part.getValues(), part); } committed = rawStore.commitTransaction(); } catch (MetaException | NoSuchObjectException e) { LOG.info("Updating CachedStore: unable to read partitions of table: " + tblName, e); } finally { if (!committed) { sharedCache.removeAllPartitionColStatsFromCache(catName, dbName, tblName); rawStore.rollbackTransaction(); } } }
private void updateTableColStats(RawStore rawStore, String catName, String dbName, String tblName) { boolean committed = false; rawStore.openTransaction(); try { Table table = rawStore.getTable(catName, dbName, tblName); if (!table.isSetPartitionKeys()) { List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table); Deadline.startTimer("getTableColumnStatistics"); ColumnStatistics tableColStats = rawStore.getTableColumnStatistics(catName, dbName, tblName, colNames); Deadline.stopTimer(); if (tableColStats != null) { sharedCache.refreshTableColStatsInCache(StringUtils.normalizeIdentifier(catName), StringUtils.normalizeIdentifier(dbName), StringUtils.normalizeIdentifier(tblName), tableColStats.getStatsObj()); // Update the table to get consistent stats state. sharedCache.alterTableInCache(catName, dbName, tblName, table); } } committed = rawStore.commitTransaction(); } catch (MetaException | NoSuchObjectException e) { LOG.info("Unable to refresh table column stats for table: " + tblName, e); } finally { if (!committed) { sharedCache.removeAllTableColStatsFromCache(catName, dbName, tblName); rawStore.rollbackTransaction(); } } }
firePreEvent(new PreAlterCatalogEvent(oldCat.getCatalog(), rqst.getNewCat(), this)); ms.openTransaction(); ms.alterCatalog(rqst.getName(), rqst.getNewCat());
List<String> partVals; boolean committed = false; getMS().openTransaction(); try { if (tbl == null) {
RawStore ms = getMS(); try { ms.openTransaction(); ms.dropConstraint(catName, dbName, tableName, constraintName); if (transactionalListeners.size() > 0) {
getMS().openTransaction(); boolean committed = false; try {