Skip to content

Commit 7a64173

Browse files
author
Gleez Technologies
committed
Code format
1 parent 1785a8e commit 7a64173

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ADD . /go/src/github.com/sandeepone/mysql-manticore
88
RUN cd /go/src/github.com/sandeepone/mysql-manticore \
99
&& COMMIT_SHA=$(git rev-parse --short HEAD) \
1010
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w \
11-
-X main.version=0.2 \
11+
-X main.version=0.3 \
1212
-X main.revision=${COMMIT_SHA}" \
1313
-a -tags netgo -installsuffix netgo -o mysql-manticore cmd/mysql-manticore/main.go
1414

river/status.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (s *stat) run() (err error) {
215215
s.log.Errorf("error creating listener at addr %s: %v", addr, err)
216216
return
217217
}
218-
s.log.Infof("started status http server at %s", addr)
218+
s.log.Infof("Started status http server at %s", addr)
219219

220220
s.lastRowEvent = time.Now()
221221
s.startedAt = time.Now()
@@ -232,9 +232,10 @@ func (s *stat) run() (err error) {
232232
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
233233
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
234234

235-
mux.Handle("/rebuild", handleRebuildRedir())
236-
mux.Handle("/rebuild/sync", handleRebuild(s.r, true))
237-
mux.Handle("/rebuild/async", handleRebuild(s.r, false))
235+
// mux.Handle("/rebuild", handleRebuildRedir())
236+
// mux.Handle("/rebuild/sync", handleRebuild(s.r, true))
237+
// mux.Handle("/rebuild/async", handleRebuild(s.r, false))
238+
238239
mux.Handle("/maint", handleMaint(s.r))
239240
mux.Handle("/wait", handleWaitForGTID(s.r))
240241

@@ -334,54 +335,63 @@ func handleRebuild(r *River, sync bool) http.HandlerFunc {
334335
func handleMaint(r *River) http.HandlerFunc {
335336
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
336337
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
338+
337339
if req.Method != http.MethodPost {
338340
w.WriteHeader(http.StatusMethodNotAllowed)
339341
w.Write([]byte("unexpected method\n"))
340342
return
341343
}
344+
342345
index := req.URL.Query().Get("index")
343346
if index == "" {
344347
w.WriteHeader(http.StatusBadRequest)
345348
w.Write([]byte("index not specified\n"))
346349
return
347350
}
351+
348352
dataSource, exists := r.c.DataSource[index]
349353
if !exists {
350354
w.WriteHeader(http.StatusNotFound)
351355
w.Write([]byte(fmt.Sprintf("index %s not found\n", index)))
352356
return
353357
}
358+
354359
err := r.sphinxService.CheckIndexForOptimize(index, dataSource.Parts)
355360
if err != nil {
356361
w.WriteHeader(http.StatusInternalServerError)
357362
w.Write([]byte(errors.ErrorStack(err) + "\n"))
358363
return
359364
}
365+
360366
w.WriteHeader(http.StatusNoContent)
361367
})
362368
}
363369

364370
func handleWaitForGTID(r *River) http.HandlerFunc {
365371
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
366372
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
373+
367374
if req.Method != http.MethodPost {
368375
w.WriteHeader(http.StatusMethodNotAllowed)
369376
w.Write([]byte("unexpected method\n"))
370377
return
371378
}
379+
372380
req.ParseForm()
373381
gtidString := req.PostForm.Get("gtid")
374382
if gtidString == "" {
375383
w.WriteHeader(http.StatusBadRequest)
376384
w.Write([]byte("gtid not specified\n"))
377385
return
378386
}
387+
379388
gtid, err := mysql.ParseGTIDSet(r.c.Flavor, gtidString)
380389
if err != nil {
381390
w.WriteHeader(http.StatusUnprocessableEntity)
382391
w.Write([]byte("invalid gtid specified\n"))
383392
return
384393
}
394+
385395
timeoutString := req.PostForm.Get("timeout")
386396
var timerC <-chan time.Time
387397
if timeoutString != "" {

0 commit comments

Comments
 (0)