Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove spendingMu, interactionsMu and objectsMu #796

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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: 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 @@ -1300,10 +1300,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 @@ -1650,9 +1646,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 @@ -1773,9 +1766,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 @@ -1925,9 +1915,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