Skip to content
Merged
Changes from 2 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
9 changes: 8 additions & 1 deletion go/vt/vttablet/tabletserver/schema/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ func (se *Engine) MakePrimary(serving bool) {
se.isServingPrimary = serving
}

// IsServingPrimary returns true if the tablet is currently serving as primary.
func (se *Engine) IsServingPrimary() bool {
se.mu.Lock()
defer se.mu.Unlock()
return se.isServingPrimary
}

// EnableHistorian forces tracking to be on or off.
// Only used for testing.
func (se *Engine) EnableHistorian(enabled bool) error {
Expand Down Expand Up @@ -477,7 +484,7 @@ func (se *Engine) reload(ctx context.Context, includeStats bool) error {
}

// On the primary tablet, we also check the data we have stored in our schema tables to see what all needs reloading.
shouldUseDatabase := se.isServingPrimary && se.schemaCopy
shouldUseDatabase := se.IsServingPrimary() && se.schemaCopy

// changedViews are the views that have changed. We can't use the same createTime logic for views because, MySQL
// doesn't update the create_time field for views when they are altered. This is annoying, but something we have to work around.
Expand Down