Accept some of the differences in 'tidscan' test case
authorPavan Deolasee <[email protected]>
Wed, 26 Jul 2017 07:26:00 +0000 (12:56 +0530)
committerPavan Deolasee <[email protected]>
Wed, 26 Jul 2017 07:26:00 +0000 (12:56 +0530)
Most of these differences arise from the the fact that rows are fetched from
multiple datanodes in XL and hence TIDs can be duplicated. There are some other
differences because of EXPLAIN output.

The test case does not yet pass because of other unaddressed failures.

src/test/regress/expected/tidscan.out
src/test/regress/sql/tidscan.sql

index 521ed1b2f99862e97724c9231c67425b54bcf1cb..bd1fae084a09820d07fa6ed6919964b1094bfb2a 100644 (file)
@@ -3,94 +3,108 @@ CREATE TABLE tidscan(id integer);
 -- only insert a few rows, we don't want to spill onto a second table page
 INSERT INTO tidscan VALUES (1), (2), (3);
 -- show ctids
+-- XXX since rows come from different datanodes, some TIDs can be duplicated in
+-- XL
 SELECT ctid, * FROM tidscan;
  ctid  | id 
 -------+----
  (0,1) |  1
  (0,2) |  2
- (0,3) |  3
+ (0,1) |  3
 (3 rows)
 
 -- ctid equality - implemented as tidscan
 EXPLAIN (COSTS OFF)
 SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)';
-            QUERY PLAN             
------------------------------------
- Tid Scan on tidscan
-   TID Cond: (ctid = '(0,1)'::tid)
-(2 rows)
+               QUERY PLAN                
+-----------------------------------------
+ Remote Fast Query Execution
+   Node/s: datanode_1, datanode_2
+   ->  Tid Scan on tidscan
+         TID Cond: (ctid = '(0,1)'::tid)
+(4 rows)
 
 SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)';
  ctid  | id 
 -------+----
  (0,1) |  1
-(1 row)
+ (0,1) |  3
+(2 rows)
 
 EXPLAIN (COSTS OFF)
 SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid;
-            QUERY PLAN             
------------------------------------
- Tid Scan on tidscan
-   TID Cond: ('(0,1)'::tid = ctid)
-(2 rows)
+               QUERY PLAN                
+-----------------------------------------
+ Remote Fast Query Execution
+   Node/s: datanode_1, datanode_2
+   ->  Tid Scan on tidscan
+         TID Cond: ('(0,1)'::tid = ctid)
+(4 rows)
 
 SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid;
  ctid  | id 
 -------+----
  (0,1) |  1
-(1 row)
+ (0,1) |  3
+(2 rows)
 
 -- ctid = ScalarArrayOp - implemented as tidscan
 EXPLAIN (COSTS OFF)
 SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]);
-                      QUERY PLAN                       
--------------------------------------------------------
- Tid Scan on tidscan
-   TID Cond: (ctid = ANY ('{"(0,1)","(0,2)"}'::tid[]))
-(2 rows)
+                         QUERY PLAN                          
+-------------------------------------------------------------
+ Remote Fast Query Execution
+   Node/s: datanode_1, datanode_2
+   ->  Tid Scan on tidscan
+         TID Cond: (ctid = ANY ('{"(0,1)","(0,2)"}'::tid[]))
+(4 rows)
 
 SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]);
  ctid  | id 
 -------+----
  (0,1) |  1
  (0,2) |  2
-(2 rows)
+ (0,1) |  3
+(3 rows)
 
 -- ctid != ScalarArrayOp - can't be implemented as tidscan
 EXPLAIN (COSTS OFF)
 SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]);
-                      QUERY PLAN                      
-------------------------------------------------------
- Seq Scan on tidscan
-   Filter: (ctid <> ANY ('{"(0,1)","(0,2)"}'::tid[]))
-(2 rows)
+                         QUERY PLAN                         
+------------------------------------------------------------
+ Remote Fast Query Execution
+   Node/s: datanode_1, datanode_2
+   ->  Seq Scan on tidscan
+         Filter: (ctid <> ANY ('{"(0,1)","(0,2)"}'::tid[]))
+(4 rows)
 
 SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]);
  ctid  | id 
 -------+----
  (0,1) |  1
  (0,2) |  2
- (0,3) |  3
+ (0,1) |  3
 (3 rows)
 
 -- tid equality extracted from sub-AND clauses
 EXPLAIN (COSTS OFF)
 SELECT ctid, * FROM tidscan
 WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1);
-                                                  QUERY PLAN                                                  
---------------------------------------------------------------------------------------------------------------
- Tid Scan on tidscan
-   TID Cond: ((ctid = ANY ('{"(0,2)","(0,3)"}'::tid[])) OR (ctid = '(0,1)'::tid))
-   Filter: (((id = 3) AND (ctid = ANY ('{"(0,2)","(0,3)"}'::tid[]))) OR ((ctid = '(0,1)'::tid) AND (id = 1)))
-(3 rows)
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Remote Fast Query Execution
+   Node/s: datanode_1, datanode_2
+   ->  Tid Scan on tidscan
+         TID Cond: ((ctid = ANY ('{"(0,2)","(0,3)"}'::tid[])) OR (ctid = '(0,1)'::tid))
+         Filter: (((id = 3) AND (ctid = ANY ('{"(0,2)","(0,3)"}'::tid[]))) OR ((ctid = '(0,1)'::tid) AND (id = 1)))
+(5 rows)
 
 SELECT ctid, * FROM tidscan
 WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1);
  ctid  | id 
 -------+----
  (0,1) |  1
- (0,3) |  3
-(2 rows)
+(1 row)
 
 -- exercise backward scan and rewind
 BEGIN;
@@ -101,7 +115,8 @@ FETCH ALL FROM c;
 -------+----
  (0,1) |  1
  (0,2) |  2
-(2 rows)
+ (0,1) |  3
+(3 rows)
 
 FETCH BACKWARD 1 FROM c;
  ctid  | id 
index a8472e09acd1416f745f1c546afca1364b024fd0..c9d632e49d821c05d5594e217c8541a78c45fb00 100644 (file)
@@ -6,6 +6,8 @@ CREATE TABLE tidscan(id integer);
 INSERT INTO tidscan VALUES (1), (2), (3);
 
 -- show ctids
+-- XXX since rows come from different datanodes, some TIDs can be duplicated in
+-- XL
 SELECT ctid, * FROM tidscan;
 
 -- ctid equality - implemented as tidscan