Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ jobs:
for distro in ${RHEL_DISTROS}; do
package_cloud push "${repo}/${distro}" dist/*.rpm
done

- name: Upload assets
uses: actions/upload-artifact@v3
with:
name: release-assets
path: |
dist/*.deb
dist/*.rpm
16 changes: 10 additions & 6 deletions pkg/pgmodel/ingestor/copier.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,11 @@ func doInsertOrFallback(ctx context.Context, conn pgxconn.PgxConn, reqs ...copyR
defer span.End()
err, _ := insertSeries(ctx, conn, false, reqs...)
if err != nil {
if isPGUniqueViolation(err) {
err, _ = insertSeries(ctx, conn, true, reqs...)
}
if err != nil {
if !isPGUniqueViolation(err) {
log.Error("msg", err)
insertBatchErrorFallback(ctx, conn, reqs...)
return
}
insertBatchErrorFallback(ctx, conn, reqs...)
return
}

for i := range reqs {
Expand Down Expand Up @@ -350,6 +347,13 @@ func insertSeries(ctx context.Context, conn pgxconn.PgxConn, onConflict bool, re
insertStart := time.Now()
lowestEpoch := pgmodel.SeriesEpoch(math.MaxInt64)
lowestMinTime := int64(math.MaxInt64)

if onConflict && len(reqs) > 1 {
//holding on to long locks with ON CONFLICT considered harmful becase of mxid bloat
//no code path should use this. We leave this here to protect against this case in the future.
panic("should not try to insert to more than one metric per transaction with ON CONFLICT")
}

tx, err := conn.BeginTx(ctx)
if err != nil {
return fmt.Errorf("failed to start transaction for inserting metrics: %v", err), lowestMinTime
Expand Down