1. 07 9月, 2020 2 次提交
  2. 04 9月, 2020 2 次提交
    • M
      Fix server crash under rebuilding of RTEs and RelOptInfos · 78fb79d9
      Maksim Milyutin 提交于
      The GROUPING SETS statement with multiple canonical rollups working on
      randomly distributed partitioned table causes rebuilding of
      root->simple_rte_array and root->simple_rel_array on planning stage by
      PostgreSQL optimizer. The rebuilding process initializes both RTEs and
      RelOptInfos item by item and doesn't take into account that the
      build_simple_rel() routine is recursive for inherited relations and
      requires a full list of already initialized child RTEs inside
      root->simple_rte_array. As a result, the call of build_simple_rel() fails
      on the access to child RTEs.
      
      The current fix segregates loops of building root->simple_rte_array and
      root->simple_rel_array trying to leave a whole semantics unchanged.
      78fb79d9
    • X
      Fix a 'VACUUM FULL' bug · 5f87e80a
      xiong-gang 提交于
      When doing 'VACUUM FULL', 'swap_relation_files' updates the pg_class entry but
      not increase the command counter, so the later 'vac_update_relstats' will
      inplace update the 'relfrozenxid' and 'relhasindex' of the old tuple, when the
      transaction is interrupted and aborted on the QE after this, the old entry is
      corrupted.
      5f87e80a
  3. 03 9月, 2020 4 次提交
  4. 02 9月, 2020 3 次提交
    • D
      Allow direct dispatch in Orca if predicate on column gp_segment_id (#10679) · f55b0fac
      David Kimura 提交于
      This approach special cases gp_segment_id enough to include the column
      as a distributed column constraint. It also updates direct dispatch info
      to be aware of gp_segment_id which represents the raw value of the
      segment where the data resides. This is different than other columns
      which hash the datum value to decide where the data resides.
      
      After this change the following DDL shows Gather Motion from 2 segments
      on a 3 segment demo cluster.
      
      ```
      CREATE TABLE t(a int, b int) DISTRIBUTED BY (a);
      EXPLAIN SELECT gp_segment_id, * FROM t WHERE gp_segment_id=1 or gp_segment_id=2;
                                        QUERY PLAN
      -------------------------------------------------------------------------------
       Gather Motion 2:1  (slice1; segments: 2)  (cost=0.00..431.00 rows=1 width=12)
         ->  Seq Scan on t  (cost=0.00..431.00 rows=1 width=12)
               Filter: ((gp_segment_id = 1) OR (gp_segment_id = 2))
       Optimizer: Pivotal Optimizer (GPORCA)
      (4 rows)
      
      ```
      
      (cherry picked from commit 10e2b2d9)
      f55b0fac
    • H
      Fix resource group runaway rounding issue · 0ade3e4e
      Hubert Zhang 提交于
      When calculating safeChunksThreshold of runaway in resource group,
      we used to divide by 100 to get the number of safe chunks. This may
      lead to small chunk numbers to be rounded to zero. Fix it by storing
      safeChunksThreshold100(100 times bigger than the real safe chunk) and
      do the computation on the fly.
      Reviewed-by: NNing Yu <nyu@pivotal.io>
      (cherry picked from commit 757184f9)
      0ade3e4e
    • B
      Export MASTER_DATA_DIRECTORY when calling gpconfig · ccce626b
      Bhuvnesh Chaudhary 提交于
      MASTER_DATA_DIECTORY must be exported to before calling
      gpconfig else it will fail to set the GUC
      
      Allow setting DCA_VERSION_FILE to enable testing
      
      Allow overriding the value of DCA_VERSION_FILE so that during testing it
      can be manipulated. Also add a test for the same to ensure that DCA
      configuration GUCs are set properly on the environment.
      ccce626b
  5. 01 9月, 2020 2 次提交
  6. 31 8月, 2020 3 次提交
    • H
      Fix crashes when a Values Scan needs to create "fake ctids". · 3b7ca45c
      Heikki Linnakangas 提交于
      When converting semi-join to inner-join, a distinct agg on ctid is added
      above the hash-join node. But the fake ctids generated in Values Scan
      were invalid, with offset number 0, which caused an assertion failure.
      
      This patch is based on commit d8886cf9, which fixed the same issue for
      Function Scans.
      Co-authored-by: Ndh-cloud <60729713+dh-cloud@users.noreply.github.com>
      Co-authored-by: NJesse Zhang <sbjesse@gmail.com>
      3b7ca45c
    • J
      Add ctid in function scan · ba8f2fe0
      Jinbao Chen 提交于
      When we convert semi join to inner join, a distinct agg on ctid is added
      above the hash join node. But tuples from function scan have no ctid. So
      the assert check failed.
      
      Set a synthetic ctid based on a fake ctid by call existed funciton
      slot_set_ctid_from_fake.
      
      (cherry picked from commit d8886cf9)
      ba8f2fe0
    • D
      Disable strxfrm for mk_sort at compile time · 4d248acb
      Denis Smirnov 提交于
      Glibc implementations are known to return inconsistent results for
      strcoll() and strxfrm() on many platforms that can cause
      unpredictable bugs. Because of that PostgreSQL disabled strxfrm()
      by default since 9.5 at compile time by TRUST_STRXFRM definition.
      Greenplum has its own mk sort implementation that can also use
      strxfrm(). Hence mk sort can also be affected by strcoll() and
      strxfrm() inconsistency (breaks merge joins). That is why strxfrm()
      should be disabled by default with TRUST_STRXFRM_MK_SORT definition
      for mk sort as well. We don't use PostgreSQL's TRUST_STRXFRM
      definition as many users used Greenplum with strxfrm() enabled for
      mk sort and disabled in PostgreSQL core. Keeping TRUST_STRXFRM_MK_SORT
      as a separate definition allows these users not to reindex after
      version upgrade.
      Reviewed-by: NAsim R P <pasim@vmware.com>
      Reviewed-by: NHeikki Linnakangas <linnakangash@vmware.com>
      Reviewed-by: NHubert Zhang <hzhang@pivotal.io>
      4d248acb
  7. 28 8月, 2020 1 次提交
  8. 27 8月, 2020 2 次提交
    • P
      Fix missing xlog files with orphaned prepared transactions after crash recovery · dafe0c8c
      Paul Guo 提交于
      After crash recovery finishes, the startup process will create an
      end-of-recovery checkpoint. The checkpoint will recycle/remove xlog files
      according to orphaned prepared transaction LSNs, replication slot data, etc.
      The orphaned prepared transaction LSN data (TwoPhaseState->prepXacts, etc) for
      checkpoint are populated in the startup process RecoverPreparedTransactions(),
      but the function is called after the end-of-recovery checkpoint creation so
      xlog files with orphaned prepared transactions might be recycled/removed. This
      can cause "requested WAL segment pg_xlog/000000010000000000000009 has already
      been removed" kind of error when bringing up the crashed primary. For example
      if you run 'gprecoverseg -a -v', you might be able to see failure with stack as
      below. In more details, this happens when running the single mode postgres in
      pg_rewind.
      	2    0x5673a1 postgres <symbol not found> (xlogutils.c:572)
      	3    0x567b2f postgres read_local_xlog_page (xlogutils.c:870)
      	4    0x5658f3 postgres <symbol not found> (xlogreader.c:503)
      	5    0x56518a postgres XLogReadRecord (xlogreader.c:226)
      	6    0x54d725 postgres RecoverPreparedTransactions (twophase.c:1955)
      	7    0x55b0b7 postgres StartupXLOG (xlog.c:7760)
      	8    0xb0087f postgres InitPostgres (postinit.c:704)
      	9    0x97a97c postgres PostgresMain (postgres.c:4829)
      
      Fixing this by prescanning the prepared transaction data from xlogs directly
      for checkpoint creation if it's still InRecovery (i.e. when
      TwoPhaseState->prepXacts is not populated).
      
      Please note that "orphaned" might be temporary (usually happens on an
      environment with heavy write-operation load) or permanent unless master dtx
      recovery (implies a product bug).
      
      This is a gpdb 6 only issue. On gpdb 7, state files are used to store prepared
      transactions during checkpoint so we do not keep the wal files with orphaned
      prepared transactions and thus we won't encounter this issue.
      Reviewed-by: NAsim R P <pasim@vmware.com>
      dafe0c8c
    • G
      Fix assertion failures in BackoffSweeper · 11daae4e
      ggbq 提交于
      Previous commit ab74e1c6, c7befb1d did not completely solve its race
      condition, it did not test for last iteration of the while/for loop.
      This could result in failed assertion in the following loop. The patch
      moves the judgement to the ending of the for loop, it is safe, because
      the first iteration will never trigger: Assert(activeWeight > 0.0).
      
      Also, the other one race condition can trigger this assertion
      Assert(gl->numFollowersActive > 0). Consider this situation:
      
          Backend A, B belong to the same statement.
      
          Timestamp1: backend A's leader is A, backend B's leader is B.
      
          Timestamp2: backend A's numFollowersActive remains zero due to timeout.
      
          Timestamp3: Sweeper calculates leader B's numFollowersActive to 1.
      
          Timestamp4: backend B changes it's leader to A even if A is inactive.
      
      We stop sweeping for this race condition just like commit ab74e1c6 did.
      
      Both Assert(activeWeight > 0.0) and Assert(gl->numFollowersActive > 0)
      are removed.
      
      (cherry picked from commit b1c19196)
      11daae4e
  9. 26 8月, 2020 3 次提交
    • X
      Fix dblink's libpq issue on gpdb 6X (#10656) · 1dc23be2
      Xiaoran Wang 提交于
      * Fix dblink's libpq issue
      
      When using dblink to connect to a postgres database, it reports the
      following error:
      unsupported frontend protocol 28675.0: server supports 2.0 to 3.0
      
      Even if dblink.so is dynamically linked to libpq.so which is compiled
      with the option -DFRONTEND, but when it's loaded in gpdb and run,
      it will use the backend libpq which is compiled together with
      Postgres program and reports the error.
      
      This pr is almost the same as the pr:
      https://github.com/greenplum-db/gpdb/pull/10617
      which is used to fix postgres_fdw issue
      
      * Disable dblink on MaxOS
      
      --exclude-libs and -Bstatic are not supported on MaxOS
      1dc23be2
    • X
      Fix postgres fdw on gpdb 6X (#10680) · 6a6da69f
      Xiaoran Wang 提交于
      * Fix postgres_fdw's libpq issue
      
      When using posgres_fdw, it reports the following error:
      unsupported frontend protocol 28675.0: server supports 2.0 to 3.0
      
      root cause: Even if postgres_fdw.so is dynamic linked to libpq.so
      which is compiled with the option -DFRONTEND, but when it's loaded
      in gpdb and run, it will use the backend libpq which is compiled together
      with postgres program and reports the error.
      
      We statically link libpq into postgres_fdw and hide all the symbols
      of libpq.a with --exclude-libs=libpq.a to make it uses the frontend
      libpq.
      
      As postgres_fdw is compiled as a backend without -DFRONTEND, and linked
      to libpq which is a frontend, but _PQconninfoOption's length is
      different between backend and frontend as there is a macro in it.
      The backend's _PQconninfoOption has field connofs, but the frontend
      doesn't. This leads to the crash of postgres_fdw. One solution is to
      remove the FRONTEND macro in struct PQconninfoOption to make PQconninfoOption
      is same in the backend and frontend, but that brings an ABI change. To avoid that,
      we add the FRONTEND macro on including libpq header files, so that postgres_fdw
      can process the libpq's variables returned by libpq.a's functions as frontend.
      
      * Disable postgres_fdw on MaxOS
      6a6da69f
    • X
      Fix gp_error_handling makefile (#10703) · 0f1ae7f4
      Xiaoran Wang 提交于
      0f1ae7f4
  10. 25 8月, 2020 4 次提交
    • D
      Docs - add new postgis packaging revision · d27fde37
      David Yozie 提交于
      d27fde37
    • M
      docs - add information on upgrading to PostGIS 2.5.4 (#10550) · 29c29541
      Mel Kiyama 提交于
      * docs - add information on upgrading to PostGIS 2.5.4
      
      Upgrade instructions 2.1.5 to different versions of 2.5.4
      
      * docs - upgrade to PostGIS 2.5.4 review comments
      
      * docs - more review comment updates.
      reorder upgrade sections.
      clarify removing PostGIS package, is for removing the gppkg
      
      * docs - minor edit
      
      * docs - review updates - more emphasis on removing PostGIS from a database deleting objects.
      -Create separate paragraph in Upgrading section.
      -Add warning in Removing PostGIS section
      
      * docs - minor review comment update
      
      * small edits
      Co-authored-by: NDavid Yozie <dyozie@pivotal.io>
      29c29541
    • C
      [6X] Harden analyzedb further against dropped/recreated tables (#10699) · 1ed0676a
      Chris Hajas 提交于
      Commit 445fc7cc hardened some parts of analyzedb. However, it missed a
      couple of cases.
      
      1) When the statement to get the modcount from the pg_aoseg table failed
      due to a dropped table, the transaction was also terminated. This caused
      further modcount queries to fail and while those tables were analyzed,
      it would error and not properly record the mod count. Therefore, we now
      restart the transaction when it errors.
      
      2) If the table is dropped and then recreated while analyzedb is running
      (or some other mechanism that results in the table being successfully
      analyzed, but the pg_aoseg table did not exist during the initial
      check), the logic to update the modcount may fail. Now, we skip the
      update for the table if this occurs. In this case, the modcount would
      not be recorded and the next analyzedb run will consider the table
      modified (or dirty) and re-analyze it, which is the desired behavior.
      1ed0676a
    • D
      Allow NEq predicates on lossy casts to do Partition Selection (#10625) · 54a409df
      Divyesh Vanjare 提交于
      * allow NEq predicates with lossy casts for PS
      * Updating some mdp files that were missing the PartitionTypes XML tag
      * Update partition_pruning result file for planner
      * adding new testcase for NEq
      * move icg tests from partition_pruning to gporca
      * add test for checking multilevel range/list PS
      Co-authored-by: NHans Zeller <hzeller@vmware.com>
      54a409df
  11. 24 8月, 2020 1 次提交
  12. 21 8月, 2020 2 次提交
    • D
      Add workload2 to explain pipeline · 0d1da7a3
      David Kimura 提交于
      This is kept as a separate commit as an example of how to add additional
      workloads.
      Co-authored-by: NChris Hajas <chajas@vmware.com>
      0d1da7a3
    • C
      Create explain pipeline for use with slack commands · a797776f
      Chris Hajas 提交于
      This creates an explain pipeline which is used to run query workloads
      using explain and identify plan differences during feature development.
      
      This previously existed on 5X, but with the Orca in GPDB effort the
      architecture needed to be updated.
      
      The new pipeline has the following features for use with slack commands:
      
      - Comparing a SHA with a baseline SHA
      - Identifying and outputting plan diffs
      - Summarizing the results with planning time, any
      fallbacks/crashes/timeouts, and the type of diff (cost, cardinality,
      plan change)
      - Enabling custom gucs (turning optimizer off, using a different cost
      model, enabling/disabling a feature flag/join order)
      
      Some use cases that we've come across:
      - Checking whether a new join order algorithm influences optimization
      time/dramatically changes plans
      
      One of the main goals with this change is to make it easy to add
      workloads. The slack command can be used in the following format:
      
      \test_gpdb6_explain <SHA_remote> <SHA> <baseline_SHA_remote>
      <baseline_SHA> <workload> [optional_gucs]
      
      where workloads is either "all" or a list with no spaces of the names of
      the workloads to run (eg: workload1,workload2,workload3).
      and gucs, if specified, are in the format:
      ```
      optimizer=off
      enable_nestloop=on
      ```
      a797776f
  13. 20 8月, 2020 3 次提交
  14. 19 8月, 2020 4 次提交
    • H
      Enable external_table test case in ic-proxy mode · c3b4f767
      Hubert Zhang 提交于
      ic-proxy supports to handle cancel signal during
      backend connection setup now, so external_table test case
      could be enabled.
      Reviewed-by: NNing Yu <nyu@pivotal.io>
      (cherry picked from commit 1789e437)
      c3b4f767
    • H
      Using libuv 1.18 API in ic-proxy · 43d7d482
      Hubert Zhang 提交于
      ic-proxy is developed with libuv, the minimal supported libuv version is
      1.18.0. But in commit 608514, we introduce new API in libuv 1.19, which
      break compatibility on os like Ubuntu 18.04 whose default libuv version
      is 1.18.
      
      We should keep our code base align with libuv 1.18, and replace the new
      API in libuv 1.19. The API change is mainly about how to access data field
      in uv handle and uv loop. The new API uses function interface like
      `uv_handle_set_data` and `uv_handle_get_data` to access data filed, while
      the old API in 1.18 access the data filed directly. Note that in the latest
      libuv version 1.38.2, the old API and new API are both supported. And libuv
      is stable enough to support the old API for a long time.
      
      (cherry picked from commit ab36eb90)
      43d7d482
    • H
      ic-proxy: support parallel backend registeration to proxy · 9967bc1d
      Hubert Zhang 提交于
      Previously, when backends connect to a proxy, we need to setup
      domain socket pipe and send HELLO message(recv ack message) in
      a blocking and non-parallel way. This makes ICPROXY hard to introduce
      check_for_interrupt during backend registeration.
      
      By utilizing libuv loop, we could register backend in paralle. Note
      that this is one of the step to replace all the ic_tcp backend logic
      reused by ic_proxy currently. In future, we should use libuv to replace
      all the backend logic, from registeration to send/recv data.
      Co-authored-by: NNing Yu <nyu@pivotal.io>
      (cherry picked from commit 608514c5)
      9967bc1d
    • (
      Fix CREATE EXTENSION gp_internal_tools changes search_path (#10653) · 2fbf4808
      (Jerome)Junfeng Yang 提交于
      1. SQL script in /gpcontrib/gp_internal_tools/gp_internal_tools--1.0.0.sql
      and /gpcontrib/uninstall_gp_session_state.sql changes current search_path,
      this commit set search_path to default at the end of the above two SQL scripts
      2.fix typos in /gpcontrib/gp_internal_tools/gp_internal_tools--1.0.0.sql
      3.fix the expect caused by this fix.
      
      This fixes the issue: https://github.com/greenplum-db/gpdb/issues/10575.
      
      (cherry picked from commit 9d9662f0)
      Co-authored-by: NLittleWuCoding <31984989+LittleWuCoding@users.noreply.github.com>
      2fbf4808
  15. 18 8月, 2020 3 次提交
  16. 17 8月, 2020 1 次提交
    • M
      Release tcp_event after socket closing in gpsmon to remove it from event loop (#10610) · 4c8e397c
      Maksim Milyutin 提交于
      After losing tcp connection between gpmmon and gpsmon and subsequent its
      reestablishment the gpsmon enters to infinite loop inside libevent
      routine of timeout event processing. The reason was in calling event_set
      function under new connection establishment on currently working (not
      released) tcp_event that rewrites internal flags of that event and puts
      it into unconsistent state.
      
      The current fix releases tcp_event from participating in event loop
      (takes to unpending state) under connection closing from gpsmon by
      timeout so that the next new connection have to set tpc_event in event
      loop again.
      4c8e397c