hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject incubator-hawq git commit: HAWQ-611. Improve performance for query with entry database involved
Date Thu, 31 Mar 2016 08:59:16 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master ae8aff2ea -> b65815a3c


HAWQ-611. Improve performance for query with entry database involved


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b65815a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b65815a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b65815a3

Branch: refs/heads/master
Commit: b65815a3c32bfc6a733ccec00f684193d450e389
Parents: ae8aff2
Author: Ruilong Huo <rhuo@pivotal.io>
Authored: Thu Mar 31 01:54:40 2016 -0700
Committer: Ruilong Huo <rhuo@pivotal.io>
Committed: Thu Mar 31 01:54:40 2016 -0700

----------------------------------------------------------------------
 src/backend/storage/ipc/procarray.c | 32 -------------------------
 src/backend/storage/lmgr/lock.c     | 41 +-------------------------------
 src/include/storage/procarray.h     |  2 --
 3 files changed, 1 insertion(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b65815a3/src/backend/storage/ipc/procarray.c
----------------------------------------------------------------------
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index b3bb8c6..620c01c 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1016,38 +1016,6 @@ DisplayXidCache(void)
 
 #endif   /* XIDCACHE_DEBUG */
 
-PGPROC *
-FindProcByGpSessionId(long gp_session_id)
-{
-	/* Find the guy who should manage our locks */
-	ProcArrayStruct *arrayP = procArray;
-	int			index;
-
-	Assert(gp_session_id > 0);
-		
-	LWLockAcquire(ProcArrayLock, LW_SHARED);
-
-	for (index = 0; index < arrayP->numProcs; index++)
-	{
-		PGPROC	   *proc = arrayP->procs[index];
-			
-		if (proc->pid == MyProc->pid)
-			continue;
-				
-		if (!proc->mppIsWriter)
-			continue;
-				
-		if (proc->mppSessionId == gp_session_id)
-		{
-			LWLockRelease(ProcArrayLock);
-			return proc;
-		}
-	}
-		
-	LWLockRelease(ProcArrayLock);
-	return NULL;
-}
-
 /*
  * FindAndSignalProcess
  *     Find the PGPROC entry in procArray which contains the given sessionId and commandId,

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b65815a3/src/backend/storage/lmgr/lock.c
----------------------------------------------------------------------
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index c848f94..7b43a10 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -552,49 +552,10 @@ LockAcquire(const LOCKTAG *locktag,
 #endif /* USE_TEST_UTILS_X86 */
 
 	/*
-	 * lockHolder is the gang member that should hold and manage locks for this
-	 * transaction.  In Utility mode, or on the QD, it's allways myself.
-	 * 
-	 * On the QEs, it should normally be the Writer gang member.
+	 * QD needs to acquire locks, while QE and entry database don't in hawq indeed
 	 */
 	if (lockHolderProcPtr == NULL)
 		lockHolderProcPtr = MyProc;
-	
-	if (lockmethodid == DEFAULT_LOCKMETHOD && locktag->locktag_type != LOCKTAG_TRANSACTION)
-	{
-		if (Gp_role == GP_ROLE_EXECUTE && !Gp_is_writer)
-		{	
-			if (lockHolderProcPtr == NULL || lockHolderProcPtr == MyProc)
-			{
-				/* Find the guy who should manage our locks */
-				PGPROC * proc = FindProcByGpSessionId(gp_session_id);
-				int count = 0;
-				while(proc==NULL && count < 5)
-				{
-					pg_usleep( /* microseconds */ 2000);
-					count++;
-					CHECK_FOR_INTERRUPTS();
-					proc = FindProcByGpSessionId(gp_session_id);
-				}
-				if (proc != NULL)
-				{
-					elog(DEBUG1,"Found writer proc entry.  My Pid %d, his pid %d", MyProc-> pid, proc->pid);
-					lockHolderProcPtr = proc;
-				}
-				else
-					elog(DEBUG1,"Could not find writer proc entry!");
-		
-					elog(DEBUG1,"Reader gang member trying to acquire a lock [%u,%u] %s %d",
-						 locktag->locktag_field1, locktag->locktag_field2,
-						 lock_mode_names[lockmode], (int)locktag->locktag_type);
-			}
-				
-		}
-	}
-	
-	
-	
-	
 
 	/*
 	 * Otherwise we've got to mess with the shared lock table.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b65815a3/src/include/storage/procarray.h
----------------------------------------------------------------------
diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h
index c592efb..9788649 100644
--- a/src/include/storage/procarray.h
+++ b/src/include/storage/procarray.h
@@ -40,8 +40,6 @@ extern int	CountUserBackends(Oid roleid);
 extern void XidCacheRemoveRunningXids(TransactionId xid,
 						  int nxids, TransactionId *xids);
 						  
-extern PGPROC *FindProcByGpSessionId(long gp_session_id);
-
 extern struct SnapshotData* GetSnapshotData(struct SnapshotData *snapshot, bool serializable);
 extern void updateSharedLocalSnapshot(struct DtxContextInfo *dtxContextInfo, struct SnapshotData
*snapshot, char* debugCaller);
 


Mime
View raw message