Skip to content

Commit

Permalink
Merge pull request #796 from SiaFoundation/chris/remove-sql-mutexes
Browse files Browse the repository at this point in the history
Remove spendingMu, interactionsMu and objectsMu
  • Loading branch information
ChrisSchinnerl committed Dec 6, 2023
2 parents 199c12a + c1927eb commit 94ca2dc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 25 deletions.
8 changes: 0 additions & 8 deletions stores/hostdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,6 @@ func (ss *SQLStore) RecordHostScans(ctx context.Context, scans []hostdb.HostScan
return nil // nothing to do
}

// Only allow for applying one batch of interactions at a time.
ss.interactionsMu.Lock()
defer ss.interactionsMu.Unlock()

// Get keys from input.
keyMap := make(map[publicKey]struct{})
var hks []publicKey
Expand Down Expand Up @@ -824,10 +820,6 @@ func (ss *SQLStore) RecordPriceTables(ctx context.Context, priceTableUpdate []ho
return nil // nothing to do
}

// Only allow for applying one batch of interactions at a time.
ss.interactionsMu.Lock()
defer ss.interactionsMu.Unlock()

// Get keys from input.
keyMap := make(map[publicKey]struct{})
var hks []publicKey
Expand Down
13 changes: 0 additions & 13 deletions stores/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,10 +1298,6 @@ func (s *SQLStore) RecordContractSpending(ctx context.Context, records []api.Con
return nil // nothing to do
}

// Only allow for applying one batch of spending records at a time.
s.spendingMu.Lock()
defer s.spendingMu.Unlock()

squashedRecords := make(map[types.FileContractID]api.ContractSpending)
latestValues := make(map[types.FileContractID]struct {
revision uint64
Expand Down Expand Up @@ -1648,9 +1644,6 @@ func (s *SQLStore) DeleteHostSector(ctx context.Context, hk types.PublicKey, roo
}

func (s *SQLStore) UpdateObject(ctx context.Context, bucket, path, contractSet, eTag, mimeType string, o object.Object) error {
s.objectsMu.Lock()
defer s.objectsMu.Unlock()

// Sanity check input.
for _, s := range o.Slabs {
for i, shard := range s.Shards {
Expand Down Expand Up @@ -1771,9 +1764,6 @@ func (s *SQLStore) Slab(ctx context.Context, key object.EncryptionKey) (object.S
}

func (ss *SQLStore) UpdateSlab(ctx context.Context, s object.Slab, contractSet string) error {
ss.objectsMu.Lock()
defer ss.objectsMu.Unlock()

// sanity check the shards don't contain an empty root
for _, s := range s.Shards {
if s.Root == (types.Hash256{}) {
Expand Down Expand Up @@ -1923,9 +1913,6 @@ LIMIT ?
`, now.Unix(), refreshHealthBatchSize)
var rowsAffected int64
err := s.retryTransaction(func(tx *gorm.DB) error {
s.objectsMu.Lock()
defer s.objectsMu.Unlock()

// create temp table from the health query since we will reuse it
if err := tx.Exec("DROP TABLE IF EXISTS src").Error; err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions stores/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ type (
closed bool

knownContracts map[types.FileContractID]struct{}

spendingMu sync.Mutex
interactionsMu sync.Mutex
objectsMu sync.Mutex
}

revisionUpdate struct {
Expand Down

0 comments on commit 94ca2dc

Please sign in to comment.