Documentation ¶
Overview ¶
Copyright 2021 SANGFOR TECHNOLOGIES
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func CheckAndRecoverGenericProblem(analysisEntry dtstruct.ReplicationAnalysis, ...) (bool, *dtstruct.TopologyRecovery, error)
- func ForgetInstance(instanceKey *dtstruct.InstanceKey) error
- func GetCandidateSiblingOfMaster(topologyRecovery *dtstruct.TopologyRecovery, ...) (*odtstruct.OpenGaussInstance, error)
- func GetCheckAndRecoverFunction(analysisCode dtstruct.AnalysisCode, analyzedInstanceKey *dtstruct.InstanceKey) (...)
- func GetDownStreamInstance(downstreamKeyList []dtstruct.InstanceKey) ([]*odtstruct.OpenGaussInstance, error)
- func GetDuplicateInstance(instanceKey *dtstruct.InstanceKey, clusterName string) ([]*odtstruct.OpenGaussInstance, error)
- func GetInfoFromInstance(ctx context.Context, instanceKey *dtstruct.InstanceKey, ...) (inst *odtstruct.OpenGaussInstance, err error)
- func GetReplicationAnalysis(clusterName, clusterId string, hints *dtstruct.ReplicationAnalysisHints) ([]dtstruct.ReplicationAnalysis, error)
- func GetSyncInfo(instanceKey *dtstruct.InstanceKey) (interface{}, error)
- func GracefulMasterTakeover(clusterName string, designatedKey *dtstruct.InstanceKey, auto bool) (*dtstruct.TopologyRecovery, *dtstruct.LogCoordinates, error)
- func NodeOperation(ctx context.Context, instanceKey *dtstruct.InstanceKey, ...) (detail interface{}, err error)
- func OpenTopology(host string, port int, args ...interface{}) (db *sql.DB, err error)
- func ReadFromBackendDB(instanceKey *dtstruct.InstanceKey) (*odtstruct.OpenGaussInstance, bool, error)
- func ReadInstancesByCondition(query string, condition string, args []interface{}, sort string) ([]*odtstruct.OpenGaussInstance, error)
- func RecoverDeadMaster(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
- func RecoverDeadMasterWithoutReplicas(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
- func RecoverDeadReplica(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
- func RecoverDownInstance(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
- func RecoverDuplicatePrimary(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
- func RelocateBelow(downstreamInstKey, upstreamInstKey *dtstruct.InstanceKey) (interface{}, error)
- func ReplicationConfirm(failedKey *dtstruct.InstanceKey, streamKey *dtstruct.InstanceKey, ...) bool
- func RestartReplication(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
- func RowToInstance(m sqlutil.RowMap) *odtstruct.OpenGaussInstance
- func StartReplica(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
- func StopReplication(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
- func Topology(request *dtstruct.Request, historyTimestampPattern string, tabulated bool, ...) (result interface{}, err error)
- func UpdateInstanceCheck(upstream *dtstruct.InstanceKey, downstream *dtstruct.InstanceKey)
- func WriteToBackendDB(ctx context.Context, instances []dtstruct.InstanceAdaptor, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAndRecoverGenericProblem ¶
func CheckAndRecoverGenericProblem(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool) (bool, *dtstruct.TopologyRecovery, error)
func ForgetInstance ¶
func ForgetInstance(instanceKey *dtstruct.InstanceKey) error
ForgetInstance delete instance from table
func GetCandidateSiblingOfMaster ¶
func GetCandidateSiblingOfMaster(topologyRecovery *dtstruct.TopologyRecovery, intermediateMasterInstance *odtstruct.OpenGaussInstance) (*odtstruct.OpenGaussInstance, error)
GetCandidateSiblingOfMaster chooses the best sibling of a dead intermediate master to whom the IM's replicas can be moved.
func GetCheckAndRecoverFunction ¶
func GetCheckAndRecoverFunction(analysisCode dtstruct.AnalysisCode, analyzedInstanceKey *dtstruct.InstanceKey) ( checkAndRecoverFunction func(analysisEntry dtstruct.ReplicationAnalysis, candidateInstanceKey *dtstruct.InstanceKey, forceInstanceRecovery bool, skipProcesses bool) (recoveryAttempted bool, topologyRecovery *dtstruct.TopologyRecovery, err error), isActionableRecovery bool, )
GetCheckAndRecoverFunction get function for recover
func GetDownStreamInstance ¶
func GetDownStreamInstance(downstreamKeyList []dtstruct.InstanceKey) ([]*odtstruct.OpenGaussInstance, error)
GetDownStreamInstance get all downstream instances for upstream
func GetDuplicateInstance ¶
func GetDuplicateInstance(instanceKey *dtstruct.InstanceKey, clusterName string) ([]*odtstruct.OpenGaussInstance, error)
GetDuplicateInstance
func GetInfoFromInstance ¶
func GetInfoFromInstance(ctx context.Context, instanceKey *dtstruct.InstanceKey, checkOnly, bufferWrites bool, latency *stopwatch.NamedStopwatch, agentAddr string) (inst *odtstruct.OpenGaussInstance, err error)
GetInfoFromInstance create new instance according to instanceKey, get instance info by agent and write to backend database
func GetReplicationAnalysis ¶
func GetReplicationAnalysis(clusterName, clusterId string, hints *dtstruct.ReplicationAnalysisHints) ([]dtstruct.ReplicationAnalysis, error)
GetReplicationAnalysis will check for replication problems (dead upstream; unreachable upstream; etc) clusterId='x' means analysis all clusters
func GetSyncInfo ¶
func GetSyncInfo(instanceKey *dtstruct.InstanceKey) (interface{}, error)
GetSyncInfo get sync percent for instance
func GracefulMasterTakeover ¶
func GracefulMasterTakeover(clusterName string, designatedKey *dtstruct.InstanceKey, auto bool) (*dtstruct.TopologyRecovery, *dtstruct.LogCoordinates, error)
GracefulMasterTakeover will demote master of existing topology and promote its direct replica instead.
func NodeOperation ¶
func NodeOperation(ctx context.Context, instanceKey *dtstruct.InstanceKey, operationType aodtstruct.ActionType) (detail interface{}, err error)
NodeOperation connect to agent, and send action request to agent
func OpenTopology ¶
OpenTopology get db client to remote opengauss instance
func ReadFromBackendDB ¶
func ReadFromBackendDB(instanceKey *dtstruct.InstanceKey) (*odtstruct.OpenGaussInstance, bool, error)
ReadFromBackendDB reads an instance from the backend database We know there will be at most one (hostname & port are PK) and we expect to find one
func ReadInstancesByCondition ¶
func ReadInstancesByCondition(query string, condition string, args []interface{}, sort string) ([]*odtstruct.OpenGaussInstance, error)
ReadInstancesByCondition is a generic function to read instances from the backend database
func RecoverDeadMaster ¶
func RecoverDeadMaster(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
RecoverDeadIntermediateMaster performs intermediate master recovery; complete logic inside
func RecoverDeadMasterWithoutReplicas ¶
func RecoverDeadMasterWithoutReplicas(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
func RecoverDeadReplica ¶
func RecoverDeadReplica(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
func RecoverDownInstance ¶
func RecoverDownInstance(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
func RecoverDuplicatePrimary ¶
func RecoverDuplicatePrimary(topologyRecovery *dtstruct.TopologyRecovery, skipProcesses bool) (successorInstance *odtstruct.OpenGaussInstance, err error)
func RelocateBelow ¶
func RelocateBelow(downstreamInstKey, upstreamInstKey *dtstruct.InstanceKey) (interface{}, error)
RelocateBelow change upstream and downstream role by switch over
func ReplicationConfirm ¶
func ReplicationConfirm(failedKey *dtstruct.InstanceKey, streamKey *dtstruct.InstanceKey, upstream bool) bool
ReplicationConfirm check if replication between instance and stream is normal
func RestartReplication ¶
func RestartReplication(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
RestartReplication restart replication
func RowToInstance ¶
func RowToInstance(m sqlutil.RowMap) *odtstruct.OpenGaussInstance
RowToInstance reads a single instance row from the backend database.
func StartReplica ¶
func StartReplica(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
StartReplica
func StopReplication ¶
func StopReplication(ctx context.Context, instanceKey *dtstruct.InstanceKey) (interface{}, error)
StopReplication stop replication
func Topology ¶
func Topology(request *dtstruct.Request, historyTimestampPattern string, tabulated bool, printTags bool) (result interface{}, err error)
Topology show opengauss topology
func UpdateInstanceCheck ¶
func UpdateInstanceCheck(upstream *dtstruct.InstanceKey, downstream *dtstruct.InstanceKey)
UpdateInstanceCheck insert or update downstream instance to backend database
func WriteToBackendDB ¶
func WriteToBackendDB(ctx context.Context, instances []dtstruct.InstanceAdaptor, instanceWasActuallyFound bool, updateLastSeen bool) error
WriteToBackendDB write all instance to backend database
Types ¶
This section is empty.