Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: missing commit for read-only transaction (#6758)

ecmadaoe7e2c0a0807b
diff --git a/backend/store/backup.go b/backend/store/backup.go
index 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 *BackupSe
return 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.go
index 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) ([]*Inbox
return 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.go
index 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 *FindRepositoryMessage
return 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 *FindRepositoryMessag
return 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 string
return 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.go
index 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.Co
if 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.go
index 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 *FindSheetOrganiz
return 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.go
index 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.Ta
if err := rows.Err(); err != nil {
return nil, err
}
+ if err := tx.Commit(); err != nil {
+ return nil, err
+ }
return res, nil
}