Skip to content

Commit

Permalink
Merge pull request #217 from outbrain/merge-downstream-gh
Browse files Browse the repository at this point in the history
Merge downstream gh
  • Loading branch information
Shlomi Noach authored Jun 14, 2016
2 parents 3c4dafa + bf2ddff commit 83c746b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
set -e

RELEASE_VERSION="1.4.590"
RELEASE_VERSION="1.5.0"
TOPDIR=/tmp/orchestrator-release
export RELEASE_VERSION TOPDIR
export GO15VENDOREXPERIMENT=1
Expand Down
2 changes: 2 additions & 0 deletions go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Configuration struct {
DetectPhysicalEnvironmentQuery string // Optional query (executed on topology instance) that returns the physical environment of an instance. If provided, must return one row, one column. Overrides PhysicalEnvironmentPattern and useful for installments where env cannot be inferred by hostname
DetectSemiSyncEnforcedQuery string // Optional query (executed on topology instance) to determine whether semi-sync is fully enforced for master writes (async fallback is not allowed under any circumstance). If provided, must return one row, one column, value 0 or 1.
SupportFuzzyPoolHostnames bool // Should "submit-pool-instances" command be able to pass list of fuzzy instances (fuzzy means non-fqdn, but unique enough to recognize). Defaults 'true', implies more queries on backend db
InstancePoolExpiryMinutes uint // Time after which entries in database_instance_pool are expired (resubmit via `submit-pool-instances`)
PromotionIgnoreHostnameFilters []string // Orchestrator will not promote slaves with hostname matching pattern (via -c recovery; for example, avoid promoting dev-dedicated machines)
ServeAgentsHttp bool // Spawn another HTTP interface dedicated for orchestrator-agent
AgentsUseSSL bool // When "true" orchestrator will listen on agents port with SSL as well as connect to agents via SSL
Expand Down Expand Up @@ -248,6 +249,7 @@ func newConfiguration() *Configuration {
DetectPhysicalEnvironmentQuery: "",
DetectSemiSyncEnforcedQuery: "",
SupportFuzzyPoolHostnames: true,
InstancePoolExpiryMinutes: 60,
PromotionIgnoreHostnameFilters: []string{},
ServeAgentsHttp: false,
AgentsUseSSL: false,
Expand Down
5 changes: 5 additions & 0 deletions go/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ var generateSQLPatches = []string{
topology_recovery
ADD COLUMN successor_alias varchar(128) DEFAULT NULL
`,
`
ALTER TABLE
database_instance
MODIFY cluster_name varchar(128) NOT NULL
`,
}

// Track if a TLS has already been configured for topology
Expand Down
5 changes: 4 additions & 1 deletion go/inst/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (this *Instance) StatusString() string {
if this.IsSlave() && !(this.Slave_SQL_Running && this.Slave_IO_Running) {
return "nonreplicating"
}
if this.IsSlave() && this.SecondsBehindMaster.Int64 > int64(config.Config.ReasonableMaintenanceReplicationLagSeconds) {
if this.IsSlave() && !this.HasReasonableMaintenanceReplicationLag() {
return "lag"
}
return "ok"
Expand Down Expand Up @@ -439,6 +439,9 @@ func (this *Instance) HumanReadableDescription() string {
if this.UsingPseudoGTID {
tokens = append(tokens, "P-GTID")
}
if this.IsDowntimed {
tokens = append(tokens, "downtimed")
}
description := fmt.Sprintf("[%s]", strings.Join(tokens, ","))
return description
}
14 changes: 14 additions & 0 deletions go/inst/pool_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/outbrain/golib/log"
"github.com/outbrain/golib/sqlutils"
"github.com/outbrain/orchestrator/go/config"
"github.com/outbrain/orchestrator/go/db"
)

Expand Down Expand Up @@ -123,3 +124,16 @@ func ReadClusterPoolInstancesMap(clusterName string, pool string) (*PoolInstance

return &poolInstancesMap, nil
}

// ExpirePoolInstances cleans up the database_instance_pool table from expired items
func ExpirePoolInstances() error {
_, err := db.ExecOrchestrator(`
delete
from database_instance_pool
where
registered_at < now() - interval ? minute
`,
config.Config.InstancePoolExpiryMinutes,
)
return log.Errore(err)
}
1 change: 1 addition & 0 deletions go/logic/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ func ContinuousDiscovery() {
go inst.ExpireClusterDomainName()
go inst.ExpireAudit()
go inst.ExpireMasterPositionEquivalence()
go inst.ExpirePoolInstances()
go inst.FlushNontrivialResolveCacheToDatabase()
go process.ExpireNodesHistory()
go process.ExpireAccessTokens()
Expand Down
3 changes: 2 additions & 1 deletion go/process/health_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package process
import (
"database/sql"
"fmt"
"time"

"github.com/outbrain/golib/log"
"github.com/outbrain/golib/sqlutils"
"github.com/outbrain/orchestrator/go/config"
"github.com/outbrain/orchestrator/go/db"
"time"
)

const registrationPollSeconds = 10
Expand Down

0 comments on commit 83c746b

Please sign in to comment.