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-289. Support server side and fix issue in client side for hawqfaultinjector
Date Fri, 15 Jan 2016 06:10:06 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 7db48c128 -> 3189e0760


HAWQ-289. Support server side and fix issue in client side for hawqfaultinjector


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

Branch: refs/heads/master
Commit: 3189e0760c37788a42d8e561b45d08f7e50a323c
Parents: 7db48c1
Author: doli <doli@pivotal.io>
Authored: Fri Jan 15 14:03:15 2016 +0800
Committer: doli <doli@pivotal.io>
Committed: Fri Jan 15 14:03:15 2016 +0800

----------------------------------------------------------------------
 src/backend/utils/misc/faultinjector.c         | 125 +++++++++-----------
 tools/bin/hawqpylib/hawqarray.py               |   8 +-
 tools/bin/hawqpylib/programs/clsInjectFault.py |   1 -
 3 files changed, 60 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3189e076/src/backend/utils/misc/faultinjector.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/misc/faultinjector.c b/src/backend/utils/misc/faultinjector.c
index 60af41d..44b7462 100644
--- a/src/backend/utils/misc/faultinjector.c
+++ b/src/backend/utils/misc/faultinjector.c
@@ -44,6 +44,7 @@
 #include "cdb/cdbfilerep.h"
 #include "cdb/cdbresynchronizechangetracking.h"
 #include "postmaster/service.h"
+#include "postmaster/identity.h"
 #include "storage/spin.h"
 #include "storage/shmem.h"
 #include "utils/faultinjector.h"
@@ -1001,7 +1002,6 @@ FaultInjector_NewHashEntry(
 	{
 		case ChangeTrackingDisable:
 		case FileRepConsumerVerification:
-		case StartPrepareTx:
 		case FileRepResync:
 		case FileRepResyncInProgress:
 		case FileRepResyncWorker:
@@ -1014,112 +1014,102 @@ FaultInjector_NewHashEntry(
 		case FileRepTransitionToInSyncMarkCompleted:
 		case FileRepTransitionToInSyncBeforeCheckpoint:
 		case FileRepTransitionToChangeTracking:
-		case TransactionCommitPass1FromCreatePendingToCreated:
-		case TransactionCommitPass1FromDropInMemoryToDropPending:
-		case TransactionCommitPass1FromAbortingCreateNeededToAbortingCreate:
-		case TransactionAbortPass1FromCreatePendingToAbortingCreate:
-		case TransactionAbortPass1FromAbortingCreateNeededToAbortingCreate:
-		case TransactionCommitPass2FromDropInMemoryToDropPending:
-		case TransactionCommitPass2FromAbortingCreateNeededToAbortingCreate:
-		case TransactionAbortPass2FromCreatePendingToAbortingCreate:
-		case TransactionAbortPass2FromAbortingCreateNeededToAbortingCreate:
-			
+		case FileRepConsumer:
+		case FileRepSender:
+		case FileRepReceiver:
+		case FileRepFlush:
+		/* Ashwin */
+		case FileRepChangeTrackingCompacting:
 		case FinishPreparedTransactionCommitPass1FromCreatePendingToCreated:
 		case FinishPreparedTransactionCommitPass2FromCreatePendingToCreated:
-			
 		case FinishPreparedTransactionCommitPass1FromDropInMemoryToDropPending:
 		case FinishPreparedTransactionCommitPass2FromDropInMemoryToDropPending:
-			
 		case FinishPreparedTransactionCommitPass1AbortingCreateNeeded:
 		case FinishPreparedTransactionCommitPass2AbortingCreateNeeded:
-			
 		case FinishPreparedTransactionAbortPass1FromCreatePendingToAbortingCreate:
 //		case FinishPreparedTransactionAbortPass2FromCreatePendingToAbortingCreate:
-			
 		case FinishPreparedTransactionAbortPass1AbortingCreateNeeded:
 		case FinishPreparedTransactionAbortPass2AbortingCreateNeeded:
 		case TwoPhaseTransactionCommitPrepared:
 		case TwoPhaseTransactionAbortPrepared:
-		case ExecSortMKSortMergeRuns:
-		
+			/* This kind of fault injection has not been supported yet. */
+			LockRelease();
+			status = STATUS_ERROR;
+			ereport(WARNING,
+					(errmsg("This kind of fault injection has not been supported yet. "
+							"fault name:'%s' fault type:'%s' ",
+							FaultInjectorIdentifierEnumToString[entry->faultInjectorIdentifier],
+							FaultInjectorTypeEnumToString[entry->faultInjectorType])));
+			snprintf(entry->bufOutput, sizeof(entry->bufOutput),
+					 "This kind of fault injection has not been supported yet. "
+					 "Please check faultname");
+			goto exit;
+
 //		case SubtransactionFlushToFile:
 //		case SubtransactionReadFromFile:
 //		case SubtransactionRelease:
 //		case SubtransactionRollback:
-		/* Ashwin */
-		case FileRepChangeTrackingCompacting:
+		case StartPrepareTx:
+		case TransactionCommitPass1FromCreatePendingToCreated:
+		case TransactionCommitPass1FromDropInMemoryToDropPending:
+		case TransactionCommitPass1FromAbortingCreateNeededToAbortingCreate:
+		case TransactionAbortPass1FromCreatePendingToAbortingCreate:
+		case TransactionAbortPass1FromAbortingCreateNeededToAbortingCreate:
+		case TransactionCommitPass2FromDropInMemoryToDropPending:
+		case TransactionCommitPass2FromAbortingCreateNeededToAbortingCreate:
+		case TransactionAbortPass2FromCreatePendingToAbortingCreate:
+		case TransactionAbortPass2FromAbortingCreateNeededToAbortingCreate:
+		case FaultBeforePendingDeleteRelationEntry:
+		case FaultBeforePendingDeleteDatabaseEntry:
+		case FaultBeforePendingDeleteTablespaceEntry:
+		case FaultBeforePendingDeleteFilespaceEntry:
+		case TransactionAbortAfterDistributedPrepared:
+		case DtmBroadcastPrepare:
+		case DtmBroadcastCommitPrepared:
+		case DtmBroadcastAbortPrepared:
+		case DtmXLogDistributedCommit:
+		case AnalyzeSubxactError:
+		case OptTaskAllocateStringBuffer:
 
-		/* We do not use vmem on master. Therefore, we only attempt large palloc on segments. */
-		case MultiExecHashLargeVmem:
-		case FaultInBackgroundWriterMain:
-			
-			/* SEGMENT */
+			/* These faults are designed for master. */
+			if(!AmIMaster())
 			{
 				LockRelease();
 				status = STATUS_ERROR;
 				ereport(WARNING,
-						(errmsg("could not insert fault injection entry into table, segment not in primary
role"
+						(errmsg("could not insert fault injection entry into table, "
+								"This kind of fault injection should be sent to master. "
 								"fault name:'%s' fault type:'%s' ",
 								FaultInjectorIdentifierEnumToString[entry->faultInjectorIdentifier],
 								FaultInjectorTypeEnumToString[entry->faultInjectorType])));
 				snprintf(entry->bufOutput, sizeof(entry->bufOutput), 
-						 "could not insert fault injection, segment not in primary role");
+						 "could not insert fault injection. "
+						 "This kind of fault injection should be sent to master. "
+						 "Please use \"-r master\"");
 				
 				goto exit;
-			}			
+			}
 			break;
 		
-		case FaultBeforePendingDeleteRelationEntry:
-		case FaultBeforePendingDeleteDatabaseEntry:
-		case FaultBeforePendingDeleteTablespaceEntry:
-		case FaultBeforePendingDeleteFilespaceEntry:	
-		case FileRepConsumer:
-		case FileRepSender:
-		case FileRepReceiver:
-		case FileRepFlush:
-		case Postmaster:
-		case PgControl:
-		case PgXlog:
 		case SegmentTransitionRequest:
 		case SegmentProbeResponse:
-			
+		/* We do not use vmem on master. Therefore, we only attempt large palloc on segments. */
+		case MultiExecHashLargeVmem:
 			/* SEGMENT */
+			if(!AmISegment())
 			{
 				LockRelease();
 				status = STATUS_ERROR;
 				ereport(WARNING,
 						(errmsg("could not insert fault injection entry into table, "
-								"segment not in primary or mirror role, "
-								"fault name:'%s' fault type:'%s' ",
-								FaultInjectorIdentifierEnumToString[entry->faultInjectorIdentifier],
-								FaultInjectorTypeEnumToString[entry->faultInjectorType])));
-				snprintf(entry->bufOutput, sizeof(entry->bufOutput), 
-						 "could not insert fault injection, segment not in primary or mirror role");
-				
-				goto exit;
-			}			
-			break;
-			
-		case TransactionAbortAfterDistributedPrepared:
-		case DtmBroadcastPrepare:
-		case DtmBroadcastCommitPrepared:
-		case DtmBroadcastAbortPrepared:
-		case DtmXLogDistributedCommit:			
-		case AnalyzeSubxactError:
-		case OptTaskAllocateStringBuffer:
-			
-			/* TODO: MASTER ONLY */
-			{
-				LockRelease();
-				status = STATUS_ERROR;
-				ereport(WARNING,
-						(errmsg("could not insert fault injection entry into table, "
-								"segment not in master role, "
+								"This kind of fault injection should be sent to segment. "
 								"fault name:'%s' fault type:'%s' ",
 								FaultInjectorIdentifierEnumToString[entry->faultInjectorIdentifier],
 								FaultInjectorTypeEnumToString[entry->faultInjectorType])));
 				snprintf(entry->bufOutput, sizeof(entry->bufOutput), 
-						 "could not insert fault injection, segment not in master role");
+						 "could not insert fault injection. "
+						 "This kind of fault injection should be sent to segment. "
+						 "Please use \"-r primary\"");
 				
 				goto exit;
 			}			
@@ -1136,6 +1126,7 @@ FaultInjector_NewHashEntry(
 		case RunawayCleanup:
 			
 			/* MASTER OR SEGMENT */
+			if(AmIStandby())
 			{
 				LockRelease();
 				status = STATUS_ERROR;
@@ -1146,7 +1137,7 @@ FaultInjector_NewHashEntry(
 								FaultInjectorIdentifierEnumToString[entry->faultInjectorIdentifier],
 								FaultInjectorTypeEnumToString[entry->faultInjectorType])));
 				snprintf(entry->bufOutput, sizeof(entry->bufOutput), 
-						 "could not insert fault injection, segment not in primary or master role");
+						 "could not insert fault injection, segment not in master or segment role");
 				
 				goto exit;
 			}			

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3189e076/tools/bin/hawqpylib/hawqarray.py
----------------------------------------------------------------------
diff --git a/tools/bin/hawqpylib/hawqarray.py b/tools/bin/hawqpylib/hawqarray.py
index eef59b9..947b5e8 100755
--- a/tools/bin/hawqpylib/hawqarray.py
+++ b/tools/bin/hawqpylib/hawqarray.py
@@ -514,15 +514,11 @@ class HAWQArray:
                                       sc.hostname,
                                       sc.address,
                                       sc.port,
-                                      fs.oid,
                                       CASE
                                           WHEN sc.registration_order <= 0 THEN '%s'
                                           ELSE '%s'
                                       END AS datadir
-                               FROM pg_catalog.gp_segment_configuration sc,
-                                    pg_catalog.pg_filespace fs,
-                                    pg_catalog.pg_filespace_entry fse
-                               WHERE fse.fsefsoid = fs.oid
+                               FROM pg_catalog.gp_segment_configuration sc
                                ORDER BY sc.registration_order;''' %
                                (master_data_directory, segment_data_directory))
 
@@ -556,7 +552,7 @@ class HAWQArray:
 
             # Extract fields from the row
             (registration_order, role, status, hostname, 
-             address, port, fsoid, datadir) = row
+             address, port, datadir) = row
 
             # In GPSQL, only master maintain the filespace information.
             # if registration_order != MASTER_REGISTRATION_ORDER and \

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3189e076/tools/bin/hawqpylib/programs/clsInjectFault.py
----------------------------------------------------------------------
diff --git a/tools/bin/hawqpylib/programs/clsInjectFault.py b/tools/bin/hawqpylib/programs/clsInjectFault.py
index 4cf8e36..af4d9df 100644
--- a/tools/bin/hawqpylib/programs/clsInjectFault.py
+++ b/tools/bin/hawqpylib/programs/clsInjectFault.py
@@ -136,7 +136,6 @@ class HAWQInjectFaultProgram:
         #
         # prune gpArray according to filter settings
         #
-        hawqdbs = [hdb for hdb in hawqdbs if hdb.isSegment()]
         if targetHost is not None and targetHost != "ALL":
             hawqdbs = [hdb for hdb in hawqdbs if hdb.getHostName() == targetHost]
 


Mime
View raw message