Skip to content

Commit

Permalink
sql: rearrange fields in miscellaneous structs to reduce memory usage
Browse files Browse the repository at this point in the history
This commit simply moves around fields in several structs throughout the
sql directory in order to reduce the amount of padding required to get
the alignment fields. All of these optimizations have been found by
using github.com/orijtech/structslop tool. As a result of this code
movement, most of the modified structs moved into a smaller object size
class (the exceptions are some variations of the generated structs in
colexec which didn't change in size).

Release note: None
  • Loading branch information
yuzefovich committed Nov 18, 2020
1 parent e909f24 commit 2169165
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 315 deletions.
16 changes: 8 additions & 8 deletions pkg/sql/catalog/lease/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,6 @@ func (l *descriptorSet) findVersion(version descpb.DescriptorVersion) *descripto
}

type descriptorState struct {
id descpb.ID
stopper *stop.Stopper

// renewalInProgress is an atomic indicator for when a renewal for a
// lease has begun. This is atomic to prevent multiple routines from
// entering renewal initialization.
renewalInProgress int32

mu struct {
syncutil.Mutex

Expand All @@ -559,6 +551,14 @@ type descriptorState struct {
// ignored.
acquisitionsInProgress int
}

stopper *stop.Stopper
id descpb.ID

// renewalInProgress is an atomic indicator for when a renewal for a
// lease has begun. This is atomic to prevent multiple routines from
// entering renewal initialization.
renewalInProgress int32
}

// ensureVersion ensures that the latest version >= minVersion. It will
Expand Down
Loading

0 comments on commit 2169165

Please sign in to comment.