From 710e94f8d09c59fca969ca7d26bde4bb4ea409d1 Mon Sep 17 00:00:00 2001 From: Adrien Aury <44274230+adrienaury@users.noreply.github.com> Date: Thu, 6 Feb 2025 11:56:36 +0100 Subject: [PATCH 1/3] fix: push final commit --- CHANGELOG.md | 4 ++++ pkg/push/driver.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7626d8ed..3ce42427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ Types of changes - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [3.1.1] + +- `Fixed` final commit on push + ## [3.1.0] - `Added` possibility to filter columns via `select` property in ingress descriptors diff --git a/pkg/push/driver.go b/pkg/push/driver.go index 96800ee4..4f5271a9 100755 --- a/pkg/push/driver.go +++ b/pkg/push/driver.go @@ -44,6 +44,14 @@ func Push(ri RowIterator, destination DataDestination, plan Plan, mode Mode, com er1 := destination.Close() er2 := ri.Close() + if er1 != nil { + log.Warn().Msg(fmt.Sprintf("Failed to close data destination : %s", er1.Error())) + } + + if er2 != nil { + log.Warn().Msg(fmt.Sprintf("Failed to close connection : %s", er1.Error())) + } + switch { case er1 != nil && er2 == nil && err == nil: err = er1 @@ -109,6 +117,12 @@ func Push(ri RowIterator, destination DataDestination, plan Plan, mode Mode, com } } + log.Info().Msg("Final commit") + if errCommit := destination.Commit(); errCommit != nil { + return errCommit + } + IncCommitsCount() + if ri.Error() != nil { return ri.Error() } From e82cdb34194f8c80a4f48bc6eec110d539feddaa Mon Sep 17 00:00:00 2001 From: Adrien Aury <44274230+adrienaury@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:01:11 +0100 Subject: [PATCH 2/3] fix: push final commit --- pkg/push/driver.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/push/driver.go b/pkg/push/driver.go index 4f5271a9..755b28b8 100755 --- a/pkg/push/driver.go +++ b/pkg/push/driver.go @@ -26,6 +26,7 @@ import ( ) // Push write rows to target table +// nolint:gocyclo func Push(ri RowIterator, destination DataDestination, plan Plan, mode Mode, commitSize uint, disableConstraints bool, catchError RowWriter, translator Translator, whereField string, savepointPath string, autotruncate bool, observers ...Observer) (err *Error) { defer func() { for _, observer := range observers { From 563447b2f0ff86f67393150f3db2caab2b3b1876 Mon Sep 17 00:00:00 2001 From: Adrien Aury <44274230+adrienaury@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:08:45 +0100 Subject: [PATCH 3/3] fix: push final commit --- tests/suites/push/stats.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/suites/push/stats.yml b/tests/suites/push/stats.yml index 6455bfe9..cdaa31ba 100644 --- a/tests/suites/push/stats.yml +++ b/tests/suites/push/stats.yml @@ -39,7 +39,7 @@ testcases: assertions: - result.code ShouldEqual 0 - result.systemout ShouldBeEmpty - - result.systemerr ShouldContainSubstring {"level":"info","stats":{"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":0 + - result.systemerr ShouldContainSubstring {"level":"info","stats":{"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":1 - script: lino pull dest --limit 1 -f store_id=2 assertions: @@ -58,12 +58,12 @@ testcases: assertions: - result.code ShouldEqual 0 - result.systemout ShouldBeEmpty - - result.systemerr ShouldContainSubstring {"level":"info","stats":{"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":0,"duration" + - result.systemerr ShouldContainSubstring {"level":"info","stats":{"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":1,"duration" - result.systemerr ShouldContainSubstring },"return":0 - script: cat lino-push-delete-stats.json assertions: - - result.systemout ShouldContainSubstring {"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":0,"duration" + - result.systemout ShouldContainSubstring {"inputLinesCount":1,"createdLinesCount":{},"deletedLinesCount":{"staff":1,"store":1},"commitsCount":1,"duration" - name: restore with stats steps: