Skip to content

Commit

Permalink
colmem: audit callers of AdjustMemoryUsage
Browse files Browse the repository at this point in the history
This commit audits all callers of `Allocator.AdjustMemoryUsage` to use
the newly-exported `AdjustMemoryUsageAfterAllocation` where applicable
(meaning that if an allocation occurs before the method is called, then
the new method is now used). In many cases this won't result in a change
in the behavior since the allocators are not instantiated with limited
memory accounts, but in some cases it is still useful.

Release justification: bug fix.

Release note: None
  • Loading branch information
yuzefovich committed Aug 18, 2022
1 parent 8e3c88d commit 0be82d9
Show file tree
Hide file tree
Showing 42 changed files with 204 additions and 200 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/any_not_null_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (a *anyNotNull_TYPE_AGGKINDAgg) Compute(
)
execgen.SETVARIABLESIZE(newCurAggSize, a.curAgg)
if newCurAggSize != oldCurAggSize {
a.allocator.AdjustMemoryUsage(int64(newCurAggSize - oldCurAggSize))
a.allocator.AdjustMemoryUsageAfterAllocation(int64(newCurAggSize - oldCurAggSize))
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/avg_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (a *avg_TYPE_AGGKINDAgg) Compute(
// {{end}}
execgen.SETVARIABLESIZE(newCurSumSize, a.curSum)
if newCurSumSize != oldCurSumSize {
a.allocator.AdjustMemoryUsage(int64(newCurSumSize - oldCurSumSize))
a.allocator.AdjustMemoryUsageAfterAllocation(int64(newCurSumSize - oldCurSumSize))
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/bool_and_or_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (a *bool_OP_TYPE_AGGKINDAgg) Compute(
// {{end}}
execgen.SETVARIABLESIZE(newCurAggSize, a.curAgg)
if newCurAggSize != oldCurAggSize {
a.allocator.AdjustMemoryUsage(int64(newCurAggSize - oldCurAggSize))
a.allocator.AdjustMemoryUsageAfterAllocation(int64(newCurAggSize - oldCurAggSize))
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/concat_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (a *concat_AGGKINDAgg) Compute(
// {{end}}
execgen.SETVARIABLESIZE(newCurAggSize, a.curAgg)
if newCurAggSize != oldCurAggSize {
a.allocator.AdjustMemoryUsage(int64(newCurAggSize - oldCurAggSize))
a.allocator.AdjustMemoryUsageAfterAllocation(int64(newCurAggSize - oldCurAggSize))
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/default_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (a *default_AGGKINDAggAlloc) newAggFunc() AggregateFunc {
}
f.allocator = a.allocator
f.scratch.otherArgs = a.otherArgsScratch
a.allocator.AdjustMemoryUsage(f.fn.Size())
a.allocator.AdjustMemoryUsageAfterAllocation(f.fn.Size())
a.aggFuncs = a.aggFuncs[1:]
a.returnedFns = append(a.returnedFns, f)
return f
Expand Down
22 changes: 11 additions & 11 deletions pkg/sql/colexec/colexecagg/hash_any_not_null_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pkg/sql/colexec/colexecagg/hash_avg_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sql/colexec/colexecagg/hash_bool_and_or_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/hash_concat_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/hash_default_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0be82d9

Please sign in to comment.