You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by iw...@apache.org on 2016/01/04 05:23:54 UTC
[1/3] incubator-hawq git commit: HAWQ-284. Add a udf for new metadata
flush strategy testing.
Repository: incubator-hawq
Updated Branches:
refs/heads/master af6cfe880 -> fde3b4fc9
HAWQ-284. Add a udf for new metadata flush strategy testing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/56159c32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/56159c32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/56159c32
Branch: refs/heads/master
Commit: 56159c324a0549d476cd5280d4626aff18440c7e
Parents: 2ba5a19
Author: stanlyxiang <st...@gmail.com>
Authored: Wed Dec 30 16:58:04 2015 +0800
Committer: stanlyxiang <st...@gmail.com>
Committed: Wed Dec 30 16:58:04 2015 +0800
----------------------------------------------------------------------
src/backend/cdb/cdbmetadatacache.c | 53 +++++++++++++++++++++++
src/include/catalog/pg_proc.h | 4 ++
src/include/catalog/pg_proc.sql | 2 +
src/include/utils/builtins.h | 1 +
src/test/regress/data/upgrade20/pg_proc.data | 1 +
5 files changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/56159c32/src/backend/cdb/cdbmetadatacache.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbmetadatacache.c b/src/backend/cdb/cdbmetadatacache.c
index f4c2369..fedcfbd 100644
--- a/src/backend/cdb/cdbmetadatacache.c
+++ b/src/backend/cdb/cdbmetadatacache.c
@@ -1400,3 +1400,56 @@ extern Datum gp_metadata_cache_info(PG_FUNCTION_ARGS)
PG_RETURN_TEXT_P(cstring_to_text(message));
}
+/*
+ * Metadata Cache UDF
+ *
+ * Get entry info in the metadata cache
+ */
+extern Datum gp_metadata_cache_putentry_fortest(PG_FUNCTION_ARGS)
+{
+ Oid tablespace_oid = PG_GETARG_OID(0);
+ Oid database_oid = PG_GETARG_OID(1);
+ Oid relation_oid = PG_GETARG_OID(2);
+ int4 start = PG_GETARG_INT32(3);
+ int4 end = PG_GETARG_INT32(4);
+
+ LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
+
+ int i;
+ int4 stop = (start -end) / 10;
+ int4 current = 0;
+ int4 success = 0;
+ for(i=start;i<end;i++)
+ {
+ MetadataCacheKey key;
+ key.tablespace_oid = tablespace_oid;
+ key.database_oid = database_oid;
+ key.relation_oid = relation_oid;
+ key.segno = i;
+
+ bool found;
+ MetadataCacheEntry *entry = (MetadataCacheEntry *)hash_search(MetadataCache, (void *)&key, HASH_ENTER_NULL, &found);
+ entry->file_size = 134217728;
+ entry->block_num = 1;
+
+ AllocMetadataBlock(entry->block_num, &entry->first_block_id, &entry->last_block_id);
+
+ if(entry != NULL)
+ {
+ current++;
+ success++;
+ }
+ if(current == stop)
+ {
+ current = 0;
+ LWLockRelease(MetadataCacheLock);
+ pg_usleep(1 * USECS_PER_SEC);
+ LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
+ }
+ }
+ LWLockRelease(MetadataCacheLock);
+
+ char message[1024] = {0};
+ snprintf(message, 1024, "Metadata cache successed putting %d entries. Failed putting %d entries.", success, end - start - success);
+ PG_RETURN_TEXT_P(cstring_to_text(message));
+}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/56159c32/src/include/catalog/pg_proc.h
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 64b7661..2170041 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -10399,6 +10399,10 @@ DESCR("Get metadata cache current entry number");
DATA(insert OID = 8084 ( gp_metadata_cache_current_block_num PGNSP PGUID 12 f f t f s 0 20 f "" _null_ _null_ _null_ gp_metadata_cache_current_block_num - _null_ n ));
DESCR("Get metadata cache current block number");
+/* gp_metadata_cache_putentry_fortest => text */
+DATA(insert OID = 8085 ( gp_metadata_cache_putentry_fortest PGNSP PGUID 12 f f t f s 5 25 f "26 26 26 23 23" _null_ _null_ _null_ gp_metadata_cache_putentry_fortest - _null_ n ));
+DESCR("Put entries into metadata cache");
+
/* gp_metadata_cache_exists => bool*/
DATA(insert OID = 8082 ( gp_metadata_cache_exists PGNSP PGUID 12 f f t f s 4 16 f "26 26 26 23" _null_ _null_ _null_ gp_metadata_cache_exists - _null_ n ));
DESCR("Check whether metadata cache key exists");
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/56159c32/src/include/catalog/pg_proc.sql
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_proc.sql b/src/include/catalog/pg_proc.sql
index d0fa636..dc871a8 100644
--- a/src/include/catalog/pg_proc.sql
+++ b/src/include/catalog/pg_proc.sql
@@ -5512,4 +5512,6 @@
CREATE FUNCTION gp_metadata_cache_info(tablespace_oid, database_oid, relation_oid, segno) RETURNS text LANGUAGE internal STABLE STRICT AS 'gp_metadata_cache_info' WITH (OID=8083, DESCRIPTION="Get metadata cache info for specific key");
+ CREATE FUNCTION gp_metadata_cache_putentry_fortest(tablespace_oid, database_oid, relation_oid, segno) RETURNS text LANGUAGE internal STABLE STRICT AS 'gp_metadata_cache_putentry_fortest' WITH (OID=8085, DESCRIPTION="Put entries into metadata cache for test");
+
CREATE FUNCTION dump_resource_manager_status(info_type) RETURNS text LANGUAGE internal STABLE STRICT AS 'dump_resource_manager_status' WITH (OID=6450, DESCRIPTION="Dump resource manager status for testing");
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/56159c32/src/include/utils/builtins.h
----------------------------------------------------------------------
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 75742d3..e9f60cd 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -1200,5 +1200,6 @@ extern Datum gp_metadata_cache_current_num(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_current_block_num(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_exists(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_info(PG_FUNCTION_ARGS);
+extern Datum gp_metadata_cache_putentry_fortest(PG_FUNCTION_ARGS);
#endif /* BUILTINS_H */
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/56159c32/src/test/regress/data/upgrade20/pg_proc.data
----------------------------------------------------------------------
diff --git a/src/test/regress/data/upgrade20/pg_proc.data b/src/test/regress/data/upgrade20/pg_proc.data
index c39642c..2a19a7d 100644
--- a/src/test/regress/data/upgrade20/pg_proc.data
+++ b/src/test/regress/data/upgrade20/pg_proc.data
@@ -7,3 +7,4 @@
8082,gp_metadata_cache_exists,11,10,12,f,f,t,f,s,4,16,f,"26 26 26 23",,,,gp_metadata_cache_exists,-,,n
8083,gp_metadata_cache_info,11,10,12,f,f,t,f,s,4,25,f,"26 26 26 23",,,,gp_metadata_cache_info,-,,n
8084,gp_metadata_cache_current_block_num,11,10,12,f,f,t,f,s,0,20,f,"",,,,gp_metadata_cache_current_block_num,-,,n
+8085,gp_metadata_cache_putentry_fortest,11,10,12,f,f,t,f,s,5,25,f,"26 26 26 23 23",,,,gp_metadata_cache_putentry_fortest,-,,n
[3/3] incubator-hawq git commit: HAWQ-284. Add a udf for new metadata
flush strategy testing.
Posted by iw...@apache.org.
HAWQ-284. Add a udf for new metadata flush strategy testing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/fde3b4fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/fde3b4fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/fde3b4fc
Branch: refs/heads/master
Commit: fde3b4fc9d802929aa840ae6f35a9e9154db1db2
Parents: af6cfe8 04c3938
Author: ivan <iw...@pivotal.io>
Authored: Mon Jan 4 12:23:29 2016 +0800
Committer: ivan <iw...@pivotal.io>
Committed: Mon Jan 4 12:23:29 2016 +0800
----------------------------------------------------------------------
src/backend/cdb/cdbmetadatacache.c | 53 +++++++++++++++++++++++
src/include/catalog/pg_proc.h | 4 ++
src/include/catalog/pg_proc.sql | 2 +
src/include/utils/builtins.h | 1 +
src/test/regress/data/upgrade20/pg_proc.data | 1 +
5 files changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fde3b4fc/src/backend/cdb/cdbmetadatacache.c
----------------------------------------------------------------------
[2/3] incubator-hawq git commit: HAWQ-284. Add a udf for new metadata
flush strategy testing: change udf name to a clear one.
Posted by iw...@apache.org.
HAWQ-284. Add a udf for new metadata flush strategy testing: change udf name to a clear one.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/04c39387
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/04c39387
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/04c39387
Branch: refs/heads/master
Commit: 04c393873b011393912a7cd4134e234f18310636
Parents: 56159c3
Author: stanlyxiang <st...@gmail.com>
Authored: Wed Dec 30 17:27:14 2015 +0800
Committer: stanlyxiang <st...@gmail.com>
Committed: Wed Dec 30 17:27:14 2015 +0800
----------------------------------------------------------------------
src/backend/cdb/cdbmetadatacache.c | 4 ++--
src/include/catalog/pg_proc.h | 4 ++--
src/include/catalog/pg_proc.sql | 2 +-
src/include/utils/builtins.h | 2 +-
src/test/regress/data/upgrade20/pg_proc.data | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04c39387/src/backend/cdb/cdbmetadatacache.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbmetadatacache.c b/src/backend/cdb/cdbmetadatacache.c
index fedcfbd..0a163b3 100644
--- a/src/backend/cdb/cdbmetadatacache.c
+++ b/src/backend/cdb/cdbmetadatacache.c
@@ -1403,9 +1403,9 @@ extern Datum gp_metadata_cache_info(PG_FUNCTION_ARGS)
/*
* Metadata Cache UDF
*
- * Get entry info in the metadata cache
+ * Put entry into the metadata cache
*/
-extern Datum gp_metadata_cache_putentry_fortest(PG_FUNCTION_ARGS)
+extern Datum gp_metadata_cache_put_entry_for_test(PG_FUNCTION_ARGS)
{
Oid tablespace_oid = PG_GETARG_OID(0);
Oid database_oid = PG_GETARG_OID(1);
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04c39387/src/include/catalog/pg_proc.h
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 2170041..c22f3f3 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -10399,8 +10399,8 @@ DESCR("Get metadata cache current entry number");
DATA(insert OID = 8084 ( gp_metadata_cache_current_block_num PGNSP PGUID 12 f f t f s 0 20 f "" _null_ _null_ _null_ gp_metadata_cache_current_block_num - _null_ n ));
DESCR("Get metadata cache current block number");
-/* gp_metadata_cache_putentry_fortest => text */
-DATA(insert OID = 8085 ( gp_metadata_cache_putentry_fortest PGNSP PGUID 12 f f t f s 5 25 f "26 26 26 23 23" _null_ _null_ _null_ gp_metadata_cache_putentry_fortest - _null_ n ));
+/* gp_metadata_cache_put_entry_for_test => text */
+DATA(insert OID = 8085 ( gp_metadata_cache_put_entry_for_test PGNSP PGUID 12 f f t f s 5 25 f "26 26 26 23 23" _null_ _null_ _null_ gp_metadata_cache_put_entry_for_test - _null_ n ));
DESCR("Put entries into metadata cache");
/* gp_metadata_cache_exists => bool*/
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04c39387/src/include/catalog/pg_proc.sql
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_proc.sql b/src/include/catalog/pg_proc.sql
index dc871a8..df3fca8 100644
--- a/src/include/catalog/pg_proc.sql
+++ b/src/include/catalog/pg_proc.sql
@@ -5512,6 +5512,6 @@
CREATE FUNCTION gp_metadata_cache_info(tablespace_oid, database_oid, relation_oid, segno) RETURNS text LANGUAGE internal STABLE STRICT AS 'gp_metadata_cache_info' WITH (OID=8083, DESCRIPTION="Get metadata cache info for specific key");
- CREATE FUNCTION gp_metadata_cache_putentry_fortest(tablespace_oid, database_oid, relation_oid, segno) RETURNS text LANGUAGE internal STABLE STRICT AS 'gp_metadata_cache_putentry_fortest' WITH (OID=8085, DESCRIPTION="Put entries into metadata cache for test");
+ CREATE FUNCTION gp_metadata_cache_put_entry_for_test(tablespace_oid, database_oid, relation_oid, segno) RETURNS text LANGUAGE internal STABLE STRICT AS 'gp_metadata_cache_put_entry_for_test' WITH (OID=8085, DESCRIPTION="Put entries into metadata cache for test");
CREATE FUNCTION dump_resource_manager_status(info_type) RETURNS text LANGUAGE internal STABLE STRICT AS 'dump_resource_manager_status' WITH (OID=6450, DESCRIPTION="Dump resource manager status for testing");
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04c39387/src/include/utils/builtins.h
----------------------------------------------------------------------
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index e9f60cd..7c18f27 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -1200,6 +1200,6 @@ extern Datum gp_metadata_cache_current_num(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_current_block_num(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_exists(PG_FUNCTION_ARGS);
extern Datum gp_metadata_cache_info(PG_FUNCTION_ARGS);
-extern Datum gp_metadata_cache_putentry_fortest(PG_FUNCTION_ARGS);
+extern Datum gp_metadata_cache_put_entry_for_test(PG_FUNCTION_ARGS);
#endif /* BUILTINS_H */
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04c39387/src/test/regress/data/upgrade20/pg_proc.data
----------------------------------------------------------------------
diff --git a/src/test/regress/data/upgrade20/pg_proc.data b/src/test/regress/data/upgrade20/pg_proc.data
index 2a19a7d..4b12c93 100644
--- a/src/test/regress/data/upgrade20/pg_proc.data
+++ b/src/test/regress/data/upgrade20/pg_proc.data
@@ -7,4 +7,4 @@
8082,gp_metadata_cache_exists,11,10,12,f,f,t,f,s,4,16,f,"26 26 26 23",,,,gp_metadata_cache_exists,-,,n
8083,gp_metadata_cache_info,11,10,12,f,f,t,f,s,4,25,f,"26 26 26 23",,,,gp_metadata_cache_info,-,,n
8084,gp_metadata_cache_current_block_num,11,10,12,f,f,t,f,s,0,20,f,"",,,,gp_metadata_cache_current_block_num,-,,n
-8085,gp_metadata_cache_putentry_fortest,11,10,12,f,f,t,f,s,5,25,f,"26 26 26 23 23",,,,gp_metadata_cache_putentry_fortest,-,,n
+8085,gp_metadata_cache_put_entry_for_test,11,10,12,f,f,t,f,s,5,25,f,"26 26 26 23 23",,,,gp_metadata_cache_put_entry_for_test,-,,n