hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject incubator-hawq git commit: HAWQ-416. core dump when cancel delegation token if fatal error happened when setup connection to NAMENODE
Date Wed, 17 Feb 2016 05:49:54 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-416 [created] 2c426c8d5


HAWQ-416. core dump when cancel delegation token if fatal error happened when setup connection
to NAMENODE


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

Branch: refs/heads/HAWQ-416
Commit: 2c426c8d58bd33092449f9259527f46d77d02ed0
Parents: 7794175
Author: Zhanwei Wang <wangzw@apache.org>
Authored: Wed Feb 17 13:38:42 2016 +0800
Committer: Zhanwei Wang <wangzw@apache.org>
Committed: Wed Feb 17 13:38:42 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbfilesystemcredential.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2c426c8d/src/backend/cdb/cdbfilesystemcredential.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbfilesystemcredential.c b/src/backend/cdb/cdbfilesystemcredential.c
index feb233a..12971ec 100644
--- a/src/backend/cdb/cdbfilesystemcredential.c
+++ b/src/backend/cdb/cdbfilesystemcredential.c
@@ -36,11 +36,12 @@
 #include "lib/stringinfo.h"
 #include "libpq/auth.h"
 #include "libpq/pqformat.h"
+#include "miscadmin.h"
 #include "storage/fd.h"
+#include "tcop/pquery.h"
 #include "utils/hsearch.h"
 #include "utils/memutils.h"
 #include "utils/portal.h"
-#include "tcop/pquery.h"
 
 int server_ticket_renew_interval = 43200000; /* millisecond */
 char *krb5_ccname = "/tmp/postgres.ccname";
@@ -287,6 +288,11 @@ add_filesystem_credential(const char * uri)
 		 * because all credentials are being removed from HDFS when
 		 * we end the transaction, and this entry doesn't have a valid
 		 * credential yet.
+		 *
+		 * In some case fatal error will happen and NO exception will be thrown.
+		 * Transaction will abort immediate and we do not know the status of delegation
+		 * token. So initialize token in the hash entry to NULL and check it when canceling
+		 * token.
 		 */
 		PG_TRY();
 		{
@@ -296,6 +302,9 @@ add_filesystem_credential(const char * uri)
 
 			Assert(NULL != entry);
 
+			entry->credential = NULL;
+			entry->fs = NULL;
+
 			while (true)
 			{
 				success = get_filesystem_credential_internal(entry);
@@ -314,6 +323,7 @@ add_filesystem_credential(const char * uri)
 				elog(DEBUG5, "failed to getting credentials for %s://%s:%d, retrying...",
 					 key.protocol, key.host, key.port);
 
+				CHECK_FOR_INTERRUPTS();
 				pg_usleep(cdb_randint(0, 5) * 1000000L);
 			}
 		}
@@ -345,7 +355,8 @@ cancel_filesystem_credential(struct FileSystemCredential *entry)
 			(struct FileSystemCredentialKey*) entry;
 	Insist(strcasecmp(key->protocol, "hdfs") == 0);
 
-	HdfsCancelDelegationToken(entry->fs, entry->credential);
+	if (NULL != entry->credential)
+		HdfsCancelDelegationToken(entry->fs, entry->credential);
 }
 
 static void


Mime
View raw message