1. Feb 06, 2024
  2. Feb 05, 2024
  3. Feb 02, 2024
  4. Jan 31, 2024
    • Dimitri Fontaine's avatar
      Vendor SQLite amalgamation distribution. (#660) · bda0cb9e
      Dimitri Fontaine authored
      This allows to ensure we're always using a known version of the SQLite lib
      and allows pgcopydb code to use some "recent" features on all OS targets.
      
      Such features include the RETURNING clause for DMLs, the FILTER clause for
      aggregate function calls, and time formatting function or JSON functions.
      
      See https://sqlite.org/amalgamation.html for details about that distribution
      mode for SQLite.
      bda0cb9e
    • Hanefi Onaldi's avatar
      Overhaul of EditorConfig rules (#652) · 2ce0ae22
      Hanefi Onaldi authored
      Before this change we had 153 files on the main branch that did broke at
      least one of our editorconfig rules. After this change, all of our files
      honor the rules that are partially updated.
      
      There are 2 places that are exempt from our rules:
      - external libraries in src/bin/lib/
      - debian directory in debian/
      - test file from outside source in tests/extensions/
      
      You can see the .editorconfig file in each of these directories for more
      details.
      2ce0ae22
  5. Jan 30, 2024
    • Hanefi Onaldi's avatar
      Introduce CONTRIBUTING.md (#653) · 6b6db5d5
      Hanefi Onaldi authored
      
      
      I used a copy of Citus' CONTRIBUTING.md as a starting point.
      
      I removed sections that are not relevant to pgcopydb, and added some
      more sections about documentation and running tests.
      
      I also added references to the CONTRIBUTING.md file in the README.md and
      in documentation page about installing pgcopydb. While I was at it, I
      also removed the outdated installation instructions from the README.md
      file, and replaced them with a reference to the documentation page.
      
      Co-authored-by: default avatarDimitri Fontaine <dim@tapoueh.org>
      6b6db5d5
    • Dimitri Fontaine's avatar
      Fix confusion around reporting operations in progress. (#658) · a3cc2eb8
      Dimitri Fontaine authored
      * Fix confusion around reporting operations in progress.
      
      The SQLite refactor meant rewriting all the SourceTableArray loops to use a
      query result iterator instead. Well there is a place for a SourceTableArray
      loop still, and that's the pgcopydb list progress thing.
      
      * Fix the table-in-copy SQLite query.
      
      The query was meant to report actual duration and transmitted bytes for each
      table in-progress, but the join and sum() operations are creating problems
      in the SQLite query and the rest of the progress.c code was not prepared to
      benefit from the extra information anyway.
      
      The SQLite problem is that the sum(s.duration), sum(s.bytes) causes a single
      row output when the dataset is empty, and the other columns are all set to
      NULL. That might be because of the lack of a GROUP BY clause.
      
      Simplify that aspect by removing the extra information for now.
      a3cc2eb8
  6. Jan 26, 2024
    • Dimitri Fontaine's avatar
      Fix pgcopydb list progress. (#654) · 2b4c98d1
      Dimitri Fontaine authored
      Since the move of the summary and process information to the SQLite
      catalogs, we don't have a progress JSON file on-disk with parts of the setup
      anymore.
      
      The code needed to be updated to behave correctly without having
      --table-jobs and --index-jobs information.
      2b4c98d1
    • Dimitri Fontaine's avatar
      Use Boehm-Demers-Weiser Garbage Collector. (#647) · 29a42685
      Dimitri Fontaine authored
      * Use Boehm-Demers-Weiser Garbage Collector.
      
      From their own documentation:
      
      > The Boehm-Demers-Weiser conservative garbage collector can be used as a
      > garbage collecting replacement for C malloc or C++ new. It allows you to
      > allocate memory basically as you normally would, without explicitly
      > deallocating memory that is no longer useful. The collector automatically
      > recycles memory when it determines that it can no longer be otherwise
      > accessed.
      
      In pgcopydb C code base it's been hard to maintain proper malloc/free
      concerns while also implementing proper error-handling, which is a common
      problem when writing C code. In order to ease the maintenance of the code
      and reduce production hazards, the best way to proceed looks like automating
      the memory management altogether by using a Garbage Collector.
      
      * Revert removal of regree() calls.
      
      * Get rid of LinesBuffer.ownsBuffer.
      
      Now that libgc is handling the memory for us, we don't need to keep track of
      the ownership of the buffer anymore.
      29a42685
  7. Jan 25, 2024
  8. Jan 24, 2024
    • Hanefi Onaldi's avatar
      Improve documentation templates (#618) · 88a34e8f
      Hanefi Onaldi authored
      - Adds CI to check that the documentation templates are up-to-date.
      - Add a new `help` command to the documentation templates. This command
        prints the help message for all the sub-commands of `pgcopydb` in a
        single file. This is useful for users who want to see all the
        sub-commands in one place.
      - Remove dependency on installing the binary before updating the
        documentation templates. This allows users to update the documentation
        templates without installing the binary. One can set the `PGCOPYDB`
        environment variable to point to the binary to use for updating the
        documentation templates.
      - Fix a casing issue in command descriptions. The first letter of the
        first word in the description of each command should be capitalized.
      88a34e8f
  9. Jan 23, 2024
  10. Jan 22, 2024
  11. Jan 17, 2024
    • Dimitri Fontaine's avatar
      Fix eager extension/collation skipping. (#642) · 7633458c
      Dimitri Fontaine authored
      The SQLite patch series introduced a bug where we would skip extensions even
      when the option --skip-extension is not used.
      
      Also adjust the "pgcopydb copy extensions" to the recent changes where we
      use a sub-process under a supervisor to simplify snapshot handling.
      7633458c
    • Dimitri Fontaine's avatar
      Review zero-byte allocation hasards. (#641) · 49725e5d
      Dimitri Fontaine authored
      Make sure we don't try and allocate a zero-size memory area, which can lead
      to "corrupted size vs. prev_size". Review all the calloc() call sites and
      protect them better when they need to be.
      49725e5d
    • Dimitri Fontaine's avatar
      Review the splitLines() API to avoid allocating zero bytes. (#638) · b207fd41
      Dimitri Fontaine authored
      Make it systematic to first count the lines and then allocate the right
      amount of memory for the array of pointers to the start of each line, and
      make sure we don't try and allocate a zero-size array, which can lead to
      "corrupted size vs. prev_size" errors at run-time.
      b207fd41
  12. Jan 16, 2024
  13. Jan 15, 2024
  14. Jan 10, 2024
  15. Jan 09, 2024
  16. Jan 05, 2024
  17. Jan 04, 2024
    • Hanefi Onaldi's avatar
      Automate updating help messages in docs (#565) · 1ed47db3
      Hanefi Onaldi authored
      This commit introduces a shell script that runs all commands that accept
      `--help` parameter and stores the result in template files that are
      referenced in our documentation. You can use that script by running
      `make update-docs` in top directory of the project.
      1ed47db3
  18. Jan 03, 2024
  19. Jan 02, 2024
    • Dimitri Fontaine's avatar
      Fix pgcopydb list progress command. (#610) · 65c51045
      Dimitri Fontaine authored
      Introduce a new query to count the number of tables and indexes already
      processed from the summary table, fixing the list progress output for items
      "done".
      65c51045
    • Dimitri Fontaine's avatar
    • Dimitri Fontaine's avatar
    • Dimitri Fontaine's avatar
      Use our SQLite catalogs for the pgcopydb sentinel table. (#601) · 97f18bc5
      Dimitri Fontaine authored
      * Use our SQLite catalogs for the pgcopydb sentinel table.
      
      The main use-case for the sentinel table is to communicate progress made by
      the three independent worker processes for stream, transform, and replay.
      It is also needed to communicate new startpos, endpos and apply values with
      those processes from another pgcopydb (interactive) command, a process
      that's not in the process tree.
      
      This was previously solved by creating and using a pgcopydb.sentinel table
      on the source database. Now that we have a SQLite database internal to the
      pgcopydb run, we can use that instead.
      
      * More work on the sentinel table move to SQLite catalogs.
      
      In particular, we need to share a common directory mount point in the test
      and inject containers, because the inject container is setting the endpos
      for the test container where the main tests are running.
      
      For that, in my testing the best option is to use a host directory. This
      also makes it very easy to then use sqlite3 and inspect what's going on from
      the outside.
      
      * Attempt to fix GitHub Action host workdir perms
      
      * Fix follow-data-only tests: update sentinel at stream flush time.
      
      * Assorted fixes, per self-review.
      97f18bc5
  20. Dec 30, 2023
    • Hanefi Onaldi's avatar
      Removes copy-db command (#605) · d365e07f
      Hanefi Onaldi authored
      The copy-db command is deprecated and will get removed from pgcopydb on
      next release, please upgrade your scripts and integrations.
      d365e07f