1. 10 1月, 2019 9 次提交
    • M
      Resolve FIXME for validatepart by passing relpersistence of root · 263355cf
      Melanie Plageman 提交于
      MergeAttributes was used in atpxPart_validate_spec to get the schema and
      constraints to make a new leaf partition as part of ADD or SPLIT
      PARTITION. It was likely used as a convenience, since it already
      existed, and seems like the wrong function for the job.
      
      Previously atpxPart_validate_spec simply hard-coded in false for the relation
      persistence since the parameter was simply `isTemp`. Once the options
      for relation persistence were expanded to included unlogged, this
      paramter was changed to take a relpersistence. In MergeAttributes, for
      the part which we actually hit when calling it from here (we pass in the
      schema as NIL and therefore hit only half of the MergeAttributes code)
      the `supers` parameter is actually that of the parent partition and
      includes relpersistence, so, by passing in the relpersistence of the
      parent as relpersistence here, the checks we do around relpersistence are
      redundant because we are comparing the parent's relpersistence to its
      own. However, because, currently, this function is only called when we
      are making a new relation that, because we don't allow a different
      persistence to be specified for the child would actually just be using
      the relpersistence of the parent anyway, by passing it in hard-coded we
      would actually be incorrectly assuming that we are creating a permanent
      relation always.
      
      Since MergeAttributes was overkill, we wrote a new helper
      function, SetSchemaAndConstraints, to get the schema and constraints of
      a relation. This function doesn't do very many special validation checks
      that may be required by callers when using it in the context of
      partition tables (so user beware), however, it is probably only useful
      in the context of partition tables because it assumes constraints will
      be cooked, which, wouldn't be the case for all relations.
      We split it into two smaller inline functions for clarity. We also felt
      this would be a useful helper function in general, so we extern'd it.
      
      This commit also sets the relpersistence that is used to make the leaf
      partition when adding a new partition or splitting an existing a partition.
      
      makeRangeVar is a function from upstream which is basically a
      constructor. It sets relpersistence in the RangeVar to a hard-coded
      value of RELPERSISTENCE_PERMANENT. However, because we use the root
      partition to get the constraints and column information for the new
      leaf, after we use the default construction of the RangeVar, we need to
      set the relpersistence to that of the parent.
      
      This commit specifically only sets it back for the case in which we are
      adding a partition with `ADD PARTITION` or through `SPLIT PARTITION`.
      
      Without this commit, a leaf partition of an unlogged table created
      through `ADD PARTITION` or `SPLIT PARTITION` would incorrectly have its
      relpersistence set to permanent.
      Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
      Co-authored-by: NMelanie Plageman <mplageman@pivotal.io>
      263355cf
    • A
      Fix unit test failure for gp_replication_test. · 3267a548
      Ashwin Agrawal 提交于
      3267a548
    • A
      df97fc50
    • T
      gp_replica_check: Ignore status check unless it is_for_gp_walreciever · 6fb27ca7
      Taylor Vesely 提交于
      The WalSndCtl can have status information for non-mirror walsender
      connections, i.e. pg_basebackup connections. Ignore them.
      Co-authored-by: NAshwin Agrawal <aagrawal@pivotal.io>
      6fb27ca7
    • A
      Make GetMirrorStatus more intelligent · e03a755a
      Asim R P 提交于
      Now that we allow multipl WanSnd objects, FTS probes need to recognize
      the WalSnd object corresponding to the mirror.  This is achieved by
      defining Greenplum-specific application name "gp_replication".  The
      mirrors use this application name as a connection parameter.  Any
      other replication connections (backup and log streamer connections
      initiated by pg_basebackup) do not use this application name.
      
      Log streamer replication connection initiated by pg_basebackup should
      NOT use Grenplum-specific application name.
      Co-authored-by: NDavid Kimura <dkimura@pivotal.io>
      Co-authored-by: NAdam Berlin <aberlin@pivotal.io>
      Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
      e03a755a
    • A
      Initialize cluster with primary/mirror replication slots. · 06e7bf32
      Adam Berlin 提交于
      This replication slot is used for WAL replication between primary and
      mirror segments, and also master and standby.  The replication slot is
      created when a mirror / standby segment is initialized using
      pg_basebackup.  The replication slot is used by primary to keep track
      of the WAL flush location reported by the mirror.  When the mirror
      disconnects, it allows the primary to retain enough WAL so that the
      mirror can catchup after reconnecting in future.
      
      - defaults max_wal_senders to 10 to allow for basebackup to spin up
      senders matching upstream
      - defaults max_replication_slots to 10 instead of 0
      - changes gp_basebackup to create a replication slot when a slot name is
      provided during gpinitsystem
      - changes gp_basebackup to use streaming replication during gpinitsystem
      - creates and uses replication slot during full recovery
      
      Note: We intend to reason more deeply with the default guc settings in
      a later feature.
      Co-authored-by: NDavid Kimura <dkimura@pivotal.io>
      Co-authored-by: NAsim R P <apraveen@pivotal.io>
      06e7bf32
    • P
      pg_basebackup: Add --slot option · 0d1b5de6
      Peter Eisentraut 提交于
      This option specifies a replication slot for WAL streaming (-X stream),
      so that there can be continuous replication slot use between WAL
      streaming during the base backup and the start of regular streaming
      replication.
      Reviewed-by: NMichael Paquier <michael.paquier@gmail.com>
      0d1b5de6
    • Z
      Remove the distributed log on new segments · 68536097
      ZhangJackey 提交于
      df19119c eliminate distributed transaction log creation
      and maintenance on QD (Only a 32K `pg_distributedlog/0000`
       file exists). Gpexpand will copy data files from
      QD to new segments, So in the new segments the oldestXID
       is 3 (loaded from pg_controlfile which copied from QD).
      
      After new segments join the cluster, they will maintain the
      oldestXmin, so it will loop to find the page which is in the
      distributed transaction log.
      
      If the local transaction ID (xid) is huge on new segments, it will
      lead to a hole between 0000 and TransactionIdToPage(xid),
      then an error will be raised.
      
      In this commit we truncate the distributedlog with cutoff of oldestxid
      on new segments,  then the hole is gone, so the oldestXmin will be
      initialized to oldestLocalXmin.
      68536097
    • G
      Update instructions in README.docker.md · f3807f13
      gshaw-pivotal 提交于
      - Include how to make Greenplum within docker accessible to SQL editors
        running on the local machine (outside of docker).
      - Update the pip install command so that psutil and lockfile are
        accessible when the make cluster command is executed.
      f3807f13
  2. 09 1月, 2019 15 次提交
    • G
    • H
      Fix assertion failure in join planning. · 22288e8d
      Heikki Linnakangas 提交于
      cdbpath_motion_for_join() was sometimes returning an incorrect locus for a
      join between SingleQE and Hashed loci. This happened, when even the "last
      resort" strategy to move hashed side to the single QE failed. This can
      happen at least in the query that's added to the regression tests. The
      query involves a nested loop join path, when one side is a SingleQE locus
      and the other side is a Hashed locus, and there are no join predicates
      that can be used to determine the resulting locus.
      
      While we're at it, turn the Assertion that this tripped, and some related
      ones at the same place, into elog()s. No need to crash the whole server if
      the planner screws up, and it'd be good to perform these sanity checks in
      production, too.
      
      The failure of the "last resort" codepath was left unhandled by commit
      0522e960. Fixes https://github.com/greenplum-db/gpdb/issues/6643.
      Reviewed-by: NPaul Guo <pguo@pivotal.io>
      22288e8d
    • Y
      fix typo and indent (#6653) · 1ffc362e
      Yandong Yao 提交于
      1ffc362e
    • R
      Do not enforce join ordering for ANTI and LASJ. (#6625) · 29daab51
      Richard Guo 提交于
      The following identity holds true:
      
      	(A antijoin B on (Pab)) innerjoin C on (Pac)
          	= (A innerjoin C on (Pac)) antijoin B on (Pab)
      
      So we should not enforce join ordering for ANTI. Instead we need to
      collapse ANTI join nodes so that they participate fully in the join
      order search.
      
      For example:
      
      	select * from a join b on a.i = b.i where
      		not exists (select i from c where a.i = c.i);
      
      For this query, the origin join order is "(a innerjoin b) antijoin c". If
      we enforce ANTI join ordering, this will be the final join order. But
      another join order "(a antijoin c) innerjoin b" is also legal. We should
      take this order into consideration and pick a cheaper one.
      
      For LASJ, it is the same as ANTI joins.
      Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
      Reviewed-by: NMelanie Plageman <mplageman@pivotal.io>
      29daab51
    • A
      pg_rewind: parse bitmap wal records. · 161920e8
      Ashwin Agrawal 提交于
      Co-authored-by: NEkta Khanna <ekhanna@pivotal.io>
      161920e8
    • A
      pg_rewind: add test for bitmap wal records. · a6913d2f
      Ashwin Agrawal 提交于
      Co-authored-by: NEkta Khanna <ekhanna@pivotal.io>
      a6913d2f
    • A
      In maintenance_mode ignore distributed log. · 4eb48055
      Ashwin Agrawal 提交于
      With this commit the QE in maintenance mode will ignore the
      distributed log and just pretend like single instance postgres.
      
      Without this if starting QE as single instance only, no distributed
      snapshot is executed. Due to this distributed oldest xmin points to
      oldest datfrozen_xid in system. As a result, vacuum any table results
      in HEAP_TUPLE_RECENTLY_DEAD and avoids cleaning up dead rows.
      Co-authored-by: NEkta Khanna <ekhanna@pivotal.io>
      4eb48055
    • P
      Fix calculation of WorkfileMgrLock and WorkfileQuerySpaceLock · 1540eb1c
      Pengzhou Tang 提交于
      All lwlocks are stored in MainLWLockArray which is an array of
      LWLockPadded structures:
      
      typedef union LWLockPadded
      {
        LWLock lock;
        char pad[LWLOCK_PADDED_SIZE];
      } LWLockPadded;
      
      The calculation in SyncHTPartLockId to fetch a lwlock is
      incorrect because it offsets the array as an LWLock array.
      In current code base, it works fine because the size of
      LWLock happens to be 32, if structure LWLock get enlarged,
      the calculation will mess up.
      1540eb1c
    • P
      fix according to comments · a8c2f7c4
      Pengzhou Tang 提交于
      a8c2f7c4
    • P
      Dispatcher should use DISPATCH_WAIT_FINISH mode to wait QEs for init plans · b7bb5438
      Pengzhou Tang 提交于
      GPDB always set the REWIND flag for subplans include init plans, in 6195b967,
      we enhanced the restriction that if a node is not eager free, we cannot squelch
      a node earlier include init plans, this exposes a few hidden bugs: if init plan
      contains a motion node that needs to be squelched earlier, the whole query will
      get stuck in cdbdisp_checkDispatchResult() because some QEs are still keep
      sending tuples.
      
      To resolve this, we use DISPATCH_WAIT_FINISH mode for dispatcher to wait the
      dispatch results of init plan, init plan with motion is always executed on
      QD and should always be a SELECT-like plan, init plan must already fetched
      all the tuples it needed before dispatcher waiting for the QEs,
      DISPATCH_WAIT_FINISH is the right mode for init plan.
      b7bb5438
    • E
      bd7c4b1a
    • E
      Fix distributed snapshot xmax check. · 2b4674a4
      Ekta Khanna 提交于
      As part of commit dc78e56c, logic for distributed snapshot was modified
      to use latestCompletedDxid. This changed the logic from xmax being
      inclusive range to not inclusive for visible transactions in snapshot.
      Hence, updating the check to return
      DISTRIBUTEDSNAPSHOT_COMMITTED_INPROGRESS even for transaction id equal
      to global xmax now. Other way to fix is using latestCompletedDxid
      without +1 for xmax, but better is to keep logic similar to local
      snapshot check and not have xmax in inclusive range of visible
      transactions.
      
      This was exposed in CI by test
      isolation/results/heap-repeatable-read-vacuum-freeze failing
      intermittently.  This was due to isolation framework itself triggering
      query on pg_locks to check for deadlocks. This commit adds explicitely
      test to cover the scenario.
      Co-authored-by: NAshwin Agrawal <aagrawal@pivotal.io>
      2b4674a4
    • A
      Avoid calling CreateRestartPoint() from startup process. · 558c460e
      Ashwin Agrawal 提交于
      With commit 8a11bfff, aggressive restart point creation is not performed in gpdb
      as well. Since CreateRestartPoint() is not coded to be called from startup
      process, GPDB specific code exception was added in past to work correctly for
      previous aggressive restart point creations, calls to which could happen via
      startup process.
      
      Now given only when gp_replica_check is running restartpoint is created on
      checkpoint record, which should be done via checkpointer process. Eliminate any
      case of calling CreateRestartPoint() from startup process and thereby remove
      GPDB added exception to CreateRestartPoint() and align to upstream code.
      558c460e
    • H
      Make gptransfer test's output understandable to gpdiff. · c3b9d927
      Heikki Linnakangas 提交于
      The gptransfer behave test was using gpdiff to compare data between the
      source and target systems, and was relying on gpdiff to mask row order
      differences. However, after 1f44603a, gpdiff no longer recognized the
      results as psql result sets, because it did not echo the SELECT statements
      to the output. gpdiff expects to see those. Fix, by echoing the
      statements, like in pg_regress. That makes the output, if there are any
      differences, more readable anyway.
      
      While we're at it, change the gpdiff invocation to produce a unified diff.
      If the test fails, because there is a difference, that makes the output
      a lot more readable.
      c3b9d927
    • H
      Fix regression failure on "gpmapreduce --help". · f8035a33
      Heikki Linnakangas 提交于
      The test was using "-- ignore", to cause gpdiff to ignore any differences
      in the test output. But after commit 1f44603a, gpdiff doesn't consider
      the test's output as a psql result set anymore, so the "-- ignore" directive
      doesn't work anymore. Use the more common "-- start_ignore"/"-- end_ignore"
      block instead.
      
      (I'm not sure how useful the test is, if we don't check
      the output, but thats a different story.)
      f8035a33
  3. 08 1月, 2019 16 次提交