Repository: incubator-hawq Updated Branches: refs/heads/master 3ffcf2a00 -> 808038750
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/backend/utils/mdver/mdver_utils.c ---------------------------------------------------------------------- diff --git a/src/backend/utils/mdver/mdver_utils.c b/src/backend/utils/mdver/mdver_utils.c deleted file mode 100644 index 33b487c..0000000 --- a/src/backend/utils/mdver/mdver_utils.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/*------------------------------------------------------------------------- - * - * mdver_utils.c - * Utility functions for metadata versioning - * - *------------------------------------------------------------------------- - */ - -#include "postgres.h" - -#include "cdb/cdbvars.h" -#include "miscadmin.h" -#include "utils/atomic.h" -#include "utils/inval.h" -#include "utils/mdver.h" - - -static void mdver_request_from_global(Oid key, uint64 *ddl_version, uint64 *dml_version); -static void mdver_request_after_nuke(Oid key, uint64 *ddl_version, uint64 *dml_version); - -/* - * Returns a string representation of the MD Versioning event passed in. - * Result string is palloc-ed in the current memory context. - */ -char * -mdver_event_str(mdver_event *ev) -{ - char *result = (char *) palloc(MDVER_EVENT_STR_LEN); -#ifdef MD_VERSIONING_INSTRUMENTATION - snprintf(result, MDVER_EVENT_STR_LEN, "[MDVER_EVENT PID=%d OID=%d DDV= " UINT64_FORMAT " --> " UINT64_FORMAT " DMV= " UINT64_FORMAT " --> " UINT64_FORMAT "]", - ev->backend_pid, - ev->key, - ev->old_ddl_version, ev->new_ddl_version, - ev->old_dml_version, ev->new_dml_version); -#else - snprintf(result, MDVER_EVENT_STR_LEN, "[MDVER_EVENT OID=%d DDV= " UINT64_FORMAT " --> " UINT64_FORMAT " DMV= " UINT64_FORMAT " --> " UINT64_FORMAT "]", - ev->key, - ev->old_ddl_version, ev->new_ddl_version, - ev->old_dml_version, ev->new_dml_version); -#endif - - return result; -} - -/* - * Main entry point for clients that request versions for objects. Returns - * the most recent visible version of an object when requested by a - * backend/client. - * - * If no version is found, a new version for the object is generated and - * recorded in the caches. New versioning events are potentially generated - * as well if needed. - * - * This function never returns INVALID_MD_VERSION as a result. - * - * key: The key of the looked-up object - * ddl_version: used to return the ddl version for the object - * dml_version: used to return the dml version for the object - * - */ -void -mdver_request_version(Oid key, uint64 *ddl_version, uint64 *dml_version) -{ - - Assert(NULL != ddl_version); - Assert(NULL != dml_version); - - *dml_version = INVALID_MD_VERSION; - *ddl_version = INVALID_MD_VERSION; - - if (!mdver_enabled()) - { - /* - * MD Versioning feature is turned off. Return (1,0) as a fixed - * version so that ORCA can check for equality etc. - */ - *ddl_version = 1; - *dml_version = 0; - return; - } - - /* - * Basic flow is described below. More details can be found in - * the Metadata Versioning design document. - * - * - Do a look-up in the Local MDVSN. If the object is found there, - * return its version. - * - If not found in Local MDVSN, and nuke_happened is not set, - * do a look-up in the Global MDVSN. - * - If the object is found there, - * - Add it to the Local MDVSN and - * - Return its version. - * - If the object is not in Global MDVSN - * - Generate a new version for the object - * - Record the version in Global MDVSN - * - Add new version to Local MDVSN - * - Return new version - * - If not found in Local MDVSN and nuke_happened is set, the object - * needs a new version. - * - Generate a new version for the object - * - Read current version from Global MDVSN (if exists) - * - Add a versioning event to the CVQ with the new version - * - Record the new version in the Local MDVSN - * - Return the new version. - */ - - /* Try Local MDVSN first */ - mdver_local_mdvsn *local_mdvsn = GetCurrentLocalMDVSN(); - Assert(NULL != local_mdvsn); - - mdver_entry *crt_entry = mdver_local_mdvsn_find(local_mdvsn, key); - if (NULL != crt_entry) - { - -#ifdef MD_VERSIONING_INSTRUMENTATION - elog(gp_mdversioning_loglevel, "Found version in Local MDVSN: (%d, " UINT64_FORMAT ", " UINT64_FORMAT ")", - key, crt_entry->ddl_version, crt_entry->dml_version); -#endif - - *ddl_version = crt_entry->ddl_version; - *dml_version = crt_entry->dml_version; - return; - } - - if (!local_mdvsn->nuke_happened) - { - /* TODO gcaragea 6/3/2014: Traverse subtransaction contexts during look-up (MPP-22935) */ - mdver_request_from_global(key, ddl_version, dml_version); - - } - else - { - mdver_request_after_nuke(key, ddl_version, dml_version); - } - - Assert(INVALID_MD_VERSION != *ddl_version || - INVALID_MD_VERSION != *dml_version); - - mdver_entry new_entry = { key, *ddl_version, *dml_version}; - mdver_local_mdvsn_add(local_mdvsn, &new_entry, true /* local */); - -} - -/* - * When a backend is requesting the more recent version of an object, - * if the Local MDVSN cache doesn't have the version, and if a NUKE event - * hasn't been encountered in the current transaction, it is looked up - * in the Global MDVSN shared cache. - * - * If the object is found in Global MDVSN, return the global version. - * If the object is not found, generate a new version, record it in Global MDVSN - * and then return it. - * - * key: The key of the looked-up object - * ddl_version: used to return the ddl version for the object - * dml_version: used to return the dml version for the object - * - */ -static void -mdver_request_from_global(Oid key, uint64 *ddl_version, uint64 *dml_version) -{ - - Assert(NULL != ddl_version); - Assert(NULL != dml_version); - - Cache *mdver_glob_mdvsn = mdver_get_glob_mdvsn(); - Assert(NULL != mdver_glob_mdvsn); - - mdver_entry entry = {key, INVALID_MD_VERSION, INVALID_MD_VERSION}; - - /* FIXME gcaragea 06/03/2014: Trigger evictions if cache is full (MPP-22923) */ - CacheEntry *localEntry = Cache_AcquireEntry(mdver_glob_mdvsn, &entry); - - Assert(NULL != localEntry); - - /* - * We're about to look-up and insert a shared cache entry. - * Grab writer lock in exclusive mode, so that no other backend - * can insert or update the same entry at the same time. - */ - LWLockAcquire(MDVerWriteLock, LW_EXCLUSIVE); - - CacheEntry *cachedEntry = Cache_Lookup(mdver_glob_mdvsn, localEntry); - - if (NULL != cachedEntry) - { - /* Not found in LVSN, not nuke happened, eventually found in GVSN */ - mdver_entry *crt_entry = CACHE_ENTRY_PAYLOAD(cachedEntry); - - *ddl_version = crt_entry->ddl_version; - *dml_version = crt_entry->dml_version; - -#ifdef MD_VERSIONING_INSTRUMENTATION - elog(gp_mdversioning_loglevel, "Found version in Global MDVSN: (%d, " UINT64_FORMAT ", " UINT64_FORMAT "). Adding it to Local MDVSN", - key, crt_entry->ddl_version, crt_entry->dml_version); -#endif - - /* - * We're also done with the entry, release our pincount on it - * - * TODO gcaragea 05/02/2014: Are there cases where we need to hold the - * entry past this point? (MPP-22923) - */ - - Cache_Release(mdver_glob_mdvsn, cachedEntry); - } - else - { - /* Not found in LVSN, not nuke happened, not found in GVSN either */ - - /* Generate new version */ - *ddl_version = mdver_next_global_version(); - *dml_version = mdver_next_global_version(); - - /* Add to GVSN */ - mdver_entry *new_entry = CACHE_ENTRY_PAYLOAD(localEntry); - new_entry->ddl_version = *ddl_version; - new_entry->dml_version = *dml_version; - -#ifdef MD_VERSIONING_INSTRUMENTATION - elog(gp_mdversioning_loglevel, "Inserting new version in Global MDVSN: (%d, " UINT64_FORMAT ", " UINT64_FORMAT "). Adding it to Local MDVSN", - key, new_entry->ddl_version, new_entry->dml_version); -#endif - - Cache_Insert(mdver_glob_mdvsn, localEntry); - - } - - LWLockRelease(MDVerWriteLock); - - /* Release local entry. We don't need it anymore */ - Cache_Release(mdver_glob_mdvsn, localEntry); -} - -/* - * When a backend is requesting the more recent version of an object, - * if the Local MDVSN cache doesn't have the version, and if a NUKE event - * has been encountered in the current transaction, a new version is - * generated and returned for the object. A new versioning event is also - * produced. - * - * key: The key of the looked-up object - * ddl_version: used to return the ddl version for the object - * dml_version: used to return the dml version for the object - * - */ -static void -mdver_request_after_nuke(Oid key, uint64 *ddl_version, uint64 *dml_version) -{ - Assert(NULL != ddl_version); - Assert(NULL != dml_version); - - /* Generate new version */ - *ddl_version = mdver_next_global_version(); - *dml_version = mdver_next_global_version(); - - mdver_event *new_event = (mdver_event *) palloc0(sizeof(mdver_event)); - new_event->key = key; - new_event->new_ddl_version = *ddl_version; - new_event->new_dml_version = *dml_version; - new_event->old_ddl_version = INVALID_MD_VERSION; - new_event->old_dml_version = INVALID_MD_VERSION; - -#ifdef MD_VERSIONING_INSTRUMENTATION - /* Add my current process id as the originating backend pid */ - new_event->backend_pid = MyProcPid; -#endif - - /* Annotate Versioning Event with the current version from Global MDVSN if exists */ - mdver_entry *crt_entry = mdver_glob_mdvsn_find(key); - if (NULL != crt_entry) - { - new_event->old_ddl_version = crt_entry->ddl_version; - new_event->old_dml_version = crt_entry->dml_version; - } - - CacheAddVersioningEvent(new_event); - -#ifdef MD_VERSIONING_INSTRUMENTATION - char *mdev_str = mdver_event_str(new_event); - ereport(gp_mdversioning_loglevel, - (errmsg("mdver_consume_after_nuke: generated new VE %s", - mdev_str), - errprintstack(false))); - pfree(mdev_str); -#endif - - /* A copy of the event is added to the queue above. We can pfree our local copy */ - pfree(new_event); -} - - -/* - * Retrieves the next unique version using the Global Version Counter (GVC) - */ -uint64 -mdver_next_global_version() -{ - return gp_atomic_add_uint64(mdver_global_version_counter, 1); -} - -/* - * Returns true if Metadata Versioning is enabled in the current - * context - */ -bool -mdver_enabled(void) -{ - /* - * We only initialized Metadata Versioning on the master, - * and only for QD or utility mode process. - * MD Versioning can also be disabled by the guc gp_metadata_versioning. - */ - - /* TODO gcaragea 05/06/2014: Do we need to disable MD Versioning during (auto)vacuum? (MPP-23504) */ - - return gp_metadata_versioning && - AmIMaster() && - ((GP_ROLE_DISPATCH == Gp_role) || (GP_ROLE_UTILITY == Gp_role)); -} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/backend/utils/mdver/test/.gitignore ---------------------------------------------------------------------- diff --git a/src/backend/utils/mdver/test/.gitignore b/src/backend/utils/mdver/test/.gitignore deleted file mode 100644 index a8d6b6c..0000000 --- a/src/backend/utils/mdver/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.t http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/backend/utils/mdver/test/mdver_dep_translator_test.c ---------------------------------------------------------------------- diff --git a/src/backend/utils/mdver/test/mdver_dep_translator_test.c b/src/backend/utils/mdver/test/mdver_dep_translator_test.c deleted file mode 100644 index da94176..0000000 --- a/src/backend/utils/mdver/test/mdver_dep_translator_test.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include <stdarg.h> -#include <stddef.h> -#include <setjmp.h> -#include "cmockery.h" - -#include "c.h" -#include "postgres.h" - -#include "../mdver_dep_translator.c" - - -/* ==================== mdver_add_nuke_event ==================== */ -/* - * Tests that mdver_add_nuke_event doesn't do anything when passed - * a NIL event list - */ -void test__mdver_add_nuke_event_nil(void **state) -{ - List *events = NIL; - mdver_add_nuke_event(&events); -} - -/* - * Tests that mdver_add_nuke_event adds an event when the last - * event is not nuke - */ -void test__mdver_add_nuke_event_no_nuke(void **state) -{ - - /* Create an empty list of events */ - List *events = NIL; - - /* Let's create some non-nuke event and add it to the list */ - mdver_event *mdev = (mdver_event *) palloc0(sizeof(mdver_event)); - mdev->key = 100; - mdev->new_ddl_version = 1; - mdev->new_dml_version = 2; - events = lappend(events, mdev); - - /* Now add a nuke event */ - mdver_add_nuke_event(&events); - - /* Adding the nuke increased the length, it should be 2 */ - assert_int_equal(2 /* length */, length(events)); - -} - -/* - * Tests that mdver_add_nuke_event adds an event when the last - * event is not nuke - */ -void test__mdver_add_nuke_event_after_nuke(void **state) -{ - /* Create an empty list of events */ - List *events = NIL; - - /* Let's create some non-nuke event and add it to the list */ - mdver_event *mdev = (mdver_event *) palloc0(sizeof(mdver_event)); - mdev->key = 100; - mdev->new_ddl_version = 1; - mdev->new_dml_version = 2; - events = lappend(events, mdev); - - /* Create a nuke event and add it to the list */ - mdev = (mdver_event *) palloc0(sizeof(mdver_event)); - mdev->key = MDVER_NUKE_KEY; - events = lappend(events, mdev); - - /* Now add a nuke event */ - mdver_add_nuke_event(&events); - - /* Adding the nuke shouldn't have changed the length - it's still 2 */ - assert_int_equal(2 /* length */, length(events)); -} - -int -main(int argc, char* argv[]) { - cmockery_parse_arguments(argc, argv); - - const UnitTest tests[] = { - unit_test(test__mdver_add_nuke_event_nil), - unit_test(test__mdver_add_nuke_event_no_nuke), - unit_test(test__mdver_add_nuke_event_after_nuke) - }; - return run_tests(tests); -} - - http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/backend/utils/misc/guc.c ---------------------------------------------------------------------- diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index a33da0c..0ba26dc 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -520,7 +520,6 @@ static char *log_min_error_statement_str; static char *log_destination_string; static char *gp_log_format_string; static char *gp_workfile_caching_loglevel_str; -static char *gp_mdversioning_loglevel_str; static char *gp_sessionstate_loglevel_str; static char *explain_memory_verbosity_str; @@ -1166,16 +1165,6 @@ static struct config_bool ConfigureNamesBool[] = false, NULL, NULL }, { - {"gp_metadata_versioning", PGC_SUSET, QUERY_TUNING_OTHER, - gettext_noop("Enable metadata versioning"), - gettext_noop("When enabled, catalog objects are versioned" - "and their version is changed only when updated"), - GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE - }, - &gp_metadata_versioning, - false, &assign_gp_metadata_versioning, NULL - }, - { {"force_bitmap_table_scan", PGC_USERSET, DEVELOPER_OPTIONS, gettext_noop("Forces bitmap table scan instead of bitmap heap/ao/aoco scan."), NULL, @@ -3490,7 +3479,7 @@ static struct config_bool ConfigureNamesBool[] = GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE }, &optimizer_release_mdcache, - true, &assign_optimizer_release_mdcache, NULL + true, NULL, NULL }, { @@ -7169,19 +7158,6 @@ static struct config_string ConfigureNamesString[] = }, { - {"gp_mdversioning_loglevel", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Sets the logging level for metadata versioning debugging messages"), - gettext_noop("Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, " - "DEBUG1, LOG, NOTICE, WARNING, and ERROR. Each level includes all the " - "levels that follow it. The later the level, the fewer messages are " - "sent."), - GUC_GPDB_ADDOPT | GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE - }, - &gp_mdversioning_loglevel_str, - "debug1", assign_gp_mdversioning_loglevel, NULL - }, - - { {"gp_sessionstate_loglevel", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Sets the logging level for session state debugging messages"), gettext_noop("Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, " @@ -12642,13 +12618,6 @@ assign_client_min_messages(const char *newval, bool doit, GucSource source) } static const char * -assign_gp_mdversioning_loglevel(const char *newval, - bool doit, GucSource source) -{ - return (assign_msglvl(&gp_mdversioning_loglevel, newval, doit, source)); -} - -static const char * assign_gp_sessionstate_loglevel(const char *newval, bool doit, GucSource source) { @@ -13257,52 +13226,6 @@ assign_transaction_read_only(bool newval, bool doit, GucSource source) } -/* - * 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) { http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/cdb/cdbvars.h ---------------------------------------------------------------------- diff --git a/src/include/cdb/cdbvars.h b/src/include/cdb/cdbvars.h index bb59d76..123b972 100644 --- a/src/include/cdb/cdbvars.h +++ b/src/include/cdb/cdbvars.h @@ -972,7 +972,6 @@ extern int gp_hashagg_compress_spill_files; extern int gp_workfile_compress_algorithm; extern bool gp_workfile_checksumming; extern bool gp_workfile_caching; -extern bool gp_metadata_versioning; extern double gp_workfile_limit_per_segment; extern double gp_workfile_limit_per_query; extern int gp_workfile_limit_files_per_query; http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/gpopt/utils/gpdbdefs.h ---------------------------------------------------------------------- diff --git a/src/include/gpopt/utils/gpdbdefs.h b/src/include/gpopt/utils/gpdbdefs.h index e9af2b5..bd45930 100644 --- a/src/include/gpopt/utils/gpdbdefs.h +++ b/src/include/gpopt/utils/gpdbdefs.h @@ -82,7 +82,6 @@ extern "C" { #include "utils/selfuncs.h" #include "postmaster/identity.h" #include "utils/faultinjector.h" -#include "utils/mdver.h" extern Query *preprocess_query_optimizer(Query *pquery, ParamListInfo boundParams); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/pg_config.h.in ---------------------------------------------------------------------- diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index e58636e..90e1eca 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -707,10 +707,6 @@ /* Define as the maximum alignment requirement of any C data type. */ #undef MAXIMUM_ALIGNOF -/* Define to 1 to build with metadata versioning instrumentation. - (--enable-mdverinstrumentation) */ -#undef MD_VERSIONING_INSTRUMENTATION - /* Define bytes to use libc memset(). */ #undef MEMSET_LOOP_LIMIT http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/storage/sinval.h ---------------------------------------------------------------------- diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index 8420fb1..8b47227 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -16,8 +16,6 @@ #include "storage/itemptr.h" #include "storage/relfilenode.h" -#include "utils/mdver.h" - /* * We currently support three types of shared-invalidation messages: one that @@ -75,28 +73,12 @@ typedef struct RelFileNode rnode; /* physical file ID */ } SharedInvalSmgrMsg; -/* - * TODO gcaragea 03/26/2014: Investigate if there is any impact on performance - * or memory footprint from adding the versioning event to the - * SharedInvalidationMessage union (MPP-23070) - */ - -#define SHAREDVERSIONINGMSG_ID (-3) - -typedef struct -{ - int32 id; /* type field --- must be first */ - bool local; /* true for events that were generated locally */ - mdver_event verEvent; /* versioning event information */ -} SharedVersioningMsg; - typedef union { int32 id; /* type field --- must be first */ SharedInvalCatcacheMsg cc; SharedInvalRelcacheMsg rc; SharedInvalSmgrMsg sm; - SharedVersioningMsg ve; } SharedInvalidationMessage; @@ -110,10 +92,6 @@ extern void ReceiveSharedInvalidMessages( void (*invalFunction) (SharedInvalidationMessage *msg), void (*resetFunction) (void)); -extern void mdver_globalhandler_new_event(SharedInvalidationMessage *messages, int n); - -extern void mdver_localhandler_new_event(SharedInvalidationMessage *msg); - /* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */ extern void HandleCatchupInterrupt(void); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/utils/guc.h ---------------------------------------------------------------------- diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 302af05..befeaf6 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -277,7 +277,6 @@ extern bool gp_temporary_files_filespace_repair; extern bool gp_perfmon_print_packet_info; extern bool gp_plpgsql_clear_cache_always; extern bool gp_disable_catalog_access_on_segment; -extern int gp_mdversioning_loglevel; extern bool gp_called_by_pgdump; http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/utils/inval.h ---------------------------------------------------------------------- diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index 06f108b..5547ffe 100644 --- a/src/include/utils/inval.h +++ b/src/include/utils/inval.h @@ -16,7 +16,6 @@ #include "access/htup.h" #include "utils/rel.h" -#include "utils/mdver.h" typedef void (*CacheCallbackFunction) (Datum arg, Oid relid); @@ -57,8 +56,6 @@ extern void inval_twophase_postcommit(TransactionId xid, uint16 info, extern void ResetSystemCaches(void); -extern void CacheAddVersioningEvent(mdver_event *mdev); - /* Enum for system cache invalidation mode */ typedef enum SysCacheFlushForce { http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80803875/src/include/utils/mdver.h ---------------------------------------------------------------------- diff --git a/src/include/utils/mdver.h b/src/include/utils/mdver.h deleted file mode 100644 index 5114aae..0000000 --- a/src/include/utils/mdver.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*------------------------------------------------------------------------- - * - * mdver.h - * Interface for metadata versioning - * - * - *------------------------------------------------------------------------- - */ -#ifndef __MDVER_H__ -#define __MDVER_H__ - -#include "postgres.h" -#include "utils/relcache.h" -#include "utils/sharedcache.h" - -#define INVALID_MD_VERSION 0 - -/* We use Oid = InvalidOid to signal that it's a NUKE event */ -#define MDVER_NUKE_KEY InvalidOid - -typedef struct mdver_entry -{ - Oid key; /* Key of the versioned entry */ - uint64 ddl_version; /* The ddl version of the entry */ - uint64 dml_version; /* The dml version of the entry */ -} mdver_entry; - -typedef struct mdver_event -{ - Oid key; /* Key of the versioned entry */ -#ifdef MD_VERSIONING_INSTRUMENTATION - int backend_pid; /* The PID of the originating backend */ -#endif - uint64 old_ddl_version; /* The ddl version of the entry before this update */ - uint64 old_dml_version; /* The dml version of the entry before this update */ - uint64 new_ddl_version; /* The ddl version of the entry after this update */ - uint64 new_dml_version; /* The dml version of the entry after this update */ -} mdver_event; - -typedef struct mdver_local_mdvsn -{ - HTAB *htable; - bool nuke_happened; -} mdver_local_mdvsn; - -/* Pointer to the shared memory global version counter (GVC) */ -extern uint64 *mdver_global_version_counter; - -/* MD Versioning shared memory initialization */ -void mdver_shmem_init(void); -Size mdver_shmem_size(void); - -/* MD Versioning Global MDVSN operations */ -Cache *mdver_get_glob_mdvsn(void); -mdver_entry *mdver_glob_mdvsn_find(Oid oid); -void mdver_glob_mdvsn_nuke(void); - -/* MD Versioning Local MDVSN operations */ -void mdver_init_session_mdvsn(void); -mdver_local_mdvsn *mdver_create_local_mdvsn(int nesting_level); -void mdver_destroy_local_mdvsn(mdver_local_mdvsn *local_mdvsn, int nesting_level); -mdver_entry *mdver_local_mdvsn_find(mdver_local_mdvsn *local_mdvsn, Oid key); -void mdver_local_mdvsn_add(mdver_local_mdvsn *local_mdvsn, mdver_entry *entry, bool local); -void mdver_local_mdvsn_nuke(mdver_local_mdvsn *local_mdvsn); - -/* MD Versioning Dependency Translator operations */ -void mdver_dt_catcache_inval(Relation relation, HeapTuple tuple, SysCacheInvalidateAction action); -bool mdver_is_nuke_event(const mdver_event *event); - -/* MD Version operations */ -uint64 mdver_next_global_version(void); -void mdver_request_version(Oid key, uint64 *ddl_version, uint64 *dml_version); -bool mdver_enabled(void); - -/* inval.c */ -extern mdver_local_mdvsn *GetCurrentLocalMDVSN(void); - -/* Debugging functions */ - -/* Maximum length for the string representation of a mdver_event */ -#define MDVER_EVENT_STR_LEN 256 -char *mdver_event_str(mdver_event *ev); - -#endif /* __MDVER_H__ */ - -/* EOF */
