Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: missing commit for read-only transaction (#6758)
ecmadaoe7e2c0a0807b
diff --git a/backend/store/backup.go b/backend/store/backup.goindex 018eb7a596..8930b87b24 100644--- a/backend/store/backup.go+++ b/backend/store/backup.go@@ -85,6 +85,10 @@ func (s *Store) findBackupSettingsMatchImpl(ctx context.Context, match *BackupSereturn nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+return backupSettingList, nil}diff --git a/backend/store/inbox.go b/backend/store/inbox.goindex 655d940ae0..a40af89cb6 100644--- a/backend/store/inbox.go+++ b/backend/store/inbox.go@@ -79,6 +79,10 @@ func (s *Store) FindInbox(ctx context.Context, find *FindInboxMessage) ([]*Inboxreturn nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+return list, nil}@@ -130,6 +134,10 @@ func (s *Store) FindInboxSummary(ctx context.Context, principalID int) (*InboxSu}}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+return &inboxSummary, nil}diff --git a/backend/store/repository.go b/backend/store/repository.goindex 509b8003f0..3049c78f5b 100644--- a/backend/store/repository.go+++ b/backend/store/repository.go@@ -103,6 +103,10 @@ func (s *Store) GetRepositoryV2(ctx context.Context, find *FindRepositoryMessagereturn nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+if len(list) == 0 {return nil, nil} else if len(list) > 1 {@@ -124,6 +128,10 @@ func (s *Store) ListRepositoryV2(ctx context.Context, find *FindRepositoryMessagreturn nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+return list, nil}@@ -159,9 +167,13 @@ func (s *Store) DeleteRepositoryV2(ctx context.Context, projectResourceID stringreturn err}+ if err := tx.Commit(); err != nil {+ return err+ }+s.removeProjectCache(projectResourceID)- return tx.Commit()+ return nil}// createRepositoryImplV2 creates a new repository.diff --git a/backend/store/sheet.go b/backend/store/sheet.goindex 935b0292cd..08f46e161c 100644--- a/backend/store/sheet.go+++ b/backend/store/sheet.go@@ -16,7 +16,7 @@ import (// CountSheetGroupByRowstatusVisibilitySourceAndType counts the number of sheets group by row_status, visibility, source and type.func (s *Store) CountSheetGroupByRowstatusVisibilitySourceAndType(ctx context.Context) ([]*metric.SheetCountMetric, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, err}@@ -48,6 +48,10 @@ func (s *Store) CountSheetGroupByRowstatusVisibilitySourceAndType(ctx context.Coif err := rows.Err(); err != nil {return nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+return res, nil}diff --git a/backend/store/sheet_organizer.go b/backend/store/sheet_organizer.goindex 102af28ebd..e4cf2d53c2 100644--- a/backend/store/sheet_organizer.go+++ b/backend/store/sheet_organizer.go@@ -122,6 +122,10 @@ func (s *Store) FindSheetOrganizerV2(ctx context.Context, find *FindSheetOrganizreturn nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }+if len(sheetOrganizerlist) == 0 {return nil, nil} else if len(sheetOrganizerlist) > 1 {diff --git a/backend/store/stats.go b/backend/store/stats.goindex 212dd70d3e..771bfeb688 100644--- a/backend/store/stats.go+++ b/backend/store/stats.go@@ -300,5 +300,8 @@ func (s *Store) CountTaskGroupByTypeAndStatus(ctx context.Context) ([]*metric.Taif err := rows.Err(); err != nil {return nil, err}+ if err := tx.Commit(); err != nil {+ return nil, err+ }return res, nil}