1. May 24, 2022
  2. May 23, 2022
    • Dimitri Fontaine's avatar
      Skip long-running transactions when --not-consistent is used. (#45) · 9a524b2b
      Dimitri Fontaine authored
      To prevent limitations around lock management when running pgcopydb on a
      source database with lots of objects, we now benefit from --not-consistent
      as an opportunity to reduce long-running transactions.
      
      It was already the case that --not-consistent wouldn't require exporting or
      setting a snapshot, but the opportunity was not yet implemented fully.
      9a524b2b
  3. May 20, 2022
    • Dimitri Fontaine's avatar
      Fix filtering of the pre-data section of the dump. (#44) · 19db6b62
      Dimitri Fontaine authored
      * Implement filtering the pre-data section.
      
      When installing the schema on the target database, we want to already filter
      out the SQL objects that are filtered-out in the filtering setup. The
      previous coding forgot about that parts.
      
      See #43.
      
      * Implement support for exclude-schemas.
      
      The parsing was implemented already, but the filtering itself was shy of a
      brick load. We need to both filter tables that belong to the schema (we did)
      and also the schema object itself (we didn't).
      
      * Add missed SQL objects types to parse from pg_restore archive list.
      
      * Add ACL as a pg_restore archive catalog description entry.
      19db6b62
  4. May 16, 2022
  5. May 13, 2022
  6. May 11, 2022
  7. May 10, 2022
    • Dimitri Fontaine's avatar
    • Dimitri Fontaine's avatar
      Fix version string handling in some cases. (#37) · d1d034dd
      Dimitri Fontaine authored
      In particular fix the debian package build, and use dpkg-parsechangelog in
      that environment so that we report the debian/changelog version string.
      d1d034dd
    • Dimitri Fontaine's avatar
      Add versioning information to the logs output. (#36) · b3ac0829
      Dimitri Fontaine authored
      * Add versioning information to the logs output.
      
      For that to be useful, we also integrate with the git scripts from git
      itself to compute a trustworthy version string such as 0.5.5.gaea0ff08.dirty
      when we have local changes are are building from a git checkout.
      b3ac0829
    • Dimitri Fontaine's avatar
      Implement filtering support. (#19) · aea0ff08
      Dimitri Fontaine authored
      * Implement a parser for filtering settings, and filter table lists.
      
      * Apply filters to listing sequences.
      
      We filter only those sequences that have a link dependency to the selected
      tables. There is no way at the moment to select a sequence that's not
      tracked to a specific default value for a column that doesn't belong to one
      of the selected tables.
      
      That said, when filtering is not used, all sequences are processed, even
      those not attached to any table. Which means that `pgcopydb copy sequences`
      in the use case where filtering is needed for tables, but not for sequences.
      
      * Implement pgcopydb list ... --list-skipped.
      
      This option allows debugging the filtering setup, and is also needed to
      implement pg_restore catalog editing (--use-list) to avoid installing
      objects that are filtered-out in the setup.
      
      * Document filtering setup.
      
      * Add a test for the filtering capabilities.
      
      * Improve filtering of pg_restore list entries without an OID.
      
      Some pg_restore --list entries such as INDEX ATTACH miss both the catalog
      and the object oid, and then we need to match them by their pg_restore list
      name, which is a compound of the schema name, object name, and owner name.
      
      Adding to that, the way pg_restore builds that compound name is with using a
      single space as a separator, and replacing \n and \r characters with a
      single space. This makes the pg_restore list output unfriendly to machine
      parsing, and so instead we generate the list name from the Postgres catalogs
      in our catalog queries.
      
      Then we can use an hash table on the OIDs and another one on the compound
      names and find out if an INDEX ATTACH catalog entry refers to an index that
      has been filtered-out by filtering rules, and comment it out then.
      
      * Add a pg_depend recursive walker facility.
      
      This allows filtering from pg_restore --list objects that depend on tables
      that have been filtered out.
      aea0ff08
  8. Mar 22, 2022
    • Dimitri Fontaine's avatar
      Fix support for inherited tables. (#35) · c8058300
      Dimitri Fontaine authored
      A good optimization when using COPY is to use TRUNCATE in the same
      transaction, so as to be able to then use COPY FREEZE and avoid some VACUUM
      activities after the bulk loading of data.
      
      Trouble is that with inherited tables, the TRUNCATE command would also
      remove all the data that was (maybe) just copied to the inheritance tree
      nodes.
      
      To fix, just use the TRUNCATE ONLY variant of the command.
      
      This commit also adds full regression testing for this issue, thanks to the
      test case provided in #33.
      c8058300
    • Dimitri Fontaine's avatar
      Implement Unit/Regression testing suite. (#34) · 16ba7b0e
      Dimitri Fontaine authored
      * Implement Unit/Regression testing suite.
      
      At the moment it's quite a simple test suite, and only covers the exclusion
      constraint issue #22. As more specific issues are opened, we can add to this
      regression test suite.
      
      * Add SQL based checking.
      
      To ensure that the test is passing, it is now possible to run SQL tests and
      compare the result from the registered expected output.
      16ba7b0e
  9. Mar 16, 2022
  10. Mar 12, 2022
  11. Mar 11, 2022
  12. Mar 10, 2022
    • Dimitri Fontaine's avatar
      Increase the default timeout from 2s to 10s. (#28) · 1c94903d
      Dimitri Fontaine authored
      In our context we need to connect through unknown network layers, the
      default of 2s is better suited for a known local connection. 10s seems a
      good trade-off for pgcopydb.
      1c94903d
    • Dimitri Fontaine's avatar
      Assorted bug fixes for Postgres connection handling. (#27) · 1287a0c3
      Dimitri Fontaine authored
      The auxiliary process for large objects would somehow piggyback on the main
      snapshot connection instance, so make sure it's using its own private
      connection.
      
      Since re-using the same connection throughout a COPY process we switched to
      multi statements connections, and those need to be closed explicitly. We
      missed that in the previous coding.
      
      Using SSL as in debian by default shows more errors, so make sure to run at
      least one of our docker compose based testing in SSL too.
      
      Move the copy of sequences data to a proper place that matches the comment
      and refactor some function names to distinguish between async behaviour (use
      _start_ in the name then) and sync behaviour. Recent changes made that
      distinction hard to follow.
      1287a0c3
  13. Mar 09, 2022
  14. Mar 08, 2022
  15. Mar 07, 2022
  16. Feb 14, 2022
    • Dimitri Fontaine's avatar
      Implement setting GUC values to our src/dst Postgres connections. (#17) · 21ce1f54
      Dimitri Fontaine authored
      At the minimum we want to use the same client_encoding on both connections,
      so that we know that we are dealing with the same data without having to
      actually look into it.
      
      Then, for bulk-loading and index creation, some settings are easy to set on
      the target connection to get a better perf profile (e.g.
      maintenance_work_mem).
      21ce1f54
  17. Feb 12, 2022
  18. Feb 11, 2022
    • Dimitri Fontaine's avatar
      85719757
    • Dimitri Fontaine's avatar
      Allow using --resume with --snapshot without --not-consistent. (#13) · 9509a830
      Dimitri Fontaine authored
      * Allow using --resume with --snapshot without --not-consistent.
      
      When the snapshot has been kept around in between two runs of pgcopydb we
      can still ensure consistency and use --resume and --snapshot.
      
      * Improve --resume --snapshot ... processing.
      
      Make the processing more robust when using `pgcopydb copy ...` commands and
      refactor some code to share more of the tooling. Specifically, all the
      commands now share the same getopt structure and support the same
      environment variables.
      
      * Add proper support for --snapshot for pgcopydb copy ... subcommands.
      
      * Fix pgcopydb copy constraints.
      
      Instead of using the `pgcopydb copy data` approach focused on tables, and
      then for each tables the indexes, and then when all the indexes of a given
      table are finished creating the constraints; simplify and re-use the index
      only code path from `pgcopydb copy indexes` taking care of constraints.
      
      This means indexJobs processes are created and share the list of constraints
      to build with the usual locking approach.
      9509a830