Merge pull request #2825 from influxdb/jw-logging

Remote write fixes
pull/2823/head
Jason Wilder 2015-06-08 12:47:13 -06:00
commit edc76b2503
3 changed files with 8 additions and 6 deletions

View File

@ -25,9 +25,9 @@ func (c *clientPool) setPool(nodeID uint64, p pool.Pool) {
}
func (c *clientPool) getPool(nodeID uint64) (pool.Pool, bool) {
c.mu.Lock()
c.mu.RLock()
p, ok := c.pool[nodeID]
c.mu.Unlock()
c.mu.RUnlock()
return p, ok
}
@ -42,9 +42,9 @@ func (c *clientPool) size() int {
}
func (c *clientPool) conn(nodeID uint64) (net.Conn, error) {
c.mu.Lock()
c.mu.RLock()
conn, err := c.pool[nodeID].Get()
c.mu.Unlock()
c.mu.RUnlock()
return conn, err
}

View File

@ -43,7 +43,9 @@ func (w *ShardWriter) WriteShard(shardID, ownerID uint64, points []tsdb.Point) e
if !ok {
panic("wrong connection type")
}
defer conn.Close() // return to pool
defer func(conn net.Conn) {
conn.Close() // return to pool
}(conn)
// Build write request.
var request WriteShardRequest

View File

@ -524,7 +524,7 @@ func (l *segment) advance() error {
}
pos := l.pos + l.currentSize + 8
if err := l.writeUint64(uint64(l.pos)); err != nil {
if err := l.writeUint64(uint64(pos)); err != nil {
return err
}