@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { Deadline.registerIfNot(socketTimeout); boolean isTimerStarted = Deadline.startTimer(method.getName()); try { return method.invoke(base, args); } finally { if (isTimerStarted) { Deadline.stopTimer(); } } } catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { throw e.getCause(); } }
private void start() throws MetaException { Deadline.startTimer("test"); try { Thread.sleep(duration); } catch (InterruptedException e) { failInThread("Odd. Sleeping thread is interrupted.", e); } }
private void updateTablePartitions(RawStore rawStore, String catName, String dbName, String tblName) { try { Deadline.startTimer("getPartitions"); List<Partition> partitions = rawStore.getPartitions(catName, dbName, tblName, Integer.MAX_VALUE); Deadline.stopTimer(); sharedCache.refreshPartitionsInCache(StringUtils.normalizeIdentifier(catName), StringUtils.normalizeIdentifier(dbName), StringUtils.normalizeIdentifier(tblName), partitions); } catch (MetaException | NoSuchObjectException e) { LOG.info("Updating CachedStore: unable to read partitions of table: " + tblName, e); } }
boolean isStarted = Deadline.startTimer(method.getName()); try { object = method.invoke(baseHandler, args);
List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table); if ((partNames != null) && (partNames.size() > 0)) { Deadline.startTimer("getAggregareStatsForAllPartitions"); AggrStats aggrStatsAllPartitions = rawStore.get_aggr_stats_for(catName, dbName, tblName, partNames, colNames); Deadline.startTimer("getAggregareStatsForAllPartitionsExceptDefault"); AggrStats aggrStatsAllButDefaultPartition = rawStore.get_aggr_stats_for(catName, dbName, tblName, partNames, colNames);
AggrStats aggrStatsAllButDefaultPartition = null; if (table.isSetPartitionKeys()) { Deadline.startTimer("getPartitions"); partitions = rawStore.getPartitions(catName, dbName, tblName, Integer.MAX_VALUE); Deadline.stopTimer(); Deadline.startTimer("getPartitionColumnStatistics"); partitionColStats = rawStore.getPartitionColumnStatistics(catName, dbName, tblName, partNames, colNames); Deadline.startTimer("getAggrPartitionColumnStatistics"); aggrStatsAllPartitions = rawStore.get_aggr_stats_for(catName, dbName, tblName, partNames, colNames); Deadline.startTimer("getAggrPartitionColumnStatistics"); aggrStatsAllButDefaultPartition = rawStore.get_aggr_stats_for(catName, dbName, tblName, partNames, colNames); Deadline.startTimer("getTableColumnStatistics"); tableColStats = rawStore.getTableColumnStatistics(catName, dbName, tblName, colNames);
/** * Checks if the JDO cache is able to handle directSQL partition drops in one session. * @throws MetaException * @throws InvalidObjectException * @throws NoSuchObjectException * @throws SQLException */ @Test public void testDirectSQLDropPartitionsCacheInSession() throws MetaException, InvalidObjectException, NoSuchObjectException, InvalidInputException { createPartitionedTable(false, false); // query the partitions with JDO Deadline.startTimer("getPartition"); List<Partition> partitions = objectStore.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, 10, false, true); Assert.assertEquals(3, partitions.size()); // drop partitions with directSql objectStore.dropPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, Arrays.asList("test_part_col=a0", "test_part_col=a1"), true, false); // query the partitions with JDO, checking the cache is not causing any problem partitions = objectStore.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, 10, false, true); Assert.assertEquals(1, partitions.size()); }
private static void dropAllStoreObjects(RawStore store) throws MetaException, InvalidObjectException, InvalidInputException { try { Deadline.registerIfNot(100000); Deadline.startTimer("getPartition"); List<String> dbs = store.getAllDatabases(DEFAULT_CATALOG_NAME); for (int i = 0; i < dbs.size(); i++) { String db = dbs.get(i); List<String> tbls = store.getAllTables(DEFAULT_CATALOG_NAME, db); for (String tbl : tbls) { List<Partition> parts = store.getPartitions(DEFAULT_CATALOG_NAME, db, tbl, 100); for (Partition part : parts) { store.dropPartition(DEFAULT_CATALOG_NAME, db, tbl, part.getValues()); } store.dropTable(DEFAULT_CATALOG_NAME, db, tbl); } store.dropDatabase(DEFAULT_CATALOG_NAME, db); } } catch (NoSuchObjectException e) { } }
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(); } } }
Deadline.startTimer("getPartition"); List<Partition> partitions = objectStore.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, 10, false, true);
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(); } } }
objectStore.addPartition(part2); Deadline.startTimer("getPartition"); List<Partition> partitions = objectStore.getPartitions(DEFAULT_CATALOG_NAME, DB1, TABLE1, 10); Assert.assertEquals(2, partitions.size());
rqst.addToEventTypeSkipList(MessageBuilder.DROP_SCHEMA_VERSION_EVENT); Deadline.startTimer("getNextNotification"); NotificationEventResponse resp = rawStore.getNextNotification(rqst); Deadline.stopTimer();
store.createTable(table); Deadline.startTimer("getPartition"); for (int i = 0; i < 10; i++) { List<String> partVal = new ArrayList<>();
List<String> tbls = store.getAllTables(DEFAULT_CATALOG_NAME, db); for (String tbl : tbls) { Deadline.startTimer("getPartition"); List<Partition> parts = store.getPartitions(DEFAULT_CATALOG_NAME, db, tbl, 100); for (Partition part : parts) {
Deadline.startTimer("dropPartitions"); objectStore.dropPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, Arrays.asList("test_part_col=a0", "test_part_col=a1", "test_part_col=a2"), true, false);
@Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { Deadline.registerIfNot(timeout); try { Deadline.startTimer(method.getName()); final Object object = method.invoke(metacatHMSHandler, args); Deadline.stopTimer(); return object; } catch (InvocationTargetException e) { for (Throwable ex : Throwables.getCausalChain(e)) { if (ex instanceof JDODataStoreException) { throw ex; } } throw e.getCause(); } } }
@Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { Deadline.registerIfNot(timeout); try { Deadline.startTimer(method.getName()); final Object object = method.invoke(metacatHMSHandler, args); Deadline.stopTimer(); return object; } catch (InvocationTargetException e) { for (Throwable ex : Throwables.getCausalChain(e)) { if (ex instanceof JDODataStoreException) { throw ex; } } throw e.getCause(); } } }
private void updateTablePartitions(RawStore rawStore, String catName, String dbName, String tblName) { try { Deadline.startTimer("getPartitions"); List<Partition> partitions = rawStore.getPartitions(catName, dbName, tblName, Integer.MAX_VALUE); Deadline.stopTimer(); sharedCache.refreshPartitionsInCache(StringUtils.normalizeIdentifier(catName), StringUtils.normalizeIdentifier(dbName), StringUtils.normalizeIdentifier(tblName), partitions); } catch (MetaException | NoSuchObjectException e) { LOG.info("Updating CachedStore: unable to read partitions of table: " + tblName, e); } }
private void updateTablePartitionColStats(RawStore rawStore, String catName, String dbName, String tblName) { 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); } catch (MetaException | NoSuchObjectException e) { LOG.info("Updating CachedStore: unable to read partitions of table: " + tblName, e); } }