1. 10 7月, 2019 1 次提交
    • A
      Abort drop tablespace on error, delete files on commit. · 68c0ff2d
      Adam Berlin 提交于
      We add information to the TwoPhaseHeaderFile about which tablespace we're
      attempting to drop. We also schedule a tablespace for deletion (similar
      to CREATE TABLESPACE) on commit, which waits until the transaction
      is committed to perform the filesystem deletion. This follows the
      recommendation for relation files to be deleted after the commit to not
      spend time deleting files during the commit.
      
      We also modified the distributed_commit record to pass the tablespace to
      be dropped to the standby. And, we modified the abort record, to help
      back out of a drop on the mirrors.
      
      - Bump the catalog for the drop tablespace xlog changes.
      - Extracts hook functions to be implemented by separate components
      
      The tests skip FTS probes during the test run to avoid FTS taking a primary
      down that has a fault point injected into it.
      Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
      Co-authored-by: NSoumyadeep Chakraborty <sochakraborty@pivotal.io>
      Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
      68c0ff2d
  2. 09 7月, 2019 8 次提交
  3. 08 7月, 2019 3 次提交
    • J
      Remove dead command in Makefile · 0de48066
      Jesse Zhang 提交于
      In fact, if you manage to get an extra directory created, you can
      exercise the code being removed. It won't work anyway, with an error:
      
      > make[1]: Entering directory '/build/gpdb/gpcontrib'
      > make[1]: *** installcheck: No such file or directory.  Stop.
      > make[1]: Leaving directory '/build/gpdb/gpcontrib'
      > make: *** [Makefile:96: installcheck] Error 2
      
      This should have been deleted in commit ad6b920f as part of GPHDFS
      removal.
      0de48066
    • D
      docs: Fix typos · 78f97f33
      Daniel Gustafsson 提交于
      78f97f33
    • P
      Fix issue that GPDB auxiliary backend cannot start in QE · ce481261
      Pengzhou Tang 提交于
      background worker is not scheduled until distributed transactions
      are recovered if it needs to start at BgWorkerStart_RecoveryFinished
      or BgWorkerStart_ConsistentState because it's not safe to do a read
      or write if DTX is not recovered. GPDB is designed to do this check
      in master only, however Gp_role == GP_ROLE_DISPATCH is not a
      sufficient check for master.
      
      Spotted by Wang Hao <haowang@pivotal.io>
      ce481261
  4. 06 7月, 2019 2 次提交
    • S
    • S
      Refactor making databases 2PC and correct ALTER DATABASE SET TABLESPACE · b0208894
      Soumyadeep Chakraborty 提交于
      High-level details:
      1) Tear out existing 2PC infrastructure for databases
      2) Introduce new structures (in-mem, on-disk) for making databases 2PC
      3) Make sure ALTER DATABASE SET TABLESPACE (ADST) works correctly such
      that no orphaned files remain in the source/target tablespace
      directories in cases of commit/abort.
      4) We add the dboid dir to pendingDbDeletes for abort after copying
      dboid dir in movedb. This ensures that the dboid dir is cleaned up from
      the target tablespace when we have a failure during the course of
      execution of the ALTER.
      5) Re-engineer tests to assert filesystem changes and accommodate
      multiple failure scenarios during the course of a 2PC commit/abort.
      6) Introduce a new generic mechanism for making mirrors catch up. This
      is done by inserting a XLOG_XACT_NOOP record and then waiting for the
      mirror to replay the record with gp_inject_fault2. The premise is that
      if the mirror has replayed this latest record, it would have replayed
      everything before the NOOP record. We have introduced a UDF and a fault
      injection point to make this possible.
      7) Update pg_xlogdump to dump out pending DB deletes on commit/abort.
      
      Refactoring Notes:
      1) The xlog insert for database drops in `DropDatabaseDirectory`
      is no longer required since we are already WALing database drops
      elsewhere.
      2) `xact_get_distributed_info_from_commit` populated variables that were
      useful in the context of its only caller `xact_redo_distributed_commit`.
      If we keep it around there would be unnecessary code duplication -> thus
      deleting it.
      3) Use DropRelationFiles() instead of duplicating logic in
      xact_redo_distributed_commit.
      4) Refactor session-level lock release for the QD during movedb().
      5) smgr is a layer that pertains only to relations. So, we drop the
      smgr prefix for pending db delete functions.
      6) DropDatabaseDirectories() pertains to dropping dboid dirs at the
      filesystem level. This means that it belongs inside storage.h/c.
      DropDatabaseDirectories forms the visible interface as contrasted to
      DropDatabaseDirectory. So moved the latter and made it static.
      7) Rename DatabaseDropStorage to ScheduleDbDirDelete to call out its
      intent.
      8) Extract pending db deletes and dboid dir removal to dedicated file
      9) Tests for scenarios with and without faults now live in one
      consolidated file.
      Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
      Co-authored-by: NAdam Berlin <aberlin@pivotal.io>
      Co-authored-by: NJesse Zhang <jzhang@pivotal.io>
      b0208894
  5. 05 7月, 2019 3 次提交
    • G
      Protect against (un)intentional writes during Create External table transformations · b47df8d3
      Georgios Kokolatos 提交于
      It is possible, and does happen, that CreateExternalStmt will be written upon
      during transformations. The transformer functions are not explicit regarding
      ownership and some of them might (and do) invoke walkers that can (and do) write
      on the transformed statement. However, some callers of these functions, do pass
      arguments that should be concidered read only. Such an example is passing a
      CreateExternalStmt which belongs to, and taken from, a cached plan which will be
      correctly retained for subsequent executions.
      
      Create a short lived memory context in the transformCreateExternalStmt, which
      will additionaly protect against leaks in long expanding statments, and operate
      in a copy of the passed statement.
      Reviewed-by: NAsim R P <apraveen@pivotal.io>
      Reviewed-by: NBaiShaoqi <sbai@pivotal.io>
      b47df8d3
    • G
      Silence array-bounds warning. · c0ee8242
      Georgios Kokolatos 提交于
      The macro IS_FILL_WORD was generating a false positive array-bounds
      warning. Convting the macro into an inline function removes the warning
      without altering the essence of the code. The macro was always used within
      a conditional so it is unlikely to suffer performance penalties.
      c0ee8242
    • H
      Re-enable gppkg behave test for both centos and ubuntu (#8066) · af73aca6
      Hao Wu 提交于
      * Revert "CI: skip CLI behave tests that currently fail on ubuntu18.04"
      
      This reverts commit 6a0cb2c6.
      This commit is to re-enable behave test for centos/ubuntu
      
      * Ouput the same error message format
      
      gppkg for rpm and deb outputs error messages when consistency is broken, but
      the message is not the same, which make a pipeline fail.
      
      * Update gppkg for behave test and fix some minor error in gppkg
      
      Now, the binary sample.gppkg is removed, instead we add sample-*.rpm and sample-*.deb.
      Because sample.gppkg is platform specific and GP major version sensitive. The uploaded
      rpm/deb files are available unless the rpm/deb file is incompatible on the specific
      platform. GP_MAJORVERSION is dynamically retrieved from a makefile installed in the gpdb
      folder, so the gp major version in the gppkg will be always correct.
      sample.gppkg will only be generated when gppkg tag is provided
      af73aca6
  6. 04 7月, 2019 5 次提交
    • P
      Windows: change kerberos service name to postgres (#8060) · 903cb91c
      Peifeng Qiu 提交于
      The kerberos service name of gpdb and psql must match to allow proper
      kerberos authentication. For linux platform this is controlled by
      --with-krb-srvnam. For Windows platform it's hardcoded in template
      pg_config.h.win32. We currently build gpdb server without specifying
      --with-krb-srvnam, and the default value is "postgres". Change the
      correspond value that hardcoded Windows config template to "postgres"
      also.
      
      - Package necessary kerberos utility with windows installer
      - Add Kerberos auth test for Windows client
      903cb91c
    • X
      Change the size of interconnect connection hash table · e580dab8
      xiong-gang 提交于
      As discussed in #6932, the size of interconnect connection hash table is 16,
      which would be too small for large cluster and could bring too many hash table
      collisions. Set to (2 * number segments).
      e580dab8
    • P
      Sanity check update/delete to prevent potential data corruption when there are... · c9655e2d
      Paul Guo 提交于
      Sanity check update/delete to prevent potential data corruption when there are tuples with bad distribution. (#7304)
      
      Data being stored with bad distribution is not unusual in a real production
      environment. There could be issues if the ctid for update/delete is distributed
      to another segment. This patch will double check this and error out if needed.
      
      Reviewed-by: Jinbao Chen
      c9655e2d
    • T
      Converting FTS, GDD, DTX Recovery to background workers (#7364) · bfd1f46c
      Tang Pengzhou 提交于
      * extend background worker framework for old auxiliary process
      
      GPDB used to have its own framework to manage its auxiliary processes like FTS,
      GDD, DtxRecovery, Perfmon, Backoff, etc.
      
      This old framework a few defects:
      1. GPDB only, different concept and make code different from upstream in many places.
      2. Not easy enough to add a new type of auxiliary process although it has tried
         to reduce the complex, but still lots of additional code needed out of core feature.
      3. not clear for backend initialization and many duplicated code.
      4. not clear for the components/resource needed.
      5. using SIGUSR2 to shutdown which differs from upstream.
      6. special code for auxiliary in the workflow.
      
      Actually, the old framework is very similar to the background worker framework
      in upstream. Now we have bgworker feature merged, it's time to covert those GPDB
      processes to background worker now and take advantage of the background worker
      feature.
      
      To do this, we need to extend the background worker framework a little bit:
      1. extend bgw_start_time
       typedef enum
       {
      	/* can start if startup process is lunched*/
              BgWorkerStart_PostmasterStart,
      	/* can start basicly when it's saft to read (in GPDB, after DTX recovery is done) */
              BgWorkerStart_ConsistentState,
      	/* can start basicly when it's safe to read/write (in GPDB, after DTX recovery is done) */
              BgWorkerStart_RecoveryFinished
      +++     BgWorkerStart_DtxRecovering,
       } BgWorkerStartTime;
      
      A new type called BgWorkerStart_DtxRecovering which means a worker can be started
      after the startup process finished and before DTX recovery is done. This is
      important because DTX recovery process is also a bgworker now and it also need
      FTS prober once it hit an error.
      
      2. adding a bgw_start_rule
      Some auxiliary processes can only be launched in QD or only be lanuched when
      some GUCs are set. So users can provide a custom function to specify the rule
      to wether launch a bgworker or not.
      
      * move fts to bgworker
      * move gdd to background worker
      * move dtx recovery
      * move perfmon_segmentinfo to bg worker
      * move backoff to bgworker
      * move perfmon to bgworker
      Reviewed-by: NAsim R P <apraveen@pivotal.io>
      Reviewed-by: NHubert Zhang <hzhang@pivotal.io>
      bfd1f46c
    • D
      Fix COPY WITH OIDS · 5e5328aa
      David Kimura 提交于
      Issue is that COPY WITH OIDS requires an OID from the QD for tuple
      insert. However, in the case of multi-insert we don't yet have the
      multiple OIDs required from the QD. Simplest approach is to disable
      multi-insert on COPY WITH OIDS. A better solution may be to send a list
      of OIDS from the QD which QE would use in multi-insert.
      5e5328aa
  7. 03 7月, 2019 5 次提交
    • X
      Wait longer for gpfdist with ssl to start · 22b7db61
      Xiaoran Wang 提交于
      Sometimes gpfdist with ssl can not start
      in 30 seconds.
      22b7db61
    • D
      Add a mailmap file to the repository · 2c500cbd
      Daniel Gustafsson 提交于
      The mailmap file is used by Git to properly coalesce contributions which
      have been made by the same contributor with different email addresses or
      user names.
      
      Discussion: https://groups.google.com/a/greenplum.org/forum/#!topic/gpdb-dev/zxD4x6fis0E
      2c500cbd
    • A
      Clear exported snapshots before transaction ID is reset · 056125e0
      Asim R P 提交于
      Greenplum diverges from upstream PostgreSQL in abort transaction workflow.
      Greenplum must dispatch ABORT command to QEs.  Consequently, transaction ID in
      top transaction state is reset before broadcasting the ABORT.
      
      Exported snapshots are closely tied to the transaction that exported them.
      They must be cleared before the transaction that exported them ceases to exist.
      In order to abide by this sequence of operations, Greenplum must also clear
      exported snapshots before marking the transaction as invalid.  This patch moves
      the call to clear exported snapshots at a location that is right for Greenplum.
      
      Fixes Github issue #8020
      
      Reviewed-by: Georgios Kokolatos and Jimmy Yih
      056125e0
    • A
      Don't mark FDW or external table actions needing two phase commit · be7499de
      Adam Lee 提交于
      FDW or External table's INSERT actions are actually just some defined
      callbacks but not real heap table INSERT actions.
      
      Don't mark transactions doing write just because they insert into
      foreign or external tables, some FDW extensions report an error because
      they don't see XACT_EVENT_PRE_PREPARE coming.
      be7499de
    • A
      Dispatch GUC setting commands with parameters quoted · d71a0d6e
      Adam Lee 提交于
      ```
      SET "request.header.user-agent" = 'curl/7.29.0';
      ```
      
      The double quote characters are needed in the above command, but
      Greenplum lost them while dispatching, which reports syntax error.
      d71a0d6e
  8. 02 7月, 2019 10 次提交
  9. 01 7月, 2019 3 次提交
    • A
      Make CREATE TABLESPACE two-phase safe · 122c79f2
      Adam Berlin 提交于
      Modify TwoPhaseFileHeader to include a tablespace OID that needs to be
      removed if an abort occurs.
      
      We add a 'pending tablespace for deletion' that is scheduled during the
      'create tablespace' command. If a node encounters an error, it can abort
      using the in-memory value. The master then can send an ABORT PREPARED for all
      segments that have prepared the create tablespace.
      
      A successful 'create tablespace' needs to unschedule the deletion, or following
      aborted transactions will accidentally delete the newly created tablespace.
      
      XLOG records are written for the ABORT and ABORT_PREPARED of a transaction, and these records also
      now contain a tablespace oid for deletion.
      
      Notes:
      
      During CREATE TABLESPACE, if an error occurs after the XLOG_XACT_PREPARE
      record has been written, there should be no filesystem changes left
      on disk for any of the segments. (master, standby, primary, or mirror)
      
      If an error occurs after the XLOG_XACT_DISTRIBUTED_COMMIT, then the create
      tablespace should succeed, and all tablespace filesystem changes should exist.
      Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
      Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
      Co-authored-by: NSoumyadeep Chakraborty <sochakraborty@pivotal.io>
      122c79f2
    • D
      docs: fix typos in PXF documentation · 239d87e9
      Daniel Gustafsson 提交于
      239d87e9
    • X
      Run gpfdist_ssl test cases on windows · ae2a481a
      Xiaoran Wang 提交于
      * Add remote_regress folder in src/bin/gpfdist/
      to test gpfdist which runs on a remote host, such
      as a windows server. make installcheck_win can
      run them.
      
      * The scripts of start_gpfdist_remote_win
      are used to start and stop gpfdist runing on windows.
      If you want to test gpfdist on another os, such
      as aix, you can create a forlder named
      start_gpfdist_remote_aix and add some scripts
      to start and stop gpfdist.
      ae2a481a