InfluxDB写流程

Influxdb version1.8

HTTP:

0x00000000016d0ce3 in github.com/influxdata/influxdb/coordinator.(*PointsWriter).WritePoints

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/coordinator/points_writer.go:286

 1  0x0000000001a73482 in github.com/influxdata/influxdb/services/httpd.(*Handler).serveWrite

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:819

 2  0x0000000001a8b17c in github.com/influxdata/influxdb/services/httpd.(*Handler).serveWrite-fm

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:715

 3  0x0000000001a88171 in github.com/influxdata/influxdb/services/httpd.authenticate.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1571

 4  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

 5  0x0000000001a890eb in github.com/influxdata/influxdb/services/httpd.(*Handler).responseWriter.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1756

 6  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

 7  0x0000000001a86bde in github.com/influxdata/influxdb/services/httpd.gzipFilter.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/gzip.go:39

 8  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

 9  0x0000000001a8826f in github.com/influxdata/influxdb/services/httpd.cors.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1698

10  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

11  0x0000000001a88bb4 in github.com/influxdata/influxdb/services/httpd.requestID.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1729

12  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

13  0x0000000001a88d5f in github.com/influxdata/influxdb/services/httpd.(*Handler).logging.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1737

14  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

15  0x0000000001a895f7 in github.com/influxdata/influxdb/services/httpd.(*Handler).recovery.func1

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:1793

16  0x000000000134fc04 in net/http.HandlerFunc.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1995

17  0x00000000018e47b3 in github.com/bmizerany/pat.(*PatternServeMux).ServeHTTP

    at /Users/chenxianpao/Go_1/src/github.com/bmizerany/pat/mux.go:117

18  0x0000000001a6fdfc in github.com/influxdata/influxdb/services/httpd.(*Handler).ServeHTTP

    at /Users/chenxianpao/Go_1/src/github.com/influxdata/influxdb/services/httpd/handler.go:386

19  0x0000000001352ed8 in net/http.serverHandler.ServeHTTP

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:2774

20  0x000000000134ebc1 in net/http.(*conn).serve

    at /usr/local/Cellar/go/1.12.4/libexec/src/net/http/server.go:1878

21  0x000000000105e4f1 in runtime.goexit

    at /usr/local/Cellar/go/1.12.4/libexec/src/runtime/asm_amd64.s:1337

 

// WritePoints writes metadata and point data into the engine.
// It returns an error if new points are added to an existing key.
func (e *Engine) WritePoints(points []models.Point) error {
    ....
    // first try to write to the cache
    if err := e.Cache.WriteMulti(values); err != nil {
        return err
    }

    if e.WALEnabled {
        if _, err := e.WAL.WriteMulti(values); err != nil {
            return err
        }
    }
}

先写Cache,再写WAL。由Compactor定期刷入TSM本地文件。

posted @ 2019-04-24 20:22  陈小跑  阅读(518)  评论(0编辑  收藏  举报