• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cybertec-postgresql / pgwatch / 40330496377
88%

Build:
DEFAULT BRANCH: master
Ran 26 Oct 2026 01:29PM UTC
Jobs 1
Files 50
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 Oct 2026 01:25PM UTC coverage: 87.903% (+0.04%) from 87.861%
40330496377

push

github

web-flow
[-] fix `PostgresWriter.flush()` hang on unmarshalable measurements (#1593)

* fix `PostgresWriter.flush()` hang on unmarshalable measurements

Port of #1591 to master.

A measurement that fails to marshal (e.g. a `NaN` value) aborted
`CopyFrom`
mid-envelope, leaving `copyFromMeasurements` mid-metric with a sticky
`Err()`.
The rest of the failed metric's rows went to the next metric's table,
and when
the failed metric was the last one `MetricName()` returned an empty
identifier,
so `flush()` looped forever.

`copyFromMeasurements.SkipMetric()` now drops the rest of the failed
metric
(or the next one if the copy failed before reading it) and clears the
error;
`flush()` calls it after a failed `CopyFrom`.

Master has no pgxmock CopyFrom support, so the flush regression tests
use a
small fake sink that mimics pgx `CopyFrom` instead of the mock-based
ones.

* remove `PostgresWriter.lastError` channel

The channel was unbuffered and both the send in `flush()` and the receive
in `Write()` were non-blocking, so no error was ever delivered. The only
consumer logged the error, which `flush()` already does. Partition
creation errors are now logged in `flush()` instead.

* fix SkipMetric() dropping the next metric after a server-side COPY error

pgx drains the CopyFromSource concurrently with sending COPY data, so when
the server reports an error mid-copy (e.g. a 23514 check violation) the
iterator has usually already reached the metric boundary. The old
SkipMetric() then saw no current metric and skipped the following one,
losing its measurements.

SkipMetric now takes the identifier that was passed to CopyFrom and only
advances while the upcoming envelopes still carry that metric name.

The copy-sink tests now assert row counts per metric instead of comparing
jsoniter output, whose map key order is random and made the test flaky.

Add TestFlush_ServerSideCopyErrorKeepsNextMetric.

19 of 21 new or added lines in 1 file covered. (90.48%)

10 existing lines in 2 files now uncovered.

5479 of 6233 relevant lines covered (87.9%)

1.0 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
81.19
1.79% internal/sinks/postgres.go

Coverage Regressions

Lines Coverage ∆ File
8
92.19
-2.97% internal/sinks/prometheus.go
2
81.25
0.0% internal/webserver/wslog.go
Jobs
ID Job ID Ran Files Coverage
1 40330496377.1 26 Oct 2026 01:29PM UTC 50
87.9
GitHub Action Run
Source Files on build 40330496377
  • Tree
  • List 50
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #40330496377
  • 742aaf91 on github
  • Prev Build on master (#40326381372)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc