Issue with maapi.queryStart() method

Hi,

I want to do validation (max records 65535) before importing the xml file configuration.
In the validation process 3 times we are hitting maapi.queryStart().
1 - for getting all MME pool ids (ie 800 max)
2 - for getting all TAC for each MME pool id in loop (max - 256*800)
3 - for getting all PLMN’s (MCC & MNC)in nested loop for each MME pool id and for each TAC.
-> here each hit is taking 15 second of time.

This complete process taking 13.5 days time to complete the validation process.
How can I do this complete validation in minimum amount of time (max 5 minutes).
Please also suggest if we can get data in key-value pair in json format at one hit of ConfD.

Thanks,
Rahul

Can you describe in more detail how you use maapi.queryStart(). Do you you use it as 3 separate iterations or as 3 iterations nested inside?

Hi,

I am using nested iterations…
Below code I am using …

private void validateTrackingArea() throws IOException, ConfException{

		QueryResult<ResultTypeKeyPathValue> res = null;
		String sctpStatus = CMConstants.MO_TRACKING_AREA_PATH;
		List<String> selectExp = new ArrayList<String>();
		selectExp.add(Configuration.configuration_MME_pool_id_);
		List<ConfValue> mmePoolIds = new ArrayList<ConfValue>();
		Set<ConfValue> tacs = new HashSet<ConfValue>();
		res = _maapi.queryStart(_transId, sctpStatus, "/", 65535, 0, selectExp, ResultTypeKeyPathValue.class);
		if(res != null){
			for(QueryResult.Entry<ResultTypeKeyPathValue> entry:res){
				List<ResultTypeKeyPathValue> kpval=entry.value();
				for(ResultTypeKeyPathValue mmePoolId: kpval){
					if(!mmePoolIds.contains(mmePoolId.confValue()))
						mmePoolIds.add(mmePoolId.confValue());
// here will get all 800 MME pool ids
				}
			}
		}

		for(ConfValue mmePoolId: mmePoolIds){
// fetching all TAC related to each MME pool id
			if(res != null)
				res.reset();
			selectExp.clear();
			selectExp.add(Configuration.configuration_TAC_);
			String tacExp = CMConstants.MO_TRACKING_AREA_PATH+"["+Configuration.configuration_MME_pool_id_+"='"+mmePoolId+"']";
			res = _maapi.queryStart(_transId, tacExp, "/", 65535, 0, selectExp, ResultTypeKeyPathValue.class);
			if(res != null){
				for(QueryResult.Entry<ResultTypeKeyPathValue> entry:res){
					List<ResultTypeKeyPathValue> kpval=entry.value();
					for(ResultTypeKeyPathValue tac: kpval){
						tacs.add(tac.confValue());
					}
				}
			}
			if(tacs.size() > 256){
				_logger.error("validateTrackingArea :: Only 256 PLMNs per TAC can be configured in a MME Pool Id = " + mmePoolId);
				throw new ConfException("Only 256 TACs can be mapped to a MME Pool Id = " + mmePoolId);
			}

			for(ConfValue tac: tacs){
// now in nested loop getting PLMN's count for each TAC ie maximum 6
				String tacContExp = "count("+CMConstants.MO_TRACKING_AREA_PATH+"[TAC='"+tac+"']["+Configuration.configuration_MME_pool_id_+"='"+mmePoolId+"'])";
				String numTacs = _maapi.xpathEvalExpr(_transId, tacContExp, null, CMConstants.MO_TRACKING_AREA_PATH);
				if(Integer.parseInt(numTacs) > 6){
					_logger.error("validateTrackingArea :: Only 6 PLMNs can be configured for TAC = "+tac+" in a MME Pool Id =" + mmePoolId);
					throw new ConfException( "Only 6 PLMNs can be configured for TAC = "+tac+" in a MME Pool Id =" + mmePoolId);
				}
			}
			tacs.clear();
		}

	}

Thanks,

When you profile your code, which part takes most the time?
Did you try to use MAAPI cursor instead of queryStart, xpathEvalExpr?
It may be faster if you directly count the occurrence numbers that invoking XPATH related functions.