Skip to content

Commit caedfa3

Browse files
committed
dbhelper MySQL
1 parent 7e2d215 commit caedfa3

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

dashboard/app.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<tr><td><span ng-if="settings.confgroup==''" class="label label-primary">DEFAULT</span><span ng-if="settings.confgroup!=''" class="label label-warning">{{settings.confgroup}}</span></td><td><span class="label label-warning">{{settings.topology}}</span></td></tr>
113113
</table>
114114

115-
115+
116116
</div>
117117
<div flex-gt-xs="10" ></div>
118118
<div flex-gt-xs="60" class="col-lg-66">
@@ -136,10 +136,12 @@
136136
<tr>
137137
<th>Host</th>
138138
<th>Port</th>
139+
<th>Version</th>
139140
<th>Status</th>
140-
<th>Using GTID</th>
141-
<th>Current GTID</th>
142-
<th>Slave GTID Pos</th>
141+
<th ng-if="server.DBVersion.Flavor=='MariaDB'">Using GTID</th>
142+
<th ng-if="server.DBVersion.Flavor=='MariaDB'">Current GTID</th>
143+
<th ng-if="server.DBVersion.Flavor=='MariaDB'">Slave GTID Pos</th>
144+
<th ng-if="server.DBVersion.Flavor!='MariaDB'">Executed GTID Set</th>
143145
<th>IO Thread</th>
144146
<th>SQL Thread</th>
145147
<th>Delay</th>
@@ -152,12 +154,14 @@
152154
<tr ng-repeat="server in servers" ng-class="{'active':server.State=='Master','danger': server.State=='SlaveErr','warning': server.State=='SlaveLate' }">
153155
<td>{{server.Host}}</td>
154156
<td>{{server.Port}}</td>
157+
<td>{{server.DBVersion.Flavor}} {{server.DBVersion.Major}}.{{server.DBVersion.Minor}}</td>
155158
<td>{{server.State}}</td>
156-
<td>{{server.UsingGtid}}</td>
157-
<td>{{gtidstring(server.CurrentGtid)}}</td>
158-
<td>{{gtidstring(server.SlaveGtid)}}</td>
159+
<td ng-if="server.DBVersion.Flavor=='MariaDB'">{{server.UsingGtid}}</td>
160+
<td ng-if="server.DBVersion.Flavor=='MariaDB'">{{gtidstring(server.CurrentGtid)}}</td>
161+
<td ng-if="server.DBVersion.Flavor=='MariaDB'">{{gtidstring(server.SlaveGtid)}}</td>
162+
<td ng-if="server.DBVersion.Flavor!='MariaDB'">{{server.GTIDExecuted}}</td>
159163
<td>{{server.IOThread}}</td>
160-
<td>{{server.SQLThread }}</td>
164+
<td>{{server.SQLThread}}</td>
161165
<td>{{server.Delay.Int64}}</td>
162166
<td>{{server.ReadOnly}}</td>
163167
<td>{{server.FailCount}}/{{server.FailSuspectHeartbeat}}</td>

dbhelper/mysql.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// MySQL related functions
2+
3+
package dbhelper
4+
5+
import "github.com/jmoiron/sqlx"
6+
7+
func HasMySQLGTID(db *sqlx.DB) (bool, error) {
8+
myvar, _ := GetDBVersion(db)
9+
if myvar.IsMariaDB() {
10+
return false, nil
11+
}
12+
val, err := GetVariableByName(db, "ENFORCE_GTID_CONSISTENCY")
13+
if err != nil || val == "OFF" {
14+
return false, err
15+
}
16+
val, err = GetVariableByName(db, "GTID_MODE")
17+
if err != nil || val == "OFF" {
18+
return false, err
19+
}
20+
return true, nil
21+
}

0 commit comments

Comments
 (0)