Skip to content

Regression: --reporting-period flag fails with timescaledb-parallel-copy 0.6.0+ #96

@Dev10000

Description

@Dev10000

Description:

The --reporting-period flag, which worked correctly in versions 0.5.1 and earlier, no longer functions as expected in versions 0.6.0 and above. Additionally, the tool fails to provide useful SQL error messages altogether since version 0.7.0.

The expected behaviour is that the --reporting-period flag should report intermediate insert stats, and any database errors (e.g., nonexistent database) should return clear SQL error messages.

timescaledb-parallel-copy (linux amd64) 0.7.0 - both period flag and sql errors don't work
timescaledb-parallel-copy (linux amd64) 0.6.0 - reporting-period flag doesn't work
timescaledb-parallel-copy (linux amd64) 0.5.1 - all works no issues


Steps to Reproduce:

  1. go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest
  2. Run timescaledb-parallel-copy with the --reporting-period flag on version 0.6.0 or later:
    timescaledb-parallel-copy --db-name <dbname> --reporting-period 2s  ...
  3. Use a nonexistent database or another scenario where a clear SQL error is expected.
  4. Observe the behavior and compare it with version 0.5.1 or 0.4.0.

Expected Behavior:

  • The --reporting-period flag should work as it did in version 0.5.1. and report intermediate insert stats.
  • SQL errors (e.g., nonexistent database) should result in clear error messages, such as:
    panic: could not connect: failed to connect to `host=10.101.6.67 user=postgres database=insert-time-erro`: server error (FATAL: database "insert-time-erro" does not exist (SQLSTATE 3D000))
    

Actual Behavior:

  1. Versions 0.6.0+:

    • --reporting-period flag does not function.
    • SQL errors are reported as expected.
  2. Versions 0.7.0+:

    • --period flag still does not function.
    • SQL errors fail to report, and the tool instead produces Go runtime errors:
      fatal error: all goroutines are asleep - deadlock!
      

Environment:

  • Tool Versions Tested:
    • 0.4.0: Works correctly
    • 0.6.0: Regression begins (--reporting-period fails, SQL errors still reported)
    • 0.7.0: Regression worsens (--reporting-period fails, SQL errors not reported)
    • 0.8.0: Same issues as 0.7.0
  • OS: Linux (amd64)
  • Database: PostgreSQL 17, Timescale 2.17
  • go version: go1.23.2 linux/amd64

Logs/Stack Trace:

From version 0.7.0:

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc00007e600?)
        /usr/local/go/src/runtime/sema.go:71 +0x25
sync.(*WaitGroup).Wait(0x81c530?)
        /usr/local/go/src/sync/waitgroup.go:118 +0x48
github.com/timescale/timescaledb-parallel-copy/pkg/csvcopy.(*Copier).Copy(0xc0000141e0, {0x81c530, 0xa50200}, {0x818c00, 0xc00005c0f0})
        /home/john/go/pkg/mod/github.com/timescale/timescaledb-parallel-copy@v0.7.0/pkg/csvcopy/csvcopy.go:208 +0x4a9
main.main()
        /home/john/go/pkg/mod/github.com/timescale/timescaledb-parallel-copy@v0.7.0/cmd/timescaledb-parallel-copy/main.go:136 +0x525

Impact:

  • The regression significantly impacts workflows that rely on the --reporting-period flag.
  • Troubleshooting is hindered because SQL errors are not clearly reported, especially in later versions.

Additional Context:

  • Version 0.5.1 is the last version where everything functions as expected.
  • The issue seems to worsen with later versions, suggesting potential changes in error handling or the handling of the --period flag.

Suggested Fix:

  • Investigate changes in the --reporting-period flag implementation since version 0.6.0.
  • Ensure SQL error handling is consistent and reports clear messages, even in cases of database connection issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions