Documentation
¶
Index ¶
- func DisplayNodeSimplestForm(ctx LogCtx, ip string) string
- func Identifier(ctx LogCtx) string
- type Conflict
- type ConflictVote
- type Conflicts
- type Date
- type LocalTimeline
- type LogCtx
- func (ctx *LogCtx) AddOwnHash(hash string)
- func (ctx *LogCtx) AddOwnIP(ip string)
- func (ctx *LogCtx) AddOwnName(name string)
- func (ctx *LogCtx) AllNodeNames() []string
- func (ctx *LogCtx) HasVisibleEvents(level Verbosity) bool
- func (ctx *LogCtx) HashesFromIP(ip string) []string
- func (ctx *LogCtx) HashesFromNodeName(nodename string) []string
- func (ctx *LogCtx) IPsFromNodeName(nodename string) []string
- func (base *LogCtx) Inherit(ctx LogCtx)
- func (ctx *LogCtx) IsPrimary() bool
- func (l LogCtx) MarshalJSON() ([]byte, error)
- func (base *LogCtx) MergeMapsWith(ctxs []LogCtx)
- func (ctx *LogCtx) OwnHostname() string
- func (ctx *LogCtx) SetState(s string)
- func (ctx LogCtx) State() string
- type LogDisplayer
- type LogInfo
- type LogRegex
- type NodeInfo
- type RegexMap
- type RegexType
- type SST
- type Timeline
- type Verbosity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayNodeSimplestForm ¶
DisplayNodeSimplestForm is useful to get the most easily to read string for a given IP This only has impacts on display In order of preference: wsrep_node_name (or galera "node" name), hostname, ip
func Identifier ¶ added in v1.2.0
Identifier is used to identify a node timeline. It will the column headers It will also impacts how logs are merged if we have multiple logs per nodes
In order of preference: wsrep_node_name (or galera "node" name), hostname, ip, filepath
Types ¶
type Conflict ¶ added in v1.2.0
type Conflict struct {
Seqno string
InitiatedBy []string
Winner string // winner will help the winning md5sum
VotePerNode map[string]ConflictVote
}
type ConflictVote ¶ added in v1.2.0
type Conflicts ¶ added in v1.2.0
type Conflicts []*Conflict
func (Conflicts) ConflictFromMD5 ¶ added in v1.2.0
func (Conflicts) ConflictWithSeqno ¶ added in v1.2.0
func (Conflicts) OldestUnresolved ¶ added in v1.2.0
type LocalTimeline ¶
type LocalTimeline []LogInfo
It should be kept already sorted by timestamp
func CutTimelineAt ¶
func CutTimelineAt(t LocalTimeline, at time.Time) LocalTimeline
CutTimelineAt returns a localtimeline with the 1st event starting right after the time sent as parameter
func MergeTimeline ¶
func MergeTimeline(t1, t2 LocalTimeline) LocalTimeline
MergeTimeline is helpful when log files are split by date, it can be useful to be able to merge content a "timeline" come from a log file. Log files that came from some node should not never have overlapping dates
func (LocalTimeline) Add ¶ added in v1.1.0
func (lt LocalTimeline) Add(li LogInfo) LocalTimeline
type LogCtx ¶
type LogCtx struct {
FilePath string
FileType string
OwnIPs []string
OwnHashes []string
OwnNames []string
Version string
SST SST
MyIdx string
MemberCount int
Desynced bool
HashToIP map[string]string
HashToNodeName map[string]string
IPToHostname map[string]string
IPToMethod map[string]string
IPToNodeName map[string]string
Conflicts Conflicts
// contains filtered or unexported fields
}
LogCtx is a context for a given file. It is the principal storage of this tool Everything relevant will be stored here
func (*LogCtx) AddOwnHash ¶
AddOwnHash propagates a hash into the translation maps
func (*LogCtx) AddOwnName ¶
AddOwnName propagates a name into the translation maps using the trusted node's known own hashes and ips
func (*LogCtx) AllNodeNames ¶
func (*LogCtx) HasVisibleEvents ¶ added in v1.1.1
func (*LogCtx) HashesFromIP ¶
func (*LogCtx) HashesFromNodeName ¶
func (*LogCtx) IPsFromNodeName ¶
func (*LogCtx) Inherit ¶ added in v1.1.1
Inherit will fill the local information from given context into the base It is used when merging, so that we do not start from nothing It helps when dealing with many small files
func (LogCtx) MarshalJSON ¶ added in v1.2.0
func (*LogCtx) MergeMapsWith ¶
MergeMapsWith will take a slice of contexts and merge every translation maps into the base context. It won't touch "local" infos such as "ownNames"
func (*LogCtx) OwnHostname ¶
func (*LogCtx) SetState ¶ added in v1.1.1
SetState will double-check if the STATE exists, and also store it on the correct status
func (LogCtx) State ¶
State will return the wsrep state of the current file type That is because for operator related logs, we have every type of files Not tracking and differenciating by file types led to confusions in most subcommands as it would seem that sometimes mysql is restarting after a crash, while actually the operator was simply launching a "wsrep-recover" instance while mysql was still running
type LogDisplayer ¶
LogDisplayer is the handler to generate messages thanks to a context The context in parameters should be as updated as possible
func SimpleDisplayer ¶
func SimpleDisplayer(s string) LogDisplayer
SimpleDisplayer satisfies LogDisplayer and ignores any context received
type LogInfo ¶
type LogInfo struct {
Date *Date
Log string // the raw log
RegexType RegexType
RegexUsed string
Ctx LogCtx // the context is copied for each logInfo, so that it is easier to handle some info (current state), and this is also interesting to check how it evolved
Verbosity Verbosity
RepetitionCount int
// contains filtered or unexported fields
}
LogInfo is to store a single event in log. This is something that should be displayed ultimately, this is what we want when we launch this tool
func NewLogInfo ¶ added in v1.1.0
func (*LogInfo) IsDuplicatedEvent ¶ added in v1.1.0
IsDuplicatedEvent will aim to keep 2 occurences of the same event To be considered duplicated, they must be from the same regexes and have the same message
type LogRegex ¶
type LogRegex struct {
Regex *regexp.Regexp // to send to grep, should be as simple as possible but without collisions
InternalRegex *regexp.Regexp // for internal usage in handler func
Type RegexType
// Taking into arguments the current context and log line, returning an updated context and a closure to get the msg to display
// Why a closure: to later inject an updated context instead of the current partial context
// This ensure every hash/ip/nodenames are already known when crafting the message
Handler func(map[string]string, LogCtx, string) (LogCtx, LogDisplayer)
Verbosity Verbosity // To be able to hide details from summaries
}
func (*LogRegex) MarshalJSON ¶ added in v1.0.2
type NodeInfo ¶
type NodeInfo struct {
Input string `json:"input"`
IPs []string `json:"IPs"`
NodeNames []string `json:"nodeNames"`
Hostname string `json:"hostname"`
NodeUUIDs []string `json:"nodeUUIDs:"`
}
NodeInfo is mainly used by "whois" subcommand This is to display its result As it's the base work for "sed" subcommand, it's in types package
type Timeline ¶
type Timeline map[string]LocalTimeline
"string" key is a node IP
func (*Timeline) GetLatestUpdatedContextsByNodes ¶
func (Timeline) IterateNode ¶
iterateNode is used to search the source node(s) that contains the next chronological events it returns a slice in case 2 nodes have their next event precisely at the same time, which happens a lot on some versions