1. 14 3月, 2019 11 次提交
  2. 13 3月, 2019 11 次提交
    • J
      Fix assert failure for copy to partition table (#7132) · 5425da14
      Jinbao Chen 提交于
      
      We have an assert failure for copy to partition table if root and child relation
      have different attno. The root cause is that 'reconstructTupleValues'
      has a wrong value of newNumAttrs lenth.
      5425da14
    • Z
      Correctly expand writable external table · 2c9cd895
      Zhang Shujie 提交于
      Writable external table has an entry in gp_distribution_policy
      so it has numsegments field. Previous code skips any external
      tables so that their numsegments fields are not updated. This
      commit fixes this by:
        1. add a column in status_detail table to record whether the
            table is writable external and invokes correct SQL to expand
            such tables.
        2. Support `Alter external table <tab> expand table` for writable
            external tables.
      
      Co-authored-by: Zhenghua Lyu zlv@pivotal.io
      2c9cd895
    • G
      Set the backoff weight avoiding catalog lookups when not in transaction · 797646fc
      Georgios Kokolatos 提交于
      Upstream commit <568d4138> introduced a proper MVCC model for catalog
      lookups. This change means that catalog lookups must be avoided if not in a
      proper transaction state. In PortalSetBackoffWeight(), a check was validating if
      the call was in a transaction and in case of failure no catalog look ups were
      perfomed nor a backend entry was initialized.
      
      This commit initializes a backend entry in all cases with a proper weight. No
      catalogue lookups are performed outside of a transaction state.
      
      Also it tidies up a bit the interface for the initialisation of backoff entries
      as it removes the responsibility for calculating the backoff weight from the
      caller.
      
      Removes 94_MERGE_FIXME.
      Co-authored-by: NJimmy Yih <jyih@pivotal.io>
      Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
      Reviewed-by: NDaniel Gustafsson <dgustafsson@pivotal.io>
      Reviewed-by: NGang Xiong <gxiong@pivotal.io>
      797646fc
    • J
      Add check on exchange partion (#7049) · 8f641583
      Jinbao Chen 提交于
      
      On sql "alter table parttab exchange partition for (1) with table y",
      we checked if the table has same columns with the partion table. But
      on sql "alter table parttab alter partition for (1) exchange partition
      for (1) with table x", we forgot the check. Add the check back.
      8f641583
    • T
      Build necessary extensions for release (#7057) · 35a71407
      Tingfang Bao 提交于
      * Build necessary extensions for release
      
      * Add new  '--enable-debug-extensions' configure option, if provide the option,
        the extensions include:
      
            gp_distribution_policy
            gp_internal_tools
            gp_sparse_vector
            gp_replica_check
            gp_inject_fault
            gp_debug_numsegments
      
      * Rename configure_flags to configure_flags_with_extensions
      
        The configure_flags_with_extensions SHOULD BE set to
      
            configure_flags_with_extensions: "--enable-cassert --enable-debug-extensions"
      
          in these secrets files
      
             secrets/gpdb_master-ci-secrets.dev.yml
             secrets/gpdb_master-ci-secrets.prod.yml
      Co-authored-by: NBob Bao <bbao@pivotal.io>
      Co-authored-by: NNing Fu <nfu@pivotal.io>
      35a71407
    • N
      Ensure partial tables are dropped after table expansion tests · 611f0248
      Ning Yu 提交于
      We need to do a cluster expansion which will check if there are partial
      tables, we need to drop the partial tables to keep the cluster expansion
      run correctly.
      611f0248
    • Z
      Move test partial_table to another test group to avoid deadlock · d9606d18
      Zhenghua Lyu 提交于
      Previously, test cases `partial_table` and `subselect_gp2` are
      in the same test group so that they might be running concurrently.
      
      `partital_table` contains a statement: `update gp_distribution_policy`,
      `subselect_gp2` contains a statement: `VACUUM FULL pg_authid`. These
      two statements may lead to local deadlock on QD when running concurrently
      if GDD is disabled.
      
      If GDD is disabled,
      
        `update gp_distribution_policy`'s lock-acquire:
          1. at parsing stage, lock `gp_distribution_policy` in Exclusive Mode
            2. later when it needs to check authentication, lock `pg_authid` in
                 AccessShare Mode
      
        `VACUUM FULL pg_authid`'s lock-acquire:
          1. lock pg_authid in Access Exclusive Mode
            2. later when rebuilding heap, it might delete some dependencies,
                 this will do GpPolicyRemove, which locks `gp_distribution_policy`
      	        in RowExclusive Mode
      
      So there is a potential local deadlock.
      d9606d18
    • J
      Check permission first to avoid access unavailable field. · 4f0f9b87
      Jialun Du 提交于
      If the target is not a table, it must error out. So it's better
      to do permission check first, or the logic may access some fields
      which is null-able for non-table object and cause crash.
      4f0f9b87
    • N
      Tolerant misplaced tuples during data expansion · 28026210
      Ning Yu 提交于
      Add tests to ensure that a table can be expanded correctly even if it
      contains misplaced tuples.
      28026210
    • T
      Add a sanity check for numsegments properity · 521be451
      Tang Pengzhou 提交于
      I noticed that we haven't a sanity check for the correctness of
      "numsegments" of a table, the numsegments might be larger than
      the size of cluster, eg, table is expanded after a global
      transaction is started and then the table is accessed in that
      transaction or gp_distribution_policy is corrupt in some way,
      Dispatcher or interconnect cannot handle such case, so add a
      sanity check to error it out.
      
      This sanity check is skipped in UTILITY mode.  getgpsegementcount()
      returns -1 in UTILITY mode which will always make numsegments sanity
      check failed, so skip it for UTILITY mode.
      521be451
    • D
      Rename isolationtest suite · 2a374cb5
      Daniel Gustafsson 提交于
      Spell out VACUUM ANALYZE rather than using a pointless, and silly,
      shortening. No functional change.
      Reviewed-by: NGeorgios Kokolatos <gkokolatos@pivotal.io>
      Reviewed-by: NJimmy Yih <jyih@pivotal.io>
      2a374cb5
  3. 12 3月, 2019 15 次提交
    • G
      Make unsafe greenplum specific function linenumber_atoi() safer · 1fcf7e8b
      Georgios Kokolatos 提交于
      The function was using an anti-pattern where an argument is a static
      length char array. Array arguments in C don't really exist but compilers
      accept them and without any 'const' or 'static' decorators they don't
      always emit a warning.
      
      The proposed patch only fixes the unsafeness of the function
      declaration but it does not address the usefulness of it.
      Reviewed-by: NDaniel Gustafsson <dgustafsson@pivotal.io>
      1fcf7e8b
    • D
      Align cdbutil ereports with style guide · d2302ae3
      Daniel Gustafsson 提交于
      Make sure ereport() calls start with a lower case letter, and don't
      end with a period. Also remove superfluous mentions of Greenplum
      Database from messages.
      
      Reviewed-by: Heikki Linnakangas <hlinnakangas@pivotal.io>
      Reviewed-by: NAdam Berlin <aberlin@pivotal.io>
      d2302ae3
    • D
      Expose WorkFileUsagePerQuery definition to match API · f34a7642
      Daniel Gustafsson 提交于
      Commit dfee2ff7 exposed workfile_mgr_cache_entries_get_copy()
      which returns a structure containing WorkFileUsagePerQuery entries,
      but the definition of WorkFileUsagePerQuery was not make public. A
      forward declaration was placed in the workfile_mgr.h file but it
      suffered from a redefinition warning (in clang at least):
      
      workfile_mgr.c:93:3: warning: redefinition of typedef
      					 'WorkFileUsagePerQuery' is a C11 feature
      					 [-Wtypedef-redefinition]
      } WorkFileUsagePerQuery;
        ^
      ../../../../src/include/utils/workfile_mgr.h:25:38:
      					note: previous definition is here
      typedef struct WorkFileUsagePerQuery WorkFileUsagePerQuery;
                                           ^
      Fix by moving the WorkFileUsagePerQuery definition to the header
      from which is moved in f1ef3668. If we expose an API which
      returns data in the struct we need to also make the definition
      available to callers.
      Reviewed-by: NGeorgios Kokolatos <gkokolatos@pivotal.io>
      Reviewed-by: NTeng Zhang <tezhang@pivotal.io>
      f34a7642
    • D
      Error out on out of memory in resource queue handling · c3f843cc
      Daniel Gustafsson 提交于
      If ResQueueHashNew() returns NULL it means that the processing ran
      out of memory and we need to error out. This is a situation which
      clearly can happen in production, so we need to upgrade the assert
      to a runtime check which properly errors out instead of fail on a
      subsequent NULL pointer dereference.
      Reviewed-by: NGeorgios Kokolatos <gkokolatos@pivotal.io>
      c3f843cc
    • D
      add tests for partitioned indexes and internal auto · 948bdb30
      David Krieger 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      For the partitioned index PR#7047, we add tests for the use of internal
      auto dependencies in both the existing index-backed constraints and in
      standalone partitioned indexes.
      Co-authored-by: NMark Sliva <msliva@pivotal.io>
      948bdb30
    • T
      Fix tests after adding Add AttachPartitionEnsureIndexes · e229290b
      Taylor Vesely 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      AttachPartitionEnsureIndexes iterates through all the indexes on an
      incoming partition and adds INTERNAL_AUTO dependencies to the ones match
      the definition of the parent partition's partitioned indexes.
      
      These are all the tests that broke when we started exchanging/testing
      for regular indexes on partitioned tables.
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      e229290b
    • T
      Fix failing tests after implementing recursive index drop · 2479d566
      Taylor Vesely 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      After adding INTERNAL_AUTO, and dependencies between partitioned indexs,
      many tests that assumed that we need to manually delete indexes added to
      leaf partitions need updating.
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      2479d566
    • D
      Add regress tests for index and constraint naming · a3d17a98
      David Krieger 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      Tests were added to verify:
       - Index backed constraint names have matching index name
       - Constraints on partition tables including ADD PARTITION and EXCHANGE
         PARTITION.
       - Constraints and indexes can be upgraded. This includes testing directly in
         pg_regress, or creating tables to be used by pg_upgrade.
      Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      Co-authored-by: NJesse Zhang <sbjesse@gmail.com>
      a3d17a98
    • T
      Fix altconname related tests · 62449ea4
      Taylor Vesely 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      Constraint names must now match their index. Fix ICW tests where this
      assumption no longer holds.
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      62449ea4
    • T
      Prevent check constraint drop on leaf partitions · ac12504d
      Taylor Vesely 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      Don't allow check constraints to be dropped on partition leaves. Only
      allow them to be dropped from the root.
      
      This restriction had been relaxed on PRIMARY KEY and UNIQUE constraints
      after adding INTERNAL_AUTO dependencies to constraints. However, we need
      to maintain the restiction on check constrants because they are
      currently not being protected by pg_depend.
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      ac12504d
    • T
      Update exchange/split partition for partitioned indexes · f7971a6a
      Taylor Vesely 提交于
      This commit is part of Add Partitioned Indexes #7047.
      
      During exchange and split partition update the pg_depend relationships and
      exchange constraint names.
      
      AttachPartitionEnsureIndexes was cherry-picked from:
      commit 8b08f7d4
      Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
      Date:   Fri Jan 19 11:49:22 2018 -0300
      
          Local partitioned indexes
      
          When CREATE INDEX is run on a partitioned table, create catalog entries
          for an index on the partitioned table (which is just a placeholder since
          the table proper has no data of its own), and recurse to create actual
          indexes on the existing partitions; create them in future partitions
          also.
      
          As a convenience gadget, if the new index definition matches some
          existing index in partitions, these are picked up and used instead of
          creating new ones.  Whichever way these indexes come about, they become
          attached to the index on the parent table and are dropped alongside it,
          and cannot be dropped on isolation unless they are detached first.
      
          To support pg_dump'ing these indexes, add commands
              CREATE INDEX ON ONLY <table>
          (which creates the index on the parent partitioned table, without
          recursing) and
              ALTER INDEX ATTACH PARTITION
          (which is used after the indexes have been created individually on each
          partition, to attach them to the parent index).  These reconstruct prior
          database state exactly.
      
          Reviewed-by: (in alphabetical order) Peter Eisentraut, Robert Haas, Amit
                  Langote, Jesper Pedersen, Simon Riggs, David Rowley
          Discussion: https://postgr.es/m/20171113170646.gzweigyrgg6pwsg4@alvherre.pgsqlCo-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      f7971a6a
    • T
      Add Partitioned Indexes · 9d40d472
      Taylor Vesely 提交于
      This commit adds partitioned indexes from upstream Postgres. This commit is
      mostly cherry-picked from Postgres 11 and bug fixes from Postgres 12.
      
      Differences from upstream:
       - Postgres has two additional relkind's - RELKIND_PARTITIONED_TABLE and
         RELKIND_PARTITIONED_INDEX, which have no on disk storage. Greenplum does not
         have these additional relkinds. Thus, partitioned indexes have physical
         storage.
       - CREATE INDEX ON ONLY <table> DDL has not yet been implemented
       - ALTER INDEX ATTACH PARTITION DDL has not yet been implemented
      
      Constraint changes:
       - Constraints and their backing index have the same names. Thus, partitions of
         a table no longer share the same constraint name, and are instead related to
         their parent via INTERNAL_AUTO dependencies.
      
      Index changes:
       - Child partition indexes can no longer be directly dropped, and must be
         dropped from their root. This includes mid-level and leaf indexes.
       - Adding indexes to mid-level partitions cascade to their children.
      
      These changes are mostly cherry-picked from:
      commit 8b08f7d4
      Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
      Date:   Fri Jan 19 11:49:22 2018 -0300
      
          Local partitioned indexes
      
          When CREATE INDEX is run on a partitioned table, create catalog entries
          for an index on the partitioned table (which is just a placeholder since
          the table proper has no data of its own), and recurse to create actual
          indexes on the existing partitions; create them in future partitions
          also.
      
          As a convenience gadget, if the new index definition matches some
          existing index in partitions, these are picked up and used instead of
          creating new ones.  Whichever way these indexes come about, they become
          attached to the index on the parent table and are dropped alongside it,
          and cannot be dropped on isolation unless they are detached first.
      
          To support pg_dump'ing these indexes, add commands
              CREATE INDEX ON ONLY <table>
          (which creates the index on the parent partitioned table, without
          recursing) and
              ALTER INDEX ATTACH PARTITION
          (which is used after the indexes have been created individually on each
          partition, to attach them to the parent index).  These reconstruct prior
          database state exactly.
      
          Reviewed-by: (in alphabetical order) Peter Eisentraut, Robert Haas, Amit
                  Langote, Jesper Pedersen, Simon Riggs, David Rowley
          Discussion: https://postgr.es/m/20171113170646.gzweigyrgg6pwsg4@alvherre.pgsql
      
      Changes were also cherry-picked from the following Postgres commits:
        eb7ed3f3 - Allow UNIQUE indexes on partitioned tables
        ae366aa5 - Detach constraints when partitions are detached
        19184fcc - Simplify coding to detach constraints when detaching partition
        c7d43c4d - Correct attach/detach logic for FKs in partitions
        17f206fb - Set pg_class.relhassubclass for partitioned indexes
      Co-authored-by: NKalen Krempely <kkrempely@pivotal.io>
      9d40d472
    • H
      Bump ORCA version to 3.29.0, updating ICG expected files · 258a4927
      Hans Zeller 提交于
      * Bump ORCA version to 3.29.0
      
      * ORCA: Updating subquery plans in ICG expected files
      
      This change is needed for ORCA PR https://github.com/greenplum-db/gporca/pull/449.
      Some subquery plans changed in minor ways in the ICG test.
      Co-authored-by: NChris Hajas <chajas@pivotal.io>
      258a4927
    • J
      ALTER TABLE SET DISTRIBUTED RANDOMLY should check for primary key or unique index · c55fe2d6
      Jimmy Yih 提交于
      Currently, a randomly distributed table cannot be created with a
      primary key or unique index. We should put this restriction for ALTER
      TABLE SET DISTRIBUTED RANDOMLY as well. This was caught by gpcheckcat
      distribution_policy check.
      Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
      c55fe2d6
    • J
      Make relationHasUniqueIndex() an extern function · ea7096f1
      Jimmy Yih 提交于
      The Greenplum-specific relationHasUniqueIndex() function is similar to
      the already existing relationHasPrimaryKey() function. We should make
      it available for extern use, and put them closer since they could be
      used together sometimes.
      Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
      ea7096f1
  4. 11 3月, 2019 3 次提交