1. 22 9月, 2017 1 次提交
  2. 21 9月, 2017 14 次提交
    • H
      Mask out differences in plperl.c line numbers in errors. · 8b153171
      Heikki Linnakangas 提交于
      Ideally, we would use proper error codes, or find some other way to prevent
      the useless "(plperl.c:2118)" from appearing in PL/perl errors. Later
      versions of PostgreSQL do that, so we'll get that eventually. In the
      meanwhile, silence errors caused by code movement in that file. Same as
      we had done for plperl's own tests already.
      8b153171
    • D
      Use autoconf for resolving PXF library dependency · 6f1ca717
      Daniel Gustafsson 提交于
      Leverage the core autoconf scaffolding for resolving the dependency
      on libcurl. Enabling PXF in autoconf now automatically adds libcurl
      as a dependency. Coupled with the recent commit which relaxes the
      curl version requirement on macOS, we can remove the library copying
      from the PXF makefile as well.
      6f1ca717
    • H
      Fix bug in handling re-scan of a hash join. · f7101d98
      Heikki Linnakangas 提交于
      The WITH RECURSIVE test case in 'join_gp' would miss some rows, if
      the hash algorithm (src/backend/access/hash/hashfunc.c) was replaced
      with the one from PostgreSQL 8.4, or if statement_mem was lowered from
      1000 kB to 700 kB. This is what happened:
      
      1. A tuple belongs to batch 0, and is kept in memory during processing
         batch 0.
      
      2. The outer scan finishes, and we spill the inner batch 0 from memory
         to a file, with SpillFirstBatch, and start processing tuple 1
      
      3. While processing batch 1, the number of batches is increased, and
         the tuple that belonged to batch 0, and was already written to the
         batch 0's file, is moved, to a later batch.
      
      4. After the first scan is complete, the hash join is re-scanned
      
      5. We reload the batch file 0 into memory. While reloading, we encounter
         the tuple that now doesn't seem to belong to batch 0, and throw it
         away.
      
      6. We perform the rest of the re-scan. We have missed any matches to the
         tuple that was thrown away. It was not part of the later batch files,
         because in the first pass, it was handled as part of batch 0. But in
         the re-scan, it was not handled as part of batch 0, because nbatch was
         now larger, so it didn't belong there.
      
      To fix, when reloading a batch file we see a tuple that actually belongs
      to a later batch file, we write it to that later file. To avoid adding
      it there multiple times, if the hash join is re-scanned multiple times,
      if any tuples are moved when reloading a batch file, destroy the batch
      file and re-create it with just the remaining tuples.
      
      This is made a bit complicated by the fact that BFZ temp files don't support
      appending to a file that's already been rewinded for reading. So what we
      actually do, is always re-create the batch file, even if there has been no
      changes to it. I left comments about that, Ideally, we would either support
      re-appending to BFZ files, or stopped using BFZ workfiles for this
      altogether (I'm not convinced they're any better than plain BufFiles). But
      that can be done later.
      
      Fixes github issue #3284
      f7101d98
    • H
      Don't double-count inner tuples reloaded from file. · 429ff8c4
      Heikki Linnakangas 提交于
      ExecHashTableInsert also increments the counter, so we don't need to do it
      here. This is harmless AFAICS, the counter isn't used for anything but
      instrumentation at the moment, but it confused me while debugging.
      429ff8c4
    • H
      Fix CURRENT OF to work with PL/pgSQL cursors. · 91411ac4
      Heikki Linnakangas 提交于
      It only worked for cursors declared with DECLARE CURSOR, before. You got
      an "there is no parameter $0" error if you tried. This moves the decision
      on whether a plan is "simply updatable", from the parser to the planner.
      Doing it in the parser was awkward, because we only want to do it for
      queries that are used in a cursor, and for SPI queries, we don't know it
      at that time yet.
      
      For some reason, the copy, out, read-functions of CurrentOfExpr were missing
      the cursor_param field. While we're at it, reorder the code to match
      upstream.
      
      This only makes the required changes to the Postgres planner. ORCA has never
      supported updatable cursors. In fact, it will fall back to the Postgres
      planner on any DECLARE CURSOR command, so that's why the existing tests
      have passed even with optimizer=off.
      91411ac4
    • H
      Remove now-unnecessary code from gp_read_error_log to dispatch the call. · 4035881e
      Heikki Linnakangas 提交于
      There was code in gp_read_error_log(), to "manually" dispatch the call to
      all the segments, if it was executed in the dispatcher. This was
      previously necessary, because even though the function was marked with
      prodataaccess='s', the planner did not guarantee that it's executed in the
      segments, when called in the targetlist like "SELECT
      gp_read_error_log('tab')". Now that we have the EXECUTE ON ALL SEGMENTS
      syntax, and are more rigorous about enforcing that in the planner, this
      hack is no longer required.
      4035881e
    • N
      Refactor resource group source code, part 2. · a2cf9bdf
      Ning Yu 提交于
      * resgroup: provide helper funcs for memory usage updates.
      
      We used to have complex and duplicate logic to update group & slot
      memory usage under different context, now we provide two helper
      functions to increase or decrease memory usage in group and slot.
      
      Two bad named functions `attachToSlot()` and `detachFromSlot()` are
      retired now.
      
      * resgroup: provide helper function to unassign a dropped resgroup.
      
      * resgroup: move complex checks into helper functions.
      
      Many helper functions were added with descriptive names to increase
      readability of lots of complex checks.
      
      Also added a pointer to resource group slot in self.
      
      * resgroup: add helper functions for wait queue operations.
      a2cf9bdf
    • A
      Fix aix7_ppc_64 making script · 15c04803
      Adam Lee 提交于
          $ make -j -s install
          ...
          --- subprocess32, Linux only
          /bin/sh: line 3: [: =: unary operator expected
          --- stream
          ...
          Greenplum Database installation complete.
      
      When `$(BLD_ARCH)` is empty, the check becomes `[ = 'aix7_ppc_64' ]`, and gets
      the unary operator expected error.
      15c04803
    • A
      Make gp_replication.conf for USE_SEGWALREP only. · b7ce6930
      Ashwin Agrawal 提交于
      The intend of this extra configuration file is to control the
      synchronization between primary and mirror for WALREP.
      
      The gp_replication.conf is not designed to work with filerep, for
      example, the scripts like gp_expand will fail since it directly modify
      the configuration files instead of going through initdb.
      Signed-off-by: NXin Zhang <xzhang@pivotal.io>
      b7ce6930
    • A
      d60e2389
    • L
    • H
      Take advantage of the new EXECUTE ON syntax in gp_toolkit. · 9a039e4f
      Heikki Linnakangas 提交于
      Also change a few regression tests to use the new syntax, instead of
      gp_toolkit's __gp_localid and __gp_masterid functions.
      9a039e4f
    • H
      Add support for CREATE FUNCTION EXECUTE ON [MASTER | ALL SEGMENTS] · aa148d2a
      Heikki Linnakangas 提交于
      We already had a hack for the EXECUTE ON ALL SEGMENTS case, by setting
      prodataaccess='s'. This exposes the functionality to users via DDL, and adds
      support for the EXECUTE ON MASTER case.
      
      There was discussion on gpdb-dev about also supporting ON MASTER AND ALL
      SEGMENTS, but that is not implemented yet. There is no handy "locus" in the
      planner to represent that. There was also discussion about making a
      gp_segment_id column implicitly available for functions, but that is also
      not implemented yet.
      
      The old behavior was that a function that if a function was marked as
      IMMUTABLE, it could be executed anywhere. Otherwise it was always executed
      on the master. For backwards-compatibility, this keeps that behavior for
      EXECUTE ON ANY (the default), so even if a function is marked as EXECUTE ON
      ANY, it will always be executed on the master unless it's IMMUTABLE.
      
      There is no support for these new options in ORCA. Using any ON MASTER or
      ON ALL SEGMENTS functions in a query cause ORCA to fall back. This is the
      same as with the prodataaccess='s' hack that this replaces, but now that it
      is more user-visible, it would be nice to teach ORCA about it.
      
      The new options are only supported for set-returning functions, because for
      a regular function marked as EXECUTE ON ALL SEGMENTS, it's not clear how
      the results should be combined. ON MASTER would probably be doable, but
      there's no need for that right now, so punt.
      
      Another restriction is that a function with ON ALL SEGMENTS or ON MASTER can
      only be used in the FROM clause, or in the target list of a simple SELECT
      with no FROM clause. So "SELECT func()" is accepted, but "SELECT func() FROM
      foo" is not. "SELECT * FROM func(), foo" works, however. EXECUTE ON ANY
      functions, which is the default, work the same as before.
      aa148d2a
    • B
      Fix multistage aggregation plan targetlists · 41640e69
      Bhuvnesh Chaudhary 提交于
      If there are aggregation queries with aliases same as the table actual
      columns and they are propagated further from subqueries and grouping is
      applied on the column alias it may result in inconsistent targetlists
      for aggregation plan causing crash.
      
      	CREATE TABLE t1 (a int) DISTRIBUTED RANDOMLY;
      	SELECT substr(a, 2) as a
      	FROM
      		(SELECT ('-'||a)::varchar as a
      			FROM (SELECT a FROM t1) t2
      		) t3
      	GROUP BY a;
      41640e69
  3. 20 9月, 2017 10 次提交
  4. 19 9月, 2017 8 次提交
  5. 18 9月, 2017 3 次提交
  6. 17 9月, 2017 2 次提交
    • H
      Convert WindowFrame to frameOptions + start + end · ebf9763c
      Heikki Linnakangas 提交于
      In GPDB, we have so far used a WindowFrame struct to represent the start
      and end window bound, in a ROWS/RANGE BETWEEN clause, while PostgreSQL
      uses the combination of  a frameOptions bitmask and start and end
      expressions. Refactor to replace the WindowFrame with the upstream
      representation.
      ebf9763c
    • H
      Hardcode the "frame maker" function for LEAD and LAG. · 686aab95
      Heikki Linnakangas 提交于
      This removes pg_window.winframemakerfunc column. It was only used for
      LEAD/LAG, and only in the Postgres planner. Hardcode the same special
      handling for LEAD/LAG in planwindow.c instead, based on winkind.
      
      This is one step in refactoring the planner and executor further, to
      replace the GPDB implementation of window functions with the upstream
      one.
      686aab95
  7. 16 9月, 2017 2 次提交
    • H
      Add check for hash partitioned tables in pg_upgrade. · 22072ec5
      Heikki Linnakangas 提交于
      I was about to add this as part of the PostgreSQL 8.4 merge, as a check
      when upgrading from 8.3 to 8.4, because the hash algorithm was changed
      in 8.4. However, turns out that pg_dump doesn't support hash partitioned
      tables at all, so pg_upgrade won't work on a database that contains any
      hash partitioned tables, even on a same-version upgrade. Hence, let's
      add this check unconditionally on all server versions.
      
      There are comments talking about the hash function change, because of that
      devleopment history. I think that's useful documentation, just in case
      we ever start to support hash partitions in pg_dump, so I left it there.
      22072ec5
    • H
      Fix check for superuser_reserved_connections. · 06ea112c
      Heikki Linnakangas 提交于
      Upstream uses >= here. It was changed in GPDB, to use > instead of >=. but
      I don't see how that's more correct or better. I tracked that change in
      the old pre-open-sourcing repository to this commit:
      
      commit f3e98a1ef5fc5915662077b137c563371ea1c0a4
      Date: Mon Apr 6 15:04:33 2009 -0800
      
         Fixed guc check for ReservedBackends.
      
         [git-p4: depot-paths = "//cdb2/main/": change = 33269]
      
      So, there was no explanation there either, what the alleged problem was.
      06ea112c