You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by gc...@apache.org on 2015/10/30 23:19:44 UTC

incubator-hawq git commit: HAWQ-55 Adding dependency between optimizer_release_mdcache and gp_metadata_versioning guc. Error out when both guc are set to off which is invalid state

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 224541eec -> 54eafe1d3


HAWQ-55  Adding dependency between optimizer_release_mdcache and gp_metadata_versioning guc. Error out when both guc are set to off which is invalid state


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

Branch: refs/heads/master
Commit: 54eafe1d361b4b4f642b67070fe4fafda5835382
Parents: 224541e
Author: Karthikeyan Jambu Rajaraman <kr...@pivotal.io>
Authored: Mon Oct 26 11:56:03 2015 -0700
Committer: Karthikeyan Jambu Rajaraman <kr...@pivotal.io>
Committed: Fri Oct 30 13:40:26 2015 -0700

----------------------------------------------------------------------
 src/backend/utils/misc/guc.c | 55 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/54eafe1d/src/backend/utils/misc/guc.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index b4cceaa..c7b15bf 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -218,6 +218,8 @@ static bool assign_stage_log_stats(bool newval, bool doit, GucSource source);
 static bool assign_log_stats(bool newval, bool doit, GucSource source);
 static bool assign_dispatch_log_stats(bool newval, bool doit, GucSource source);
 static bool assign_transaction_read_only(bool newval, bool doit, GucSource source);
+static bool assign_optimizer_release_mdcache(bool newval, bool doit, GucSource source);
+static bool assign_gp_metadata_versioning(bool newval, bool doit, GucSource source);
 static const char *assign_canonical_path(const char *newval, bool doit, GucSource source);
 static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source);
 static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source);
@@ -684,7 +686,7 @@ int             optimizer_cost_model;
 bool		optimizer_print_query;
 bool		optimizer_print_plan;
 bool		optimizer_print_xform;
-bool		optimizer_release_mdcache;
+bool		optimizer_release_mdcache = true; /* Make sure we release MDCache between queries by default */
 bool		optimizer_disable_xform_result_printing;
 bool		optimizer_print_memo_after_exploration;
 bool		optimizer_print_memo_after_implementation;
@@ -1167,7 +1169,7 @@ static struct config_bool ConfigureNamesBool[] =
 			GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
 		},
 		&gp_metadata_versioning,
-		false, NULL, NULL
+		false, &assign_gp_metadata_versioning, NULL
 	},
 	{
 		{"force_bitmap_table_scan", PGC_USERSET, DEVELOPER_OPTIONS,
@@ -3522,7 +3524,7 @@ static struct config_bool ConfigureNamesBool[] =
 			GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
 		},
 		&optimizer_release_mdcache,
-		true, NULL, NULL
+		true, &assign_optimizer_release_mdcache, NULL
 	},
 
 	{
@@ -13242,6 +13244,53 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source)
 	return true;
 }
 
+
+/*
+ * Validate that if we disable releasing the MD Cache after each query,
+ *   we must have MD Versioning turned on.
+ */
+static bool
+assign_optimizer_release_mdcache(bool newval, bool doit, GucSource source)
+{
+	 /*
+	  * We want to avoid reaching the following state:
+	  *  - optimizer_release_mdcache = off
+	  *  - gp_metadata_versioning = off
+	  * Other states are fine.
+	  */
+	if (!newval && !gp_metadata_versioning)
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				 errmsg("cannot set optimizer_release_mdcache to off when gp_metadata_versioning is off")));
+		return false;
+	}
+	return true;
+}
+
+/*
+ * Validate that if we disable MD Versioning, we are releasing the MD Cache
+ *   after each query.
+ */
+static bool
+assign_gp_metadata_versioning(bool newval, bool doit, GucSource source)
+{
+	 /*
+	  * We want to avoid reaching the following state:
+	  *  - optimizer_release_mdcache = off
+	  *  - gp_metadata_versioning = off
+	  * Other states are fine.
+	  */
+	if (!newval && !optimizer_release_mdcache)
+	{
+		ereport(ERROR,
+				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				 errmsg("cannot set gp_metadata_versioning to off when optimizer_release_mdcache is off")));
+		return false;
+	}
+	return true;
+}
+
 static const char *
 assign_canonical_path(const char *newval, bool doit, GucSource source)
 {