RLock shard during diagnostics

pull/2351/head
Philip O'Toole 2015-04-20 13:48:23 -07:00
parent 833b46c562
commit ec57f8c84f
3 changed files with 10 additions and 2 deletions

View File

@ -17,7 +17,7 @@
- [#2300](https://github.com/influxdb/influxdb/pull/2300): Refactor integration tests. Properly close Graphite/OpenTSDB listeners. - [#2300](https://github.com/influxdb/influxdb/pull/2300): Refactor integration tests. Properly close Graphite/OpenTSDB listeners.
- [#2338](https://github.com/influxdb/influxdb/pull/2338): Fix panic if tag key isn't double quoted when it should have been - [#2338](https://github.com/influxdb/influxdb/pull/2338): Fix panic if tag key isn't double quoted when it should have been
- [#2340](https://github.com/influxdb/influxdb/pull/2340): Fix SHOW DIAGNOSTICS panic if any shard was non-local. - [#2340](https://github.com/influxdb/influxdb/pull/2340): Fix SHOW DIAGNOSTICS panic if any shard was non-local.
- [#2351](https://github.com/influxdb/influxdb/pull/2351): Fix data race by rlocking shard during diagnostics.
## v0.9.0-rc25 [2015-04-15] ## v0.9.0-rc25 [2015-04-15]

View File

@ -3302,7 +3302,7 @@ func (s *Server) DiagnosticsAsRows() []*influxql.Row {
for _, n := range sh.DataNodeIDs { for _, n := range sh.DataNodeIDs {
nodes = append(nodes, strconv.FormatUint(n, 10)) nodes = append(nodes, strconv.FormatUint(n, 10))
shardsRow.Values = append(shardsRow.Values, []interface{}{now, strconv.FormatUint(sh.ID, 10), shardsRow.Values = append(shardsRow.Values, []interface{}{now, strconv.FormatUint(sh.ID, 10),
strings.Join(nodes, ","), strconv.FormatUint(sh.index, 10)}) strings.Join(nodes, ","), strconv.FormatUint(sh.Index(), 10)})
} }
// Shard may not be local to this node. // Shard may not be local to this node.
if sh.store != nil { if sh.store != nil {

View File

@ -133,6 +133,14 @@ func shardMetaIndex(tx *bolt.Tx) uint64 {
return index return index
} }
// Index returns the highest Raft index processed by this shard. Shard RLock
// held during execution.
func (s *Shard) Index() uint64 {
s.mu.RLock()
defer s.mu.RUnlock()
return s.index
}
// close shuts down the shard's store. // close shuts down the shard's store.
func (s *Shard) close() error { func (s *Shard) close() error {
// Wait for goroutines to stop. // Wait for goroutines to stop.