hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [2/2] incubator-hawq git commit: HAWQ-621. Fixing tuple descriptor leak in split_rows during an ALTER TABLE SPLIT PARTITION.
Date Thu, 07 Apr 2016 02:56:00 GMT
HAWQ-621. Fixing tuple descriptor leak in split_rows during an ALTER TABLE SPLIT PARTITION.


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

Branch: refs/heads/master
Commit: 228f6e84a489157a220ad003ddb6742f66141cfe
Parents: e0c9658
Author: Foyzur Rahman <foyzur@gmail.com>
Authored: Mon Mar 21 18:11:13 2016 -0700
Committer: Ming LI <mli@pivotal.io>
Committed: Thu Apr 7 10:55:15 2016 +0800

----------------------------------------------------------------------
 src/backend/commands/tablecmds.c          | 17 +++++++++++++++++
 src/test/regress/expected/alter_table.out | 24 ++++++++++++++++++++++++
 src/test/regress/sql/alter_table.sql      | 22 ++++++++++++++++++++++
 3 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/228f6e84/src/backend/commands/tablecmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 4595f9a..c23f24d 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15601,6 +15601,23 @@ split_rows(Relation intoa, Relation intob, Relation temprel, List
*splits, int s
 	ExecDropSingleTupleTableSlot(rria->ri_partSlot);
 	ExecDropSingleTupleTableSlot(rrib->ri_partSlot);
 
+	/*
+	 * We may have created "cached" version of our target result tuple table slot
+	 * inside reconstructMatchingTupleSlot. Drop any such slots.
+	 */
+	if (NULL != rria->ri_resultSlot)
+	{
+		Assert(NULL != rria->ri_resultSlot->tts_tupleDescriptor);
+		ExecDropSingleTupleTableSlot(rria->ri_resultSlot);
+		rria->ri_resultSlot = NULL;
+	}
+	if (NULL != rrib->ri_resultSlot)
+	{
+		Assert(NULL != rrib->ri_resultSlot->tts_tupleDescriptor);
+		ExecDropSingleTupleTableSlot(rrib->ri_resultSlot);
+		rrib->ri_resultSlot = NULL;
+	}
+
 	if (rria->ri_partInsertMap)
 		pfree(rria->ri_partInsertMap);
 	if (rrib->ri_partInsertMap)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/228f6e84/src/test/regress/expected/alter_table.out
----------------------------------------------------------------------
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index b28026f..d22c127 100755
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -1968,3 +1968,27 @@ NOTICE:  drop cascades to constraint testbug_char5_1_prt_part201204_check
on app
 NOTICE:  drop cascades to append only columnar table mpp17582.testbug_char5_1_prt_part201203
 NOTICE:  drop cascades to constraint testbug_char5_1_prt_part201203_check on append only
columnar table mpp17582.testbug_char5_1_prt_part201203
 NOTICE:  drop cascades to table mpp17582.testbug_char5
+-- Test for tuple descriptor leak during row splitting
+DROP TABLE IF EXISTS split_tupdesc_leak;
+NOTICE:  table "split_tupdesc_leak" does not exist, skipping
+CREATE TABLE split_tupdesc_leak
+(
+   ym character varying(6) NOT NULL,
+   suid character varying(50) NOT NULL,
+   genre_ids character varying(20)[]
+) 
+WITH (APPENDONLY=true, ORIENTATION=row, COMPRESSTYPE=zlib, OIDS=FALSE)
+DISTRIBUTED BY (suid)
+PARTITION BY LIST(ym)
+(
+	DEFAULT PARTITION p_split_tupdesc_leak_ym  WITH (appendonly=true, orientation=row, compresstype=zlib)
+);
+NOTICE:  CREATE TABLE will create partition "split_tupdesc_leak_1_prt_p_split_tupdesc_leak_ym"
for table "split_tupdesc_leak"
+INSERT INTO split_tupdesc_leak VALUES ('201412','0001EC1TPEvT5SaJKIR5yYXlFQ7tS','{0}');
+ALTER TABLE split_tupdesc_leak SPLIT DEFAULT PARTITION AT ('201412')
+	INTO (PARTITION p_split_tupdesc_leak_ym, PARTITION p_split_tupdesc_leak_ym_201412);
+NOTICE:  exchanged partition "p_split_tupdesc_leak_ym" of relation "split_tupdesc_leak" with
relation "pg_temp_323542"
+NOTICE:  dropped partition "p_split_tupdesc_leak_ym" for relation "split_tupdesc_leak"
+NOTICE:  CREATE TABLE will create partition "split_tupdesc_leak_1_prt_p_split_tupdesc_leak_ym_201412"
for table "split_tupdesc_leak"
+NOTICE:  CREATE TABLE will create partition "split_tupdesc_leak_1_prt_p_split_tupdesc_leak_ym"
for table "split_tupdesc_leak"
+DROP TABLE split_tupdesc_leak;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/228f6e84/src/test/regress/sql/alter_table.sql
----------------------------------------------------------------------
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql
index 099cab9..c60a298 100644
--- a/src/test/regress/sql/alter_table.sql
+++ b/src/test/regress/sql/alter_table.sql
@@ -1336,3 +1336,25 @@ select * from testbug_char5;
 
 set search_path=public;
 drop schema if exists mpp17582 cascade;
+
+-- Test for tuple descriptor leak during row splitting
+DROP TABLE IF EXISTS split_tupdesc_leak;
+CREATE TABLE split_tupdesc_leak
+(
+   ym character varying(6) NOT NULL,
+   suid character varying(50) NOT NULL,
+   genre_ids character varying(20)[]
+) 
+WITH (APPENDONLY=true, ORIENTATION=row, COMPRESSTYPE=zlib, OIDS=FALSE)
+DISTRIBUTED BY (suid)
+PARTITION BY LIST(ym)
+(
+	DEFAULT PARTITION p_split_tupdesc_leak_ym  WITH (appendonly=true, orientation=row, compresstype=zlib)
+);
+
+INSERT INTO split_tupdesc_leak VALUES ('201412','0001EC1TPEvT5SaJKIR5yYXlFQ7tS','{0}');
+
+ALTER TABLE split_tupdesc_leak SPLIT DEFAULT PARTITION AT ('201412')
+	INTO (PARTITION p_split_tupdesc_leak_ym, PARTITION p_split_tupdesc_leak_ym_201412);
+
+DROP TABLE split_tupdesc_leak;


Mime
View raw message