public int doTransactionUnfriendFriendship(DB db, int threadid, StringBuilder updateLog,StringBuilder readLog, int seqID, HashMap<String, Integer> friendshipInfo
			,HashMap<String, Integer> pendingInfo, int thinkTime,   boolean insertImage, boolean warmup)
	{	
		int numOpsDone =0;
		int keyname = buildKeyName(usercount);
		keyname = activateUser(keyname);
		if(keyname == -1)
			return 0;
		incrUserRef(keyname);
		HashMap<String,ByteIterator> pResult=new HashMap<String,ByteIterator>();
		long startReadp = System.nanoTime();
		int ret = db.viewProfile(keyname, keyname, pResult, insertImage, false);
		if(ret < 0){
			System.out.println("There is an exception in getProfile.");
			System.exit(0);
		}
		long endReadp = System.nanoTime();
		numOpsDone++;
		if(!warmup && enableLogging){
			readLog.append("READ,ACCEPTFRND,"+seqID+","+threadid+","+keyname+","+startReadp+","+endReadp+","+pResult.get("friendcount")+"\n");
			readLog.append("READ,PENDFRND,"+seqID+","+threadid+","+keyname+","+startReadp+","+endReadp+","+pResult.get("pendingcount")+"\n");
			readsExist = true;
		}
		Vector<HashMap<String,ByteIterator>> rResult=new Vector<HashMap<String,ByteIterator>>();		
		ret = db.viewTopKResources(keyname, keyname, 5, rResult);
		if(ret < 0){
			System.out.println("There is an exception in getTopResources.");
			System.exit(0);
		}
		numOpsDone++;
		try {
			Thread.sleep(thinkTime);
		} catch (InterruptedException e) {
			e.printStackTrace(System.out);
		}
		Vector<HashMap<String,ByteIterator>> fResult=new Vector<HashMap<String,ByteIterator>>();
		long startReadf = System.nanoTime();
		ret = db.listFriends(keyname, keyname, null, fResult, insertImage, false);
		if(ret < 0){
			System.out.println("There is an exception in listFriends.");
			System.exit(0);
		}
		long endReadf = System.nanoTime();
		numOpsDone++;
		if(!warmup && enableLogging){
			readLog.append("READ,ACCEPTFRND,"+seqID+","+threadid+","+keyname+","+startReadf+","+endReadf+","+fResult.size()+"\n");
			readsExist = true;
		}
		if(!warmup){
			/*if(fResult.size() == 0){
				//do nothing*/
			try {
				aFrnds.acquire();
			} catch (InterruptedException e) {
				e.printStackTrace(System.out);
			}
			if(acceptedFrnds[memberIdxs.get(keyname)].size() <= 0 ){
				aFrnds.release();
			}else{
				/*Random random = new Random();
				int idx = random.nextInt(fResult.size());
				long startUpdater = System.nanoTime();
				String auserid = "";
				auserid =fResult.get(idx).get("userid").toString();
				*/
				String auserid = "";	
				Set<Integer> keys = acceptedFrnds[memberIdxs.get(keyname)].keySet();
				Iterator<Integer> it = keys.iterator();
				auserid = it.next().toString();	
				if(isActive(Integer.parseInt(auserid)) != -1){ //so two people won't delete the same friendhsip at the same time			
					//remove from acceptedFrnds
					acceptedFrnds[memberIdxs.get(keyname)].remove(Integer.parseInt(auserid));
					acceptedFrnds[memberIdxs.get(Integer.parseInt(auserid))].remove(keyname);
					aFrnds.release();
					long startUpdater = System.nanoTime();
					ret = db.thawFriendship(Integer.parseInt(auserid), keyname);
					if(ret < 0){
						System.out.println("There is an exception in unFriendFriend.");
						System.exit(0);
					}
					int numFriendsForThisUserTillNow = 0;
					if(friendshipInfo.get(Integer.toString(keyname))!= null){
						numFriendsForThisUserTillNow = friendshipInfo.get(Integer.toString(keyname));
					}
					friendshipInfo.put(Integer.toString(keyname), (numFriendsForThisUserTillNow-1));

					int numFriendsForOtherUserTillNow = 0;
					if(friendshipInfo.get(auserid)!= null){
						numFriendsForOtherUserTillNow = friendshipInfo.get(auserid);
					}
					friendshipInfo.put(auserid, (numFriendsForOtherUserTillNow-1));
					long endUpdater = System.nanoTime();
					numOpsDone++;

					if(enableLogging){
						updateLog.append("UPDATE,ACCEPTFRND,"+seqID+","+threadid+","+auserid+","+startUpdater+","+endUpdater+","+(numFriendsForOtherUserTillNow-1)+",D"+"\n");
						updateLog.append("UPDATE,ACCEPTFRND,"+seqID+","+threadid+","+keyname+","+startUpdater+","+endUpdater+","+(numFriendsForThisUserTillNow-1)+",D"+"\n");
						updatesExist = true;
					}
					deRelateUsers(keyname, Integer.parseInt(auserid));
					deactivateUser(Integer.parseInt(auserid));

					try {
						Thread.sleep(thinkTime);
					} catch (InterruptedException e) {
						e.printStackTrace(System.out);
					}
				}
				fResult=new Vector<HashMap<String,ByteIterator>>();
				startReadf = System.nanoTime();
				ret = db.listFriends(keyname, keyname, null, fResult,  insertImage, false);
				if(ret < 0){
					System.out.println("There is an exception in listFriends.");
					System.exit(0);
				}
				endReadf = System.nanoTime();
				numOpsDone++;
				if(!warmup && enableLogging){
					readLog.append("READ,ACCEPTFRND,"+seqID+","+threadid+","+keyname+","+startReadf+","+endReadf+","+fResult.size()+"\n");
					readsExist = true;
				}
			}
		}