1. 13 6月, 2016 2 次提交
    • K
      Dispatch exactly same text string for all slices. · 4b360942
      Kenan Yao 提交于
      Include a map from sliceIndex to gang_id in the dispatched string,
      and remove the localSlice field, hence QE should get the localSlice
      from the map now. By this way, we avoid duplicating and modifying
      the dispatch text string slice by slice, and each QE of a sliced
      dispatch would get same contents now.
      
      The extra space cost is sizeof(int) * SliceNumber bytes, and the extra
      computing cost is iterating the SliceNumber-size array. Compared with
      memcpy of text string for each slice in previous implementation, this
      way is much cheaper, because SliceNumber is much smaller than the size
      of dispatch text string. Also, since SliceNumber is so small, we just
      use an array for the map instead of a hash table.
      
      Also, clean up some dead code in dispatcher, including:
      (1) Remove primary_gang_id field of Slice struct and DispatchCommandDtxProtocolParms
      struct, since dispatch agent is deprecated now;
      (2) Remove redundant logic in cdbdisp_dispatchX;
      (3) Clean up buildGpDtxProtocolCommand;
      4b360942
    • P
      Fix bugs when a SET command is executed within init plan · 2cda812c
      Pengzhou Tang 提交于
      In commit d2725929, GPDB marked all allocatedReaderGangs with noReuse flag. When plan contains
      init plan and a SET command executed within it, GPDB will mark pre-assigned gangs to noReuse and
      destroy them which make query crash
      2cda812c
  2. 11 6月, 2016 4 次提交
    • F
      The GPDB Vmem is the lowest layer of memory allocator that supports higher... · 42ca3506
      Foyzur Rahman 提交于
          The GPDB Vmem is the lowest layer of memory allocator that supports higher allocators such as AllocSet. This layer (mostly defined in memprot.c) is in charge of actually calling malloc/realloc/free to allocate/reallocate/free memory. In this process this layer is also in charge of reserving "virtual" memory or Vmem, which is a GPDB specific shared memory counter to track per-segment combined allocations across all the GPDB processes under Vmem umbrella. The Vmem counter is managed by a separate module Vmem_Tracker, and the memprot functions (such as gp_malloc, gp_free2 and gp_realloc) call the APIs provided by VmemTracker.
      
          Previously the memprot allocators (gp_alloc/gp_realloc/gp_free) were only allocating/freeing memory but were not adding any additional metadata in the header (and there was no header) to track the size of allocations. Therefore, there was no gp_free as freeing memory requires the size of the free to adjust Vmem counter inside VmemTracker. This was patched by explicitly passing size info in gp_free2.
      
          In this PR we do the following:
      
          * We add allocation size in Vmem header (along with checksums which are only available in debug build to detect header and footer boundary, and buffer overruns).
      
          * We remove size information from the block header of AllocSet.
      
          * We rename gp_free2 to gp_free as the second parameter (size information) is now obtained from the header and therefore no longer necessary
      
          * We modify all the consumers of memprot.c APIs to use the new APIs
      
          * We add unit tests to test the metadata and the correctness of the new Vmem allocators
      
          This is the first step to integrate external modules and third party allocations with Vmem. A long running issue in GPDB is its inability to track allocations by external components including libraries such as ORCA. Therefore, the central Vmem counter is often way off from the underlying allocations, and this may run the system out of memory. By maintaining the size information in the Vmem header, we now have a self-contained allocator that can be exposed to external allocators such as GPOS allocators, without forcing them to manage size information separately.
      
          This fixes #117269929.
      Signed-off-by: NMarc Spehlmann <marc.spehlmann@gmail.com>
      42ca3506
    • J
      [#120984085] Adds GUC for array expansion. · 53230187
      Jesse Zhang and Marc Spehlmann 提交于
      This GUC will be used to control the MEMO size as well as optimization
      time for large IN list or large array comparison expressions.
      
      Only the Array with less number of elements than the GUC will be
      expanded and participate in constraint derivation.
      
      Trade-off of using this GUC is loss of potential benefits from the
      constraint derivation (e.g. conflict detection, partition elimination)
      with shorter optimization time and less memory utilization.
      53230187
    • N
    • N
      Revert "Reset g_dataSourceCtx variable, since the context is destroyed at EOX." · b918bb17
      Nikos Armenatzoglou 提交于
      This reverts commit d9edb869.
      g_dataSourceCtx should not be reset in AtAbort_ExtTables, since external tables is not the only component that uses it.
      b918bb17
  3. 10 6月, 2016 1 次提交
    • H
      Update minirepro and pg_dump utility to dump both relation and function ddl · 318b86af
      Haisheng Yuan 提交于
      This patch updates minirepro utility to support the following functions:
      1. Dump ddl and stats for multiple queries in a query file
      2. Dump ddl of relation that is used in CTE
      3. Dump ddl of function that is used in the query
      4. Add 2 options: relation-oids and function-oids into pg_dump command line tool
      318b86af
  4. 09 6月, 2016 3 次提交
    • H
      Simplify counting of tupletable slots, by getting rid of the counting. · 10ca88b4
      Heikki Linnakangas 提交于
      Backport this patch from PostgreSQL 9.0, which replaces the tuple table
      array with a linked list of individually palloc'd slots. With that, we
      don't need to know the size of the array beforehand, and don't need to
      count the slots. The counting was especially funky for subplans in GPDB,
      and it was about to change with the upcoming PostgreSQL 8.3 merge again.
      This makes it a lot simpler.
      
      I don't plan to backport the follow-up patch to remove the ExecCountSlots
      infrastructure. We'll get that later, when we merge with PostgreSQL 9.0.
      
      commit f92e8a4b
      Author: Tom Lane <tgl@sss.pgh.pa.us>
      Date:   Sun Sep 27 20:09:58 2009 +0000
      
          Replace the array-style TupleTable data structure with a simple List of
          TupleTableSlot nodes.  This eliminates the need to count in advance
          how many Slots will be needed, which seems more than worth the small
          increase in the amount of palloc traffic during executor startup.
      
          The ExecCountSlots infrastructure is now all dead code, but I'll remove it
          in a separate commit for clarity.
      
          Per a comment from Robert Haas.
      10ca88b4
    • H
      Change the way temp schemas are created. · 8a2cf323
      Heikki Linnakangas 提交于
      This reverts much of the changes vs. upstream, related to temp schema
      creation. Instead of using the normal CREATE SCHEMA processing to also
      create the temporary schema, let InitTempTableNameSpace() to do that
      like in the upstream. But in addition to creating the the temp schema
      locally, it dispatches a special CreateSchemaStmt command to the
      executor nodes, which instructs the executor nodes to also call
      InitTempTableNameSpace().
      8a2cf323
    • H
      Bump check on regression database size to 5 GB. · 2ba36ba6
      Heikki Linnakangas 提交于
      The regression database has grown over time, so that it's just above the
      1 GB size that the regression test used as a "sanity check". I think the
      new zlib regression test broke the camel's back. Bump it up to 5 GB, giving
      us about 4 GB of headroom to grow.
      2ba36ba6
  5. 08 6月, 2016 4 次提交
  6. 07 6月, 2016 15 次提交
  7. 06 6月, 2016 4 次提交
    • H
      Fix ORCA alternative expected outputs. · d4506033
      Heikki Linnakangas 提交于
      I neglected these in previous commit.
      d4506033
    • H
      Backport b153c092 from PostgreSQL 8.4 · 78b0a42e
      Heikki Linnakangas 提交于
      This is a partial backport of a larger body of work which also already have
      been partially backported.
      
      Remove the GPDB-specific "breadcrumbs" mechanism from the parser. It is
      made obsolete by the upstream mechanism. We lose context information from
      a few errors, which is unfortunate, but seems acceptable. Upstream doesn't
      have context information for those errors either.
      
      The backport was originally done by Daniel Gustafsson, on top of the
      PostgreSQL 8.3 merge. I tweaked it to apply it to master, before the
      merge.
      
      Upstream commit:
      
        commit b153c092
        Author: Tom Lane <tgl@sss.pgh.pa.us>
        Date:   Mon Sep 1 20:42:46 2008 +0000
      
          Add a bunch of new error location reports to parse-analysis error messages.
          There are still some weak spots around JOIN USING and relation alias lists,
          but most errors reported within backend/parser/ now have locations.
      78b0a42e
    • H
      Revert contain_vars_of_level() to match the upstream. · 756241e2
      Heikki Linnakangas 提交于
      The function was rewritten in GPDB, and its behaviour was changed to also
      return 'true' if the expression contains an Aggref of the given level.
      That change in behaviour was made back in 2006, as part of a commit
      containing a lot of subquery optimization changes. I could not find an
      explanation for that particular change, and all the regression tests pass
      without so I assume that it has become obsolete at some point over they
      years.
      
      This smoothens the way for future merges with upstream, by reducing the
      diff in both code and behaviour. Also, you get a more accurate error
      message in a few cases, as seen by the changes to expected output.
      756241e2
    • T
      Add array_contains_nulls() function in arrayfuncs.c. · e85d268f
      Tom Lane 提交于
      This will support fixing contrib/intarray (and probably other places)
      so that they don't have to fail on arrays that contain a null bitmap
      but no live null entries.
      e85d268f
  8. 05 6月, 2016 2 次提交
  9. 04 6月, 2016 2 次提交
  10. 03 6月, 2016 3 次提交
    • H
      Add missing field to readRangeTblEntry, improve comment in fast version. · fd6741f9
      Heikki Linnakangas 提交于
      The readRangeTblEntry() function was missing the line for 'pseudocols'
      field. I'm surprised the function worked at all, I thought the read
      functions don't work if there are any extra fields. Maybe they're more
      forgiving if it's last field that's missing. In any case, seems like an
      oversight. It doesn't matter in practice, as the pseudocols field is only
      used during planning, and we don't serialize nodes at that stage. Rule
      definitions are serialized before planning, and for the transfer between
      QD and QEs, we use the 'fast' versions of these functions.
      
      In the 'fast' version, the 'pseudocols' is missing from both the out
      function and the read function. That seems intentional, so add a comment
      about it.
      fd6741f9
    • H
      Remove unused 'rewindPlanIDs' fields. · efc1052c
      Heikki Linnakangas 提交于
      The copy/out/read functions for it were wrong: a Bitmapset is not a Node,
      so one should use e.g. COPY_BITMAPSET_FIELD() instead of COPY_NODE_FIELD()
      for them. But since the fields are currently unused, let's just remove them.
      
      These fields will be resurrected soon, by the PostgreSQL 8.3 merge, as they
      were introduced in PostgreSQL 8.3. Then they will actually be used, too.
      efc1052c
    • H
      Remove bogus ORDER BY from test query. · 9122bf9d
      Heikki Linnakangas 提交于
      The multiset_5 function returns a "SET OF example", but the 'a' column
      was dropped from 'example' table earlier. The statement currently produces
      a different error, because anytable cannot be passed to PREPARE, but if
      that worked, this would fail because of the broken ORDER BY. The purpose
      of this test is to test PREPARE with anytable, so let's not have a broken
      ORDER BY.
      9122bf9d