Skip to content

Commit dc46a93

Browse files
authored
Miscellaneous bugfixes (#2)
* Fixes metadata tier ID parsing in monitoring system * Fixes node join re-gossip bug: The join_remove_set was not being cleared after messaging, so the system attempted to gossip the same keys over and over again (and crashed).
1 parent 0c4389d commit dc46a93

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ More detailed instructions on [building](docs/building-anna.md) and [running](do
2020

2121
## License
2222

23-
The Hydro Project is licensed under the [Apache v2 License](LICENSE).
23+
The Hydro Project is licensed under the [Apache v2 License](LICENSE).

include/metadata.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern hmap<Tier, TierMetadata, TierEnumHash> kTierMetadata;
100100

101101
enum MetadataType { replication, server_stats, key_access, key_size };
102102

103-
inline Key get_metadata_key(const ServerThread &st, unsigned tier_id,
103+
inline Key get_metadata_key(const ServerThread &st, Tier tier_id,
104104
unsigned thread_num, MetadataType type) {
105105
string metadata_type;
106106

@@ -122,7 +122,7 @@ inline Key get_metadata_key(const ServerThread &st, unsigned tier_id,
122122
return kMetadataIdentifier + kMetadataDelimiter + metadata_type +
123123
kMetadataDelimiter + st.public_ip() + kMetadataDelimiter +
124124
st.private_ip() + kMetadataDelimiter + std::to_string(thread_num) +
125-
kMetadataDelimiter + std::to_string(tier_id);
125+
kMetadataDelimiter + Tier_Name(tier_id);
126126
}
127127

128128
// This version of the function should only be called with

include/proto/metadata.proto

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2019 U.C. Berkeley RISE Lab
2-
//
2+
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,6 @@ message KeyAccessData {
4141
// The number of times this key was accessed during this epoch.
4242
uint32 access_count = 2;
4343
}
44-
4544
// A list of all the key access frequencies tracked during this epoch.
4645
repeated KeyCount keys = 1;
4746
}
@@ -71,11 +70,11 @@ message ClusterMembership {
7170
message Server {
7271
// The public IP address for a server.
7372
string public_ip = 1;
74-
73+
7574
// The private IP address for a server.
7675
string private_ip = 2;
7776
}
78-
77+
7978
// The Tier represented by this message -- either MEMORY or DISK.
8079
Tier tier_id = 1;
8180

@@ -93,15 +92,15 @@ message KeySizeData {
9392
message KeySize {
9493
// The key for which size metadata is being reported.
9594
string key = 1;
96-
95+
9796
// The size of the above key.
9897
uint32 size = 2;
9998
}
100-
99+
101100
// The list of key size metadata tuples being reported.
102101
repeated KeySize key_sizes = 1;
103102
}
104-
103+
105104
// A message that captures the replication factor for an individual key.
106105
message ReplicationFactor {
107106
// A message representing the replication level for a single key at a

src/kvs/server.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,8 @@ void run(unsigned thread_id, Address public_ip, Address private_ip,
670670
// redistribute data after node joins
671671
if (join_gossip_map.size() != 0) {
672672
set<Address> remove_address_set;
673-
674-
// assemble gossip
675673
AddressKeysetMap addr_keyset_map;
674+
676675
for (const auto &join_pair : join_gossip_map) {
677676
Address address = join_pair.first;
678677
set<Key> key_set = join_pair.second;
@@ -710,6 +709,8 @@ void run(unsigned thread_id, Address public_ip, Address private_ip,
710709
serializers[stored_key_map[key].type_]->remove(key);
711710
stored_key_map.erase(key);
712711
}
712+
713+
join_remove_set.clear();
713714
}
714715
}
715716
}

src/monitor/stats_helpers.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ void collect_internal_stats(
6666
string metadata_type = tokens[1];
6767
Address ip_pair = tokens[2] + "/" + tokens[3];
6868
unsigned tid = stoi(tokens[4]);
69-
unsigned tier_id = stoi(tokens[5]);
69+
Tier tier;
70+
Tier_Parse(tokens[5], &tier);
7071

7172
LWWValue lww_value;
7273
lww_value.ParseFromString(tuple.payload());
@@ -76,7 +77,7 @@ void collect_internal_stats(
7677
ServerThreadStatistics stat;
7778
stat.ParseFromString(lww_value.value());
7879

79-
if (tier_id == 1) {
80+
if (tier == MEMORY) {
8081
memory_storage[ip_pair][tid] = stat.storage_consumption();
8182
memory_occupancy[ip_pair][tid] =
8283
std::pair<double, unsigned>(stat.occupancy(), stat.epoch());

0 commit comments

Comments
 (0)