hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject incubator-hawq git commit: HAWQ-1430. Update ranger related log level to avoid log flood
Date Thu, 13 Apr 2017 09:35:48 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 2d32de10f -> 2d9bc0306


HAWQ-1430. Update ranger related log level to avoid log flood


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

Branch: refs/heads/master
Commit: 2d9bc0306ea38836d360dcb5c30b4d93d3791234
Parents: 2d32de1
Author: stanlyxiang <stanly.sxiang@gmail.com>
Authored: Wed Apr 12 17:17:53 2017 +0800
Committer: hubertzhang <hubertzhang@apache.org>
Committed: Thu Apr 13 17:35:20 2017 +0800

----------------------------------------------------------------------
 src/backend/catalog/aclchk.c   |  4 ++--
 src/backend/libpq/rangerrest.c | 20 ++++++++++----------
 src/backend/tcop/postgres.c    |  6 +++---
 src/include/utils/rangerrest.h |  2 ++
 4 files changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2d9bc030/src/backend/catalog/aclchk.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 77c70fa..207ce12 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -2746,7 +2746,7 @@ List *pg_rangercheck_batch(List *arg_list)
 	List *aclresults = NIL;
 	List *requestargs = NIL;
 	ListCell *arg;
-	elog(DEBUG3, "ranger acl batch check, acl list length: %d\n", arg_list->length);
+	elog(RANGER_LOG, "ranger acl batch check, acl list length: %d\n", arg_list->length);
 	foreach(arg, arg_list)
 	{
 		RangerPrivilegeArgs *arg_ptr = (RangerPrivilegeArgs *) lfirst(arg);
@@ -2816,7 +2816,7 @@ pg_rangercheck(AclObjectKind objkind, Oid object_oid, Oid roleid,
 	List* actions = getActionName(mask);
 	bool isAll = (how == ACLMASK_ALL) ? true: false;
 
-	elog(DEBUG3, "ranger acl check kind: %d, object name: %s, object oid:%d, role: %s, mask:
%u\n",
+	elog(RANGER_LOG, "ranger acl check kind: %d, object name: %s, object oid:%d, role: %s, mask:
%u\n",
 			objkind, objectname, object_oid, rolename, mask);
 
 	List *resultargs = NIL;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2d9bc030/src/backend/libpq/rangerrest.c
----------------------------------------------------------------------
diff --git a/src/backend/libpq/rangerrest.c b/src/backend/libpq/rangerrest.c
index c920575..92852bd 100644
--- a/src/backend/libpq/rangerrest.c
+++ b/src/backend/libpq/rangerrest.c
@@ -80,7 +80,7 @@ static int parse_ranger_response(char* buffer, List *result_list)
 	if (buffer == NULL || strlen(buffer) == 0)
 		return -1;
 
-	elog(DEBUG3, "parse ranger restful response content : %s", buffer);
+	elog(RANGER_LOG, "parse ranger restful response content : %s", buffer);
 
 	struct json_object *response = json_tokener_parse(buffer);
 	if (response == NULL) 
@@ -97,7 +97,7 @@ static int parse_ranger_response(char* buffer, List *result_list)
 	}
 
 	int arraylen = json_object_array_length(accessObj);
-	elog(DEBUG3, "parse ranger response result array length: %d",arraylen);
+	elog(RANGER_LOG, "parse ranger response result array length: %d",arraylen);
 	for (int i=0; i< arraylen; i++){
 		struct json_object *jvalue = NULL;
 		struct json_object *jallow = NULL;
@@ -120,7 +120,7 @@ static int parse_ranger_response(char* buffer, List *result_list)
 		const char *privilege_str = json_object_get_string(jprivilege);
 		uint32 resource_sign = string_hash(resource_str, strlen(resource_str));
 		uint32 privilege_sign = string_hash(privilege_str, strlen(privilege_str));
-		elog(DEBUG3, "ranger response access sign, resource_str: %s, privilege_str: %s",
+		elog(RANGER_LOG, "ranger response access sign, resource_str: %s, privilege_str: %s",
 			resource_str, privilege_str);
 
 		ListCell *result;
@@ -215,7 +215,7 @@ static json_object *create_ranger_request_json(List *request_list, List
*result_
 		AclObjectKind kind = arg_ptr->kind;
 		char* object = arg_ptr->object;
 		Assert(user != NULL && object != NULL);
-		elog(DEBUG3, "build json for ranger restful request, user:%s, kind:%s, object:%s",
+		elog(RANGER_LOG, "build json for ranger restful request, user:%s, kind:%s, object:%s",
 				user, AclObjectKindStr[kind], object);
 
 		json_object *jelement = json_object_new_object();
@@ -318,7 +318,7 @@ static json_object *create_ranger_request_json(List *request_list, List
*result_
 		const char *privilege_str = json_object_to_json_string(jactions);
 		result_ptr->resource_sign = string_hash(resource_str, strlen(resource_str));
 		result_ptr->privilege_sign = string_hash(privilege_str, strlen(privilege_str));
-		elog(DEBUG3, "request access sign, resource_str:%s, privilege_str:%s", 
+		elog(RANGER_LOG, "request access sign, resource_str:%s, privilege_str:%s",
 			resource_str, privilege_str);
 		j++;
 	} // foreach
@@ -349,7 +349,7 @@ static size_t write_callback(char *contents, size_t size, size_t nitems,
 	CURL_HANDLE curl = (CURL_HANDLE) userp;
 	Assert(curl != NULL);
 
-	elog(DEBUG3, "ranger restful response size is %d. response buffer size is %d.", curl->response.response_size,
curl->response.buffer_size);
+	elog(RANGER_LOG, "ranger restful response size is %d. response buffer size is %d.", curl->response.response_size,
curl->response.buffer_size);
 	int original_size = curl->response.buffer_size;
 	while(curl->response.response_size + realsize >= curl->response.buffer_size)
 	{
@@ -361,7 +361,7 @@ static size_t write_callback(char *contents, size_t size, size_t nitems,
 		/* repalloc is not same as realloc, repalloc's first parameter cannot be NULL */
 		curl->response.buffer = repalloc(curl->response.buffer, curl->response.buffer_size);
 	}
-	elog(DEBUG3, "ranger restful response size is %d. response buffer size is %d.", curl->response.response_size,
curl->response.buffer_size);
+	elog(RANGER_LOG, "ranger restful response size is %d. response buffer size is %d.", curl->response.response_size,
curl->response.buffer_size);
 	if (curl->response.buffer == NULL)
 	{
 		/* allocate memory failed. probably out of memory */
@@ -369,7 +369,7 @@ static size_t write_callback(char *contents, size_t size, size_t nitems,
 		return 0;
 	}
 	memcpy(curl->response.buffer + curl->response.response_size, contents, realsize);
-	elog(DEBUG3, "read from ranger restful response: %s", curl->response.buffer);
+	elog(RANGER_LOG, "read from ranger restful response: %s", curl->response.buffer);
 	curl->response.response_size += realsize;
 	curl->response.buffer[curl->response.response_size] = '\0';
 	return realsize;
@@ -431,7 +431,7 @@ static int call_ranger_rest(CURL_HANDLE curl_handle, const char* request)
 	else
 	{
 		ret = 0;
-		elog(DEBUG3, "retrieved %d bytes data from ranger restful response.",
+		elog(RANGER_LOG, "retrieved %d bytes data from ranger restful response.",
 			curl_handle->response.response_size);
 	}
 
@@ -451,7 +451,7 @@ int check_privilege_from_ranger(List *request_list, List *result_list)
 
 	const char *request = json_object_to_json_string(jrequest);
 	Assert(request != NULL);
-	elog(DEBUG3, "send json request to ranger : %s", request);
+	elog(RANGER_LOG, "send json request to ranger : %s", request);
 
 	/* call GET method to send request*/
 	Assert(curl_context_ranger.hasInited);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2d9bc030/src/backend/tcop/postgres.c
----------------------------------------------------------------------
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c1b4b02..40983a0 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4421,7 +4421,7 @@ PostgresMain(int argc, char *argv[], const char *username)
 	{
 		elog(ERROR, "invalid acl check type : %s.", acl_type);
 	}
-	elog(LOG, "acl check type is %s, the acl type value is %d.", acl_type, aclType);
+	elog(RANGER_LOG, "acl check type is %s, the acl type value is %d.", acl_type, aclType);
 	/* for acl_type is ranger*/
 	if (AmIMaster() && aclType == HAWQ_ACL_RANGER && !curl_context_ranger.hasInited)
 	{
@@ -4438,7 +4438,7 @@ PostgresMain(int argc, char *argv[], const char *username)
 		curl_context_ranger.hasInited = true;
 		curl_context_ranger.response.buffer = palloc0(CURL_RES_BUFFER_SIZE);
 		curl_context_ranger.response.buffer_size = CURL_RES_BUFFER_SIZE;
-		elog(DEBUG3, "initialize global curl context for privileges check.");
+		elog(RANGER_LOG, "initialize global curl context for privileges check.");
 		on_proc_exit(curl_finalize, 0);
 	}
 	/*
@@ -5382,7 +5382,7 @@ curl_finalize(int code, Datum arg __MAYBE_UNUSED)
 		/* we're done with libcurl, so clean it up */
 		curl_global_cleanup();
 		curl_context_ranger.hasInited = false;
-		elog(DEBUG3, "finalize the global struct for curl handle context.");
+		elog(RANGER_LOG, "finalize the global struct for curl handle context.");
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2d9bc030/src/include/utils/rangerrest.h
----------------------------------------------------------------------
diff --git a/src/include/utils/rangerrest.h b/src/include/utils/rangerrest.h
index 136804f..9b086c5 100644
--- a/src/include/utils/rangerrest.h
+++ b/src/include/utils/rangerrest.h
@@ -39,6 +39,8 @@
 #define HOST_BUFFER_SIZE 1025
 #define CURL_RES_BUFFER_SIZE 1024
 
+#define RANGER_LOG DEBUG3
+
 typedef enum
 {
   RANGERCHECK_OK = 0,


Mime
View raw message