@Override public void rollbackTransaction() { rawStore.rollbackTransaction(); }
@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); } }
} finally { if (!success) { ms.rollbackTransaction();
@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(); } } }
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!committed) { getMS().rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction();
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(); } } }
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction();
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(); } } }
} finally { if (!success) { ms.rollbackTransaction();
} finally { if (!committed) { getMS().rollbackTransaction();
} finally { if (!success) { ms.rollbackTransaction(); } else { for (MetaStoreEventListener listener : listeners) {
} finally { if (!committed) { getMS().rollbackTransaction();