@Test(timeout=80000)
public void testQueueingWithThreads() throws Exception {
final int PART_COUNT = 12;
hiveConf.setInt(MetastoreConf.ConfVars.BATCH_RETRIEVE_MAX.getVarname(), 5);
hiveConf.setInt(MetastoreConf.ConfVars.STATS_AUTO_UPDATE_WORKER_COUNT.getVarname(), 2);
StatsUpdaterThread su = createUpdater();
su.startWorkers();
IMetaStoreClient msClient = new HiveMetaStoreClient(hiveConf);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVESTATSAUTOGATHER, false);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVESTATSCOLAUTOGATHER, false);
executeQuery("create table simple_stats (s string) partitioned by (i int)");
for (int i = 0; i < PART_COUNT; ++i) {
executeQuery("insert into simple_stats partition(i='" + i + "') values ('test')");
}
verifyPartStatsUpToDate(PART_COUNT, 0, msClient, "simple_stats", false);
setPartitionSkipProperty(msClient, "simple_stats", "i=0", "true");
assertTrue(su.runOneIteration());
su.waitForQueuedCommands();
verifyStatsUpToDate("simple_stats", "i=0", Lists.newArrayList("s"), msClient, false);
verifyPartStatsUpToDate(PART_COUNT, 1, msClient, "simple_stats", true);
assertFalse(su.runOneIteration());
drainWorkQueue(su, 0);
msClient.close();
}