Skip to content

Commit

Permalink
Address Spencer's PR comments
Browse files Browse the repository at this point in the history
Changes integer base on capacity gossip keys and adds TODO
for possible speedup.
  • Loading branch information
embark committed Nov 25, 2014
1 parent 32fa1a8 commit adb6600
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gossip/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
KeyConfigZone = "zones"

// KeyMaxAvailCapacityPrefix is the key prefix for gossiping available
// store capacity. The suffix is composed of: <hex node ID>-<hex store ID>.
// store capacity. The suffix is composed of: <node ID>-<store ID>.
// The value is a storage.StoreDescriptor struct.
KeyMaxAvailCapacityPrefix = "max-avail-capacity-"

Expand Down
4 changes: 2 additions & 2 deletions server/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ func (n *Node) gossipCapacities() {
}
// Unique gossip key per store.
keyMaxCapacity := gossip.KeyMaxAvailCapacityPrefix +
strconv.FormatInt(int64(storeDesc.Node.NodeID), 16) + "-" +
strconv.FormatInt(int64(storeDesc.StoreID), 16)
strconv.FormatInt(int64(storeDesc.Node.NodeID), 10) + "-" +
strconv.FormatInt(int64(storeDesc.StoreID), 10)
// Gossip store descriptor.
n.gossip.AddInfo(keyMaxCapacity, *storeDesc, ttlCapacityGossip)
return nil
Expand Down
4 changes: 4 additions & 0 deletions storage/store_finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (s *Store) capacityGossipUpdate(key string, contentsChanged bool) {
//
// If it cannot retrieve a StoreDescriptor from the Store's gossip, it garbage
// collects the failed key.
//
// TODO(embark, spencer): consider using a reverse index map from Attr->stores,
// for efficiency. Ensure that entries in this map still have an opportunity
// to be garbage collected.
func (s *Store) findStores(required proto.Attributes) ([]*StoreDescriptor, error) {
s.finderContext.Lock()
defer s.finderContext.Unlock()
Expand Down

0 comments on commit adb6600

Please sign in to comment.