public AbstractDetailQueryResultIterator( List<BlockExecutionInfo> infos, QueryExecutorProperties executerProperties, QueryModel queryModel, InternalQueryExecutor queryExecutor) { int recordSize = 0; String defaultInMemoryRecordsSize = CarbonProperties.getInstance().getProperty(CarbonCommonConstants.INMEMORY_REOCRD_SIZE); if (null != defaultInMemoryRecordsSize) { try { recordSize = Integer.parseInt(defaultInMemoryRecordsSize); } catch (NumberFormatException ne) { LOGGER.error("Invalid inmemory records size. Using default value"); recordSize = CarbonCommonConstants.INMEMORY_REOCRD_SIZE_DEFAULT; } } this.numberOfCores = recordSize / Integer.parseInt( CarbonProperties.getInstance() .getProperty( CarbonCommonConstants.BLOCKLET_SIZE, CarbonCommonConstants.BLOCKLET_SIZE_DEFAULT_VAL)); if (numberOfCores == 0) { numberOfCores++; } executor = queryExecutor; this.blockExecutionInfos = infos; this.blockIndexToBeExecuted = new int[(int) numberOfCores]; intialiseInfos(); }
@Test public void testZooKeeperLockingByTryingToAcquire2Locks() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { final CarbonProperties cp = CarbonProperties.getInstance(); new NonStrictExpectations(cp) { { cp.getProperty("/CarbonLocks"); result = "/carbontests"; cp.getProperty("spark.deploy.zookeeper.url"); result = "127.0.0.1:" + freePort; } }; ZookeeperInit zki = ZookeeperInit.getInstance("127.0.0.1:" + freePort); ZooKeeperLocking zkl = new ZooKeeperLocking( "D:/carbondata/examples/target/store/default/t3/Metadata", LockUsage.METADATA_LOCK); Assert.assertTrue(zkl.lock()); ZooKeeperLocking zk2 = new ZooKeeperLocking( "D:/carbondata/examples/target/store/default/t3/Metadata", LockUsage.METADATA_LOCK); Assert.assertTrue(!zk2.lock()); Assert.assertTrue(zkl.unlock()); Assert.assertTrue(zk2.lock()); Assert.assertTrue(zk2.unlock()); }