1. 09 8月, 2017 10 次提交
  2. 08 8月, 2017 3 次提交
  3. 05 8月, 2017 3 次提交
    • A
      XLOG_HINT integration with persistent table (PT) · a21da89e
      Ashwin Agrawal 提交于
      We add the PT information in addition to the backup block for proper recovery.
      In this case, during XLog redo, the blocks of the dropped tables will not be
      restored after consulting PT.
      
      In order to fetch the PT information, we have to pass Relation to
      MarkBufferDirtyHint(). For that interface change, we refactored
      MarkBufferDirtyHint() with additional Relation parameter. The relation
      information is eventually passed to XLogSaveBufferForHint() to fetch the PT
      information when preparing the XLOG_HINT record.
      a21da89e
    • T
      Refactor checksumming code to make it easier to use externally. · bad76320
      Tom Lane 提交于
      pg_filedump and other external utility programs are likely to want to be
      able to check Postgres page checksums.  To avoid messy duplication of code,
      move the checksumming functionality into an exported header file, much as
      we did awhile back for the CRC code.
      
      In passing, get rid of an unportable assumption that a static char[] array
      will be word-aligned, and do some other minor code beautification.
      
      (cherry picked from commit f0421634)
      bad76320
    • S
      Introduce new page checksum algorithm and module. · 3fe41fe1
      Simon Riggs 提交于
      Isolate checksum calculation to its own module, so that bufpage
      knows little if anything about the details of the calculation.
      
      This implementation is a modified FNV-1a hash checksum, details
      of which are given in the new checksum.c header comments.
      
      Basic implementation only, so we fix the output value.
      
      Later related commits will add version numbers to pg_control,
      compiler optimization flags and memory barriers.
      
      Ants Aasma, reviewed by Jeff Davis and Simon Riggs
      
      (cherry picked from commit 43e7a668)
      3fe41fe1
  4. 03 8月, 2017 4 次提交
    • N
      Fix resource group memory overuse issue when increasing concurrency. · 94a08704
      Ning Yu 提交于
      Resource group may have memory overuse in below case:
      
      	CREATE RESOURCE GROUP rg_concurrency_test WITH
      	(concurrency=1, cpu_rate_limit=20, memory_limit=60,
      	 memory_shared_quota=0, memory_spill_ratio=10);
      	CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test;
      
      	11:SET ROLE role_concurrency_test;
      	11:BEGIN;
      
      	21:SET ROLE role_concurrency_test;
      	22:SET ROLE role_concurrency_test;
      	21&:BEGIN;
      	22&:BEGIN;
      
      	ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2;
      
      	11:END;
      
      The cause is that we didn't check overall memory quota usage in the
      past, so pending queries can be waken up as long as the concurrency
      limit is not reached, in such a case if the currently running tranctions
      have used all the memory quota in the resource group then the overall
      memory usage will be exceeded.
      
      To fix this issue we now checks both concurrency limit and memory quota
      usage to decide whether to wake up pending queries.
      Signed-off-by: NZhenghua Lyu <zlv@pivotal.io>
      94a08704
    • X
      Add checksum verification on mirror of filerep resync · 51ff21af
      Xin Zhang 提交于
      Validate every BufferPool page sent to the mirror by the
      primary prior to writing.
      Signed-off-by: NTaylor Vesely <tvesely@pivotal.io>
      51ff21af
    • S
      Allow I/O reliability checks using 16-bit checksums · ed0efd2a
      Simon Riggs 提交于
      Checksums are set immediately prior to flush out of shared buffers
      and checked when pages are read in again. Hint bit setting will
      require full page write when block is dirtied, which causes various
      infrastructure changes. Extensive comments, docs and README.
      
      WARNING message thrown if checksum fails on non-all zeroes page;
      ERROR thrown but can be disabled with ignore_checksum_failure = on.
      
      Feature enabled by an initdb option, since transition from option off
      to option on is long and complex and has not yet been implemented.
      Default is not to use checksums.
      
      Checksum used is WAL CRC-32 truncated to 16-bits.
      
      Simon Riggs, Jeff Davis, Greg Smith
      Wide input and assistance from many community members. Thank you.
      
      (cherry picked from commit 96ef3b8f)
      ed0efd2a
    • S
      Remove PageSetTLI and rename pd_tli to pd_checksum · 626df6b4
      Simon Riggs 提交于
      Remove use of PageSetTLI() from all page manipulation functions
      and adjust README to indicate change in the way we make changes
      to pages. Repurpose those bytes into the pd_checksum field and
      explain how that works in comments about page header.
      
      Refactoring ahead of actual feature patch which would make use
      of the checksum field, arriving later.
      
      Jeff Davis, with comments and doc changes by Simon Riggs
      Direction suggested by Robert Haas; many others providing
      review comments.
      
      (cherry picked from bb7cc262)
      626df6b4
  5. 02 8月, 2017 1 次提交
    • R
      Make memory spill in resource group take effect · 68babac4
      Richard Guo 提交于
      Resource group memory spill is similar to 'statement_mem' in
      resource queue, the difference is memory spill is calculated
      according to the memory quota of the resource group.
      
      The related GUCs, variables and functions shared by both resource
      queue and resource group are moved to the namespace resource manager.
      
      Also codes of resource queue relating to memory policy are refactored in this commit.
      Signed-off-by: NPengzhou Tang <ptang@pivotal.io>
      Signed-off-by: NNing Yu <nyu@pivotal.io>
      68babac4
  6. 31 7月, 2017 1 次提交
    • M
      Implement "COPY ... FROM ... ON SEGMENT' · e254287e
      Ming LI 提交于
      Support COPY statement that imports the data file on segments directly
      parallel. It could be used to import data files generated by "COPY ...
      to ... ON SEGMENT'.
      
      This commit also supports all kinds of data file formats which "COPY ...
      TO" supports, processes reject limit numbers and logs errors accordingly.
      
      Key workflow:
         a) For COPY FROM, nothing changed by this commit, dispatch modified
         COPY command to segments at first, then read data file on master, and
         dispatch the data to relevant segment to process.
      
         b) For COPY FROM ON SEGMENT, on QD, read dummy data file, other parts
         keep unchanged, on QE, process the data stream (empty) dispatched
         from QD at first, then re-do the same workflow to read and process
         the local segment data file.
      Signed-off-by: NMing LI <mli@pivotal.io>
      Signed-off-by: NAdam Lee <ali@pivotal.io>
      Signed-off-by: NHaozhou Wang <hawang@pivotal.io>
      Signed-off-by: NXiaoran Wang <xiwang@pivotal.io>
      e254287e
  7. 27 7月, 2017 1 次提交
    • A
      Make SQL based fault injection function available to all tests. · b23680d6
      Asim R P 提交于
      The function gp_inject_fault() was defined in a test specific contrib module
      (src/test/dtm).  It is moved to a dedicated contrib module gp_inject_fault.
      All tests can now make use of it.  Two pg_regress tests (dispatch and cursor)
      are modified to demonstrate the usage.  The function is modified so that it can
      inject fault in any segment, specified by dbid.  No more invoking
      gpfaultinjector python script from SQL files.
      
      The new module is integrated into top level build so that it is included in
      make and make install.
      b23680d6
  8. 25 7月, 2017 1 次提交
    • N
      Fix resgroup ICW failures · 4165a543
      Ning Yu 提交于
      * Fix the resgroup assert failure on CREATE INDEX CONCURRENTLY syntax.
      
      When resgroup is enabled an assertion failure will be encountered with
      below case:
      
          SET gp_create_index_concurrently TO true;
          DROP TABLE IF EXISTS concur_heap;
          CREATE TABLE concur_heap (f1 text, f2 text, dk text) distributed by (dk);
          CREATE INDEX CONCURRENTLY concur_index1 ON concur_heap(f2,f1);
      
      The root cause is that we had the assumption on QD that a command is
      dispatched to QEs when assigned to a resgroup, but this is false with
      CREATE INDEX CONCURRENTLY syntax.
      
      To fix it we have to make necessary check and cleanup on QEs.
      
      * Do not assign a resource group in SIGUSR1 handler.
      
      When assigning a resource group on master it might call WaitLatch() to
      wait for a free slot. However as WaitLatch() expects to be waken by the
      SIGUSR1 signal, it will run into endless waiting when SIGUSR1 is
      blocked.
      
      One scenario is the catch up handler. Catch up handler is triggered and
      executed directly in the SIGUSR1 handler, so during its execution
      SIGUSR1 is blocked. And as catch up handler will begin a transaction so
      it will try to assign a resource group and trigger the endless waiting.
      
      To fix this we add the check to not assign a resource group when running
      inside the SIGUSR1 handler. As signal handlers are supposed to be light
      and short and safe, so skip resource group in such a case shall be
      reasonable.
      4165a543
  9. 24 7月, 2017 1 次提交
    • X
      Use non-blocking recv() in internal_cancel() · 23e5a5ee
      xiong-gang 提交于
      The issue of hanging on recv() in internal_cancel() are reported
      serveral times, the socket status is shown 'ESTABLISHED' on master,
      while the peer process on the segment has already exit. We are not
      sure how exactly dose this happen, but we are able to simulate this
      hang issue by dropping packet or reboot the system on the segment.
      
      This patch use poll() to do non-blocking recv() in internal_cancel();
      the timeout of poll() is set to the max value of authentication_timeout
      to make sure the process on segment has already exit before attempting
      another retry; and we expect retry on connect() can detect network issue.
      Signed-off-by: NNing Yu <nyu@pivotal.io>
      23e5a5ee
  10. 22 7月, 2017 2 次提交
  11. 21 7月, 2017 1 次提交
    • J
      Improve partition selection logging (#2796) · 038aa959
      Jesse Zhang 提交于
      Partition Selection is the process of determining at runtime ("execution
      time") which leaf partitions we can skip scanning. Three types of Scan
      operators benefit from partition selection: DynamicTableScan,
      DynamicIndexScan, and BitmapTableScan.
      
      Currently, there is a minimal amount of logging about what partitions
      are selected, but they are scattered between DynamicIndexScan and
      DynamicTableScan (and so we missed BitmapTableScan).
      
      This commit moves the logging into the PartitionSelector operator
      itself, when it exhausts its inputs. This also brings the nice side
      effect of more granular information: the log now attributes the
      partition selection to individual partition selectors.
      038aa959
  12. 19 7月, 2017 1 次提交
    • B
      [#147774653] Implemented ValuesScan Operator in ORCA · 819107b7
      Bhuvnesh Chaudhary 提交于
      This commit introduces a new operator for ValuesScan, earlier we
      generated `UNION ALL` for cases where VALUES lists passed are all
      constants, but now a new Operator CLogicalConstTable with an array of
      const tuples will be generated
      
      Once the plan is generated by ORCA, it will be translated to valuesscan
      node in GPDB.
      
      This enhancement helps significantly in improving the total run time for the queries
      involving values scan in ORCA with const values.
      Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
      819107b7
  13. 18 7月, 2017 1 次提交
  14. 15 7月, 2017 1 次提交
    • H
      Remove PartOidExpr, it's not used in GPDB. (#2481) · 941327cd
      Heikki Linnakangas 提交于
      * Remove PartOidExpr, it's not used in GPDB.
      
      The target lists of DML nodes that ORCA generates includes a column for the
      target partition OID. It can then be referenced by PartOidExprs. ORCA uses
      these to allow sorting the tuples by partition, before inserting them to the
      underlying table. That feature is used by HAWQ, where grouping tuples that
      go to the same output partition is cheaper.
      
      Since commit adfad608, which removed the gp_parquet_insert_sort GUC, we
      don't do that in GPDB, however. GPDB can hold multiple result relations open
      at the same time, so there is no performance benefit to grouping the tuples
      first (or at least not enough benefit to counterbalance the cost of a sort).
      
      So remove the now unused support for PartOidExpr in the executor.
      
      * Bump ORCA version to 2.37
      Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
      
      * Removed acceptedLeaf
      Signed-off-by: NEkta Khanna <ekhanna@pivotal.io>
      941327cd
  15. 14 7月, 2017 2 次提交
    • J
      During replay of AO XLOG records, keep track of missing AO/AOCO segment files · b659d047
      Jimmy Yih 提交于
      When a standby is shut down and restarted, WAL recovery starts from
      the last restartpoint. If we replay an AO write record which has a
      following drop record, the WAL replay of the AO write record will find
      that the segment file does not exist. To fix this, we piggyback on top
      of the heap solution of tracking invalid pages in the invalid_page_tab
      hash table. The hash table key struct uses a block number which, for
      AO's sake, we pretend is the segment file number for AO/AOCO
      tables. This solution will be revisited to possibly create a separate
      hash table for AO/AOCO tables with a proper key struct.
      
      Big thanks to Heikki for pointing out the issue.
      b659d047
    • A
      Replay of AO XLOG records · cc9131ba
      Ashwin Agrawal 提交于
      We generate AO XLOG records when --enable-segwalrep is configured. We
      should now replay those records on the mirror or during recovery. The
      replay is only performed for standby mode since promotion will not
      execute until after there are no more XLOG records to read from the
      WAL stream.
      cc9131ba
  16. 13 7月, 2017 3 次提交
    • D
      Remove unreachable and unused code (#2611) · f4e50a64
      Daniel Gustafsson 提交于
      This removes code which is either unreachable due to prior identical
      tests which break the codepath, or which is dead due to always being
      true. Asserting that an unsigned integer is >= 0 will always be true,
      so it's pointless.
      
      Per "logically dead code" gripes by Coverity
      f4e50a64
    • A
      Use block number instead of LSN to batch changed blocks in filerep · abe13c79
      Asim R P 提交于
      Filerep resync logic to fetch changed blocks from changetracking (CT)
      log is changed.  LSN is no longer used to filter out blocks from CT
      log.  If a relation's changed blocks falls above the threshold number
      of blocks that can be fetched at a time, the last fetched block number
      is remembered and used to form subsequent batch.
      abe13c79
    • A
      Add GUC to control number of blocks that a resync worker operates on · 2960bd7c
      Asim R P 提交于
      The GUC gp_changetracking_max_rows replaces a compile time constant.  Resync
      worker obtains at the most gp_changetracking_max_rows number of changed blocks
      from changetracking log at one time.  Controling this with a GUC allows
      exploiting bugs in resync logic around this area.
      2960bd7c
  17. 11 7月, 2017 4 次提交
    • H
      Speed up simple queries on AOCS tables, when only a few columns are needed. · 3c40df0a
      Heikki Linnakangas 提交于
      If you have a query like "SELECT COUNT(col1) FROM wide_table", where the
      table has dozens of columns, the overhead in aocs_getnext() just to figure
      out which columns need to be fetched becomes noticeable. Optimize it.
      3c40df0a
    • H
      Turn a couple of hazardous macros into inline functions. · 2395d803
      Heikki Linnakangas 提交于
      In aocsam.c, there's a block of code that does:
      
          if (...)
          {
              AOTupleIdInit_rowNum(...);
          }
          else
          {
              AOTupleIdInit_rowNum(...);
          }
      
      While hacking, I removed the seemingly unnecessary braces, turning that
      into just:
      
          if (...)
              AOTupleIdInit_rowNum(...);
          else
              AOTupleIdInit_rowNum(...);
      
      But then I got a compiler error, about 'else' without 'if'. I was baffled
      for a moment, until I looked at the definition of AOTupleIdInit_rowNum. The
      way it includes curly braces makes it not work in an if-else construct like
      above. These macros also have double-evaluation hazards.
      
      To make this more robust, turn the macros into static inline functions.
      Inline functions generally behave more sanely and are more readable than
      macros.
      2395d803
    • H
      Remove unused field. · 781ff5b7
      Heikki Linnakangas 提交于
      This does mean that we don't free the array quite as quickly as we used to,
      but it's a drop in the sea. The array is very small, there are much bigger
      data structures involved in evey AOCS scan that are not freed as quickly,
      and it's freed at the end of the query in any case.
      781ff5b7
    • H
      Add missing prototypes to silence compiler warnings. · 99c30c58
      Heikki Linnakangas 提交于
      Commit fa6c2d43 added two functions, but forgot to add prototypes for
      them.
      99c30c58