1. 17 6月, 2020 1 次提交
    • T
      Update PyGreSQL from 4.0.0 to 5.1.2 · f5758021
      Tyler Ramer 提交于
      This commit updates pygresql from 4.0.0 to 5.1.2, which requires
      numerous changes to take advantages of the major result syntax change
      that pygresql5 implemented. Of note, cursors or query objects
      automatically cast returned values as appropriate python types - list of
      ints, for example, instead of a string like "{1,2}". This is the bulk of
      the changes.
      
      Updating to pygresql 5.1.2 provides numerous benfits, including the
      following:
      
      - CVE-2018-1058 was addressed in pygresql 5.1.1
      
      - We can save notices in the pgdb module, rather than relying on importing
      the pg module, thanks to the new "set_notices()"
      
      - pygresql 5 supports python3
      
      - Thanks to a change in the cursor, using a "with" syntax guarentees a
        "commit" on the close of the with block.
      
      This commit is a starting point for additional changes, including
      refactoring the dbconn module.
      
      Additionally, since isolation2 uses pygresql, some pl/python scripts
      were updated, and isolation2 SQL output is further decoupled from
      pygresql. The output of a psql command should be similar enough to
      isolation2's pg output that minimal or no modification is needed to
      ensure gpdiff can recognize the output.
      Co-Authored-by: NTyler Ramer <tramer@pivotal.io>
      Co-authored-by: NJamie McAtamney <jmcatamney@pivotal.io>
      f5758021
  2. 16 6月, 2020 5 次提交
    • J
      Properly mark null return from combine functions · 736898ad
      Jesse Zhang 提交于
      We had a bug in a few of the combine functions where if the combine
      function returned a NULL, it didn't set fcinfo->isnull = true. This led
      to a segfault when we would spill in the final hashagg of a two-stage
      agg inside the serial function. So, properly mark NULL outputs from the
      combine functions.
      Co-authored-by: NDenis Smirnov <sd@arenadata.io>
      Co-authored-by: NSoumyadeep Chakraborty <sochakraborty@pivotal.io>
      736898ad
    • J
      Fix double deduction of FREEABLE_BATCHFILE_METADATA · 66a0cb4d
      Jesse Zhang 提交于
      Earlier, we always deducted FREEABLE_BATCHFILE_METADATA inside
      closeSpillFile() regardless of whether the spill file was already
      suspended. This deduction, is already performed inside
      suspendSpillFiles(). This double accounting leads to
      hashtable->mem_for_metadata becoming negative and we get:
      
      FailedAssertion("!(hashtable->mem_for_metadata > 0)", File: "execHHashagg.c", Line: 2141)
      Co-authored-by: NSoumyadeep Chakraborty <sochakraborty@pivotal.io>
      66a0cb4d
    • J
      Fix assert condition in spill_hash_table() · 067bb350
      Jesse Zhang 提交于
      This commit fixes the following assertion failure message reported in:
      (#9902) https://github.com/greenplum-db/gpdb/issues/9902
      
      FailedAssertion("!(hashtable->nbuckets > spill_set->num_spill_files)", File: "execHHashagg.c", Line: 1355)
      
      hashtable->nbuckets can actually end up being equal to
      spill_set->num_spill_files, which causes the failure. This is because:
      
      hashtable->nbuckets is set with HashAggTableSizes->nbuckets, which can
      end up being equal to: gp_hashagg_default_nbatches. Refer:
      nbuckets = Max(nbuckets, gp_hashagg_default_nbatches);
      
      Also, spill_set->num_spill_files is set with
      HashAggTableSizes->nbatches, which is further set to
      gp_hashagg_default_nbatches.
      
      Thus, these two entities can be equal.
      Co-authored-by: NSoumyadeep Chakraborty <sochakraborty@pivotal.io>
      067bb350
    • (
      Increase retry count for pg_rewind tests' replication promotion and streaming. (#10292) · a3d8302a
      (Jerome)Junfeng Yang 提交于
      Increase the retry count to prevent test failed. Most of the time, the
      failure is because slow processing.
      a3d8302a
    • C
      Fix ICW test if GPDB compiled without ORCA · 9aa2b26c
      Chris Hajas 提交于
      We need to ignore the output when enabling/disabling an Orca xform, as
      if the server is not compiled with Orca there will be a diff (and we
      don't really care about this output).
      
      Additionally, clean up unnecessaary/excessive setting of GUCs
      
      Some of these gucs were on by default or only intended for a specific
      test. Explicitly setting them caused them to appear at the end of
      `explain verbose` plans, making the expected output more difficult to
      match with if the server was built with/without Orca.
      9aa2b26c
  3. 15 6月, 2020 4 次提交
    • P
      Retry more for replication synchronization waiting to avoid isolation2 test flakiness. (#10281) · ca360700
      Paul Guo 提交于
      Some test cases have been failing due to too few retries. Let's increase them and also
      create some common UDF for use.
      Reviewed-by: NHubert Zhang <hzhang@pivotal.io>
      Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
      ca360700
    • P
      Fix flakiness of "select 1" output after master reset due to injected panic... · 02ad1fc4
      Paul Guo 提交于
      Fix flakiness of "select 1" output after master reset due to injected panic fault before_read_command (#10275)
      
      Several tests inject panic in before_read_command to trigger master reset.
      Previous we run "select 1" after the fault inject query to verify, but the
      output is not deterministic sometimes. i.e. sometimes we do not see the line
      
      PANIC:  fault triggered, fault name:'before_read_command' fault type:'panic'
      
      This was actually observed in test crash_recovery_redundant_dtx per commit
      message and test comment.  It ignores the output of "select 1", but probably
      we still want the output to verify the fault is encountered.
      
      It's still mysterious why sometimes the PANIC message is missing. I spent some
      time on digging but reckon that I can not root cause in short time. One guess
      is that the PANIC message was although sent to the frontend in errfinish() but
      the kernel buffer-ed data was dropped after abort() due to ereport(PANIC);
      Another guess is something wrong related to libpq protocol (not saying it's a
      libpq bug).  In any case, it does not deserve much time to work on the tests
      only, so simply mask the PANIC message to make the test result deterministic
      and also not affect the test purpose.
      Reviewed-by: NHubert Zhang <hzhang@pivotal.io>
      02ad1fc4
    • X
      Move to a resource group with memory_limit 0 · 37a19376
      xiong-gang 提交于
      When move a query to a resource group whose memory_limit is 0, the available
      memory is the current available global shared memory.
      37a19376
    • X
      Fix a recursive AbortTransaction issue · b5c4fdc0
      xiong-gang 提交于
      When the error happens after ProcArrayEndTransaction, it will recurse back to
      AbortTransaction, we need to make sure it will not generate extra WAL record
      and not fail the assertions.
      b5c4fdc0
  4. 13 6月, 2020 2 次提交
  5. 12 6月, 2020 2 次提交
    • (
      Create external table fdw extension under gpcontrib. (#10187) · d86f32e5
      (Jerome)Junfeng Yang 提交于
      Remove pg_exttable.h since the catalog is no longer exist anymore.
      Move function declaration in pg_exttable.h into external.h.
      Extract related code into external.c which maintains all codes that
      can not be moved into an external table fdw extension.
      
      Also, move the external table orca interface into external.c as a workaround.
      Maybe provide orca fdw routine in the future.
      
      Extract the external table's execution logic into external table fdw
      extension.
      
      Create the gp_exttable_fdw extension during gpinitsystem to allow
      creating system external tables.
      d86f32e5
    • D
      a4e230b2
  6. 11 6月, 2020 5 次提交
    • H
      Revert "Fix flaky test exttab1" · f538f4b6
      Hubert Zhang 提交于
      This reverts commit 026e4595.
      This commit break pxf test case. We need to handle it firstly.
      f538f4b6
    • H
      Fix flaky test terminate_in_gang_creation · 63b5adf9
      Hubert Zhang 提交于
      The test case restarts all primaries and expects the old session
      would fail for the next query since gangs are cached.
      But the restart may last more than 18s which is the max idle
      time QEs could exist. In this case, the new query in the old
      session will just fetch a new gang without expected errors.
      Just set gp_vmem_idle_resource_timeout to 0 to fix this flaky test.
      Reviewed-by: NPaul Guo <pguo@pivotal.io>
      63b5adf9
    • H
      Fix flaky test exttab1 · 026e4595
      Hubert Zhang 提交于
      The flaky case happens when select an external table with option
      "fill missing fields". By gdb the qe, this value is not false
      on QE sometimes. When ProcessCopyOptions, we use intVal(defel->arg)
      to parse the boolean value, which is not correct. Using defGetBoolean
      to replace it.
      026e4595
    • J
      Add a new line feed and fix a bad file name · f281ac17
      J·Y 提交于
      f281ac17
    • L
      docs - graph analytics new page (#10138) · 6d7b949c
      Lena Hunter 提交于
      * clarifying pg_upgrade note
      
      * graph edits
      
      * graph analytics updates
      
      * menu edits and code spacing
      
      * graph further edits
      
      * insert links for modules
      6d7b949c
  7. 10 6月, 2020 4 次提交
  8. 09 6月, 2020 2 次提交
  9. 08 6月, 2020 3 次提交
    • H
      Remove unused variable and rel_is_external_table() call. · 71e50c75
      Heikki Linnakangas 提交于
      Was left unused by commit e4b499aa that removed the pg_exttable catalog
      table.
      71e50c75
    • Z
      Fix lateral PANIC issue when subquery contain limit or groupby. · 8d1bb5a8
      Zhenghua Lyu 提交于
      Previous commit 62579728 fixes a lateral panic issue but does
      not handle all the bad cases because it only check if the query
      tree contains limit clause. Bad cases for example: if the subquery
      is like `q1 union all (q2 limit 1)` then the whole query tree
      does not contain limit clause.
      
      Another bad case is the lateral subquery may contain groupby.
      like:
      
          select * from t1_lateral_limit t1 cross join lateral
          (select (c).x+t2.a, sum(t2.a+t2.b) from t2_lateral_limit t2
           group by (c).x+t2.a)x;
      
      When planning the lateraled subquery we do not know where is
      the param in the subquery's query tree. Thus it is a bit complicated
      to precisely and efficiently resolve this issue.
      
      This commit adopts a simple method to fix panic issue: it justs
      check the subquery's query tree to see if there is any group-by
      or limit clause, if so, force gather each relation and materialize
      them. This is not the best plan we might get. But let's make it
      correct first and I think in future we should seriously consider
      how to fully and efficiently support lateral.
      8d1bb5a8
    • P
      Retire guc gp_session_role (#9396) · f6297b96
      Paul Guo 提交于
      Use guc gp_role only now and replace the functionality of guc gp_session_role with it
      also. Previously we have both gucs. The difference of the two gucs are (copied
      from code comment):
      
       * gp_session_role
       *
       * - does not affect the operation of the backend, and
       * - does not change during the lifetime of PostgreSQL session.
       *
       * gp_role
       *
       * - determines the operating role of the backend, and
       * - may be changed by a superuser via the SET command.
      
      This is not friendly for coding. For example, You could find Gp_role and
      Gp_session_role are set as GP_ROLE_DISPATCH on Postmaster & many aux processes
      on all nodes (even QE nodes) in a cluster, so you can see that to differ from
      QD postmaster and QE postmaster, current gpdb uses an additional -E option in
      postmaster arguments. These makes developers confusing when writing role branch
      related code given we have three related variables.  Also some related code is
      even buggy now (e.g. 'set gp_role' even FATAL quits).
      
      With this patch we just have gp_role now. Some changes which might be
      interesting in the patch are:
      
      1. For postmaster, we should specify '-c gp_role=' (e.g. via pg_ctl argument) to
         determine the role else we assume the utility role.
      
      2. For stand-alone backend, utility role is enforced (no need to specify by
         users).
      
      3. Could still connect QE/QD nodes using utility mode with PGOPTIONS, etc as
         before.
      
      4. Remove the '-E' gpdb hacking and align the '-E' usage with upstream.
      
      5. Move pm_launch_walreceiver out of the fts related shmem given the later is
         not used on QE.
      Reviewed-by: NBhuvnesh Chaudhary <bchaudhary@pivotal.io>
      Reviewed-by: NGang Xiong <gxiong@pivotal.io>
      Reviewed-by: NHao Wu <gfphoenix78@gmail.com>
      Reviewed-by: NYandong Yao <yyao@pivotal.io>
      f6297b96
  10. 06 6月, 2020 1 次提交
  11. 05 6月, 2020 7 次提交
    • L
      docs - update some xrefs and upgrade info (#10237) · 07c2029c
      Lisa Owen 提交于
      07c2029c
    • A
      Fix wrong data type introduced in bf36fb3b · a251127b
      Asim R P 提交于
      a251127b
    • B
      Fix user specify in matview_ao test · 24df496d
      bzhaoopenstack 提交于
      This patch will create a test role to exec the test.
      24df496d
    • H
      Fix flaky test in recoverseg_from_file · 1ee9998b
      Hubert Zhang 提交于
      1. after stop primary with content=1, we should check promotion
      status with 1U:
      2. after manually update dbid, we should trigger a fts probe and
      wait for the mirror promotion as well.
      Reviewed-by: NPaul Guo <pguo@pivotal.io>
      1ee9998b
    • H
      Support "NDV-preserving" function and op property (#10247) · a4362cba
      Hans Zeller 提交于
      Orca uses this property for cardinality estimation of joins.
      For example, a join predicate foo join bar on foo.a = upper(bar.b)
      will have a cardinality estimate similar to foo join bar on foo.a = bar.b.
      
      Other functions, like foo join bar on foo.a = substring(bar.b, 1, 1)
      won't be treated that way, since they are more likely to have a greater
      effect on join cardinalities.
      
      Since this is specific to ORCA, we use logic in the translator to determine
      whether a function or operator is NDV-preserving. Right now, we consider
      a very limited set of operators, we may add more at a later time.
      
      Let's assume that we join tables R and S and that f is a function or
      expression that refers to a single column and does not preserve
      NDVs. Let's also assume that p is a function or expression that also
      refers to a single column and that does preserve NDVs:
      
      join predicate       card. estimate                         comment
      -------------------  -------------------------------------  -----------------------------
      col1 = col2          |R| * |S| / max(NDV(col1), NDV(col2))  build an equi-join histogram
      f(col1) = p(col2)    |R| * |S| / NDV(col2)                  use NDV-based estimation
      f(col1) = col2       |R| * |S| / NDV(col2)                  use NDV-based estimation
      p(col1) = col2       |R| * |S| / max(NDV(col1), NDV(col2))  use NDV-based estimation
      p(col1) = p(col2)    |R| * |S| / max(NDV(col1), NDV(col2))  use NDV-based estimation
      otherwise            |R| * |S| * 0.4                        this is an unsupported pred
      Note that adding casts to these expressions is ok, as well as switching left and right side.
      
      Here is a list of expressions that we currently treat as NDV-preserving:
      
      coalesce(col, const)
      col || const
      lower(col)
      trim(col)
      upper(col)
      
      One more note: We need the NDVs of the inner side of Semi and
      Anti-joins for cardinality estimation, so only normal columns and
      NDV-preserving functions are allowed in that case.
      
      This is a port of these GPDB 5X and GPOrca PRs:
      https://github.com/greenplum-db/gporca/pull/585
      https://github.com/greenplum-db/gpdb/pull/10090
      
      This is take 2, after reverting the first attempt due to a merge conflict that
      caused a test to fail.
      a4362cba
    • D
      Docs - update gpcc compatibility info for 6.8 · 560ffcb1
      David Yozie 提交于
      560ffcb1
    • L
      docs - add pxf v5.12 to supported platforms (#10235) · fe3464af
      Lisa Owen 提交于
      fe3464af
  12. 04 6月, 2020 3 次提交
    • H
      Fix the logic in pg_lock_status() to keep track of which row to return. · 90634b6a
      Heikki Linnakangas 提交于
      The logic with 'whichrow' and 'whichresultset' introduced in commit
      991273b2 was slightly wrong. The last row (or first? not sure) of each
      result set was returned twice, and the corresponding number of rows at the
      end of the last result set were omitted.
      
      For example:
      
      postgres=# select gp_segment_id, * from pg_locks;
       gp_segment_id |  locktype  | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction |  pid  |      mode       | granted | fastpath | mppsessionid | mppiswriter | gp_segment_id
      ---------------+------------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-------+-----------------+---------+----------+--------------+-------------+---------------
                  -1 | relation   |    13200 |    11869 |      |       |            |               |         |       |          | 1/8                | 28748 | AccessShareLock | t       | t        |            6 | t           |            -1
                  -1 | virtualxid |          |          |      |       | 1/8        |               |         |       |          | 1/8                | 28748 | ExclusiveLock   | t       | t        |            6 | t           |            -1
                   0 | virtualxid |          |          |      |       | 1/7        |               |         |       |          | 1/7                | 28750 | ExclusiveLock   | t       | t        |            6 | t           |             0
                   1 | virtualxid |          |          |      |       | 1/7        |               |         |       |          | 1/7                | 28751 | ExclusiveLock   | t       | t        |            6 | t           |             1
                   1 | virtualxid |          |          |      |       | 1/7        |               |         |       |          | 1/7                | 28751 | ExclusiveLock   | t       | t        |            6 | t           |             1
      (5 rows)
      
      Note how the last row is duplicated. And the row for 'virtualxid' from
      segment 2 is omitted.
      
      I noticed this while working on the PostgreSQL v12 merge: the 'lock'
      regression test was failing because of this. I'm not entriely sure why we
      haven't seen failures on 'master'. I think it's pure chance that none of
      the lines that the test prints have been omitted on 'master'. But because
      that's been failing, I don't feel the need to add more tests for this.
      90634b6a
    • J
      Revert "Support "NDV-preserving" function and op property (#10225)" · 898e66b8
      Jesse Zhang 提交于
      Regression test "gporca" started failing after merging d565edac.
      
      This reverts commit d565edac.
      898e66b8
    • H
      Support "NDV-preserving" function and op property (#10225) · d565edac
      Hans Zeller 提交于
      Orca uses this property for cardinality estimation of joins.
      For example, a join predicate foo join bar on foo.a = upper(bar.b)
      will have a cardinality estimate similar to foo join bar on foo.a = bar.b.
      
      Other functions, like foo join bar on foo.a = substring(bar.b, 1, 1)
      won't be treated that way, since they are more likely to have a greater
      effect on join cardinalities.
      
      Since this is specific to ORCA, we use logic in the translator to determine
      whether a function or operator is NDV-preserving. Right now, we consider
      a very limited set of operators, we may add more at a later time.
      
      Let's assume that we join tables R and S and that f is a function or
      expression that refers to a single column and does not preserve
      NDVs. Let's also assume that p is a function or expression that also
      refers to a single column and that does preserve NDVs:
      
      join predicate       card. estimate                         comment
      -------------------  -------------------------------------  -----------------------------
      col1 = col2          |R| * |S| / max(NDV(col1), NDV(col2))  build an equi-join histogram
      f(col1) = p(col2)    |R| * |S| / NDV(col2)                  use NDV-based estimation
      f(col1) = col2       |R| * |S| / NDV(col2)                  use NDV-based estimation
      p(col1) = col2       |R| * |S| / max(NDV(col1), NDV(col2))  use NDV-based estimation
      p(col1) = p(col2)    |R| * |S| / max(NDV(col1), NDV(col2))  use NDV-based estimation
      otherwise            |R| * |S| * 0.4                        this is an unsupported pred
      Note that adding casts to these expressions is ok, as well as switching left and right side.
      
      Here is a list of expressions that we currently treat as NDV-preserving:
      
      coalesce(col, const)
      col || const
      lower(col)
      trim(col)
      upper(col)
      
      One more note: We need the NDVs of the inner side of Semi and
      Anti-joins for cardinality estimation, so only normal columns and
      NDV-preserving functions are allowed in that case.
      
      This is a port of these GPDB 5X and GPOrca PRs:
      https://github.com/greenplum-db/gporca/pull/585
      https://github.com/greenplum-db/gpdb/pull/10090
      d565edac
  13. 03 6月, 2020 1 次提交
    • S
      Remove unnecessary projections from duplicate sensitive Distribute(s) in ORCA · c02fd5a1
      Shreedhar Hardikar 提交于
      Duplicate sensitive HashDistribute Motions generated by ORCA get
      translated to Result nodes with hashFilter cols set. However, if the
      Motion needs to distribute based on a complex expression (rather than
      just a Var), the expression must be added into the targetlist of the
      Result node and then referenced in hashFilterColIdx.
      
      However, this can affect other operators above the Result node. For
      example, a Hash operator expects the targetlist of its child node to
      contain only elements that are to be hashed. Additional expressions here
      can cause issues with memtuple bindings that can lead to errors.
      
      (E.g The attached test case, when run without our fix, will give an
      error: "invalid input syntax for integer:")
      
      This PR fixes the issue by adding an additional Result node on top of
      the duplicate sensitive Result node to project only the elements from
      the original targetlist in such cases.
      c02fd5a1