Skip to content

Commit 7955b12

Browse files
committed
Minor fix in to_string, added a size parameter to the test
The SST to_string should unpack joiner IP addresses with inet_ntoa, since the point of this string is to be human-readable for debugging. The signature race condition doesn't seem to show up in signed_log_test, just in CascadeChain, so maybe the problem is signed_log_test uses updates that are so small they complete quickly.
1 parent 954aa43 commit 7955b12

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/applications/tests/unit_tests/signed_log_test.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,30 +313,32 @@ std::unique_ptr<UnsignedObject> UnsignedObject::from_bytes(mutils::Deserializati
313313
}
314314

315315
/**
316-
* Command-line arguments: <one_field_size> <two_field_size> <unsigned_size> <num_updates>
316+
* Command-line arguments: <one_field_size> <two_field_size> <unsigned_size> <num_updates> <update_size>
317317
* one_field_size: Maximum size of the subgroup that replicates the one-field signed object
318318
* two_field_size: Maximum size of the subgroup that replicates the two-field signed object
319319
* mixed_field_size: Maximum size of the subgroup that replicates the mixed-signed-and-unsigned-field object
320320
* unsigned_size: Maximum size of the subgroup that replicates the persistent-but-not-signed object
321-
* num_updates: Number of randomly-generated 32-byte updates to send to each subgroup
321+
* num_updates: Number of randomly-generated updates to send to each subgroup
322+
* update_size: Size of the updates, in bytes
322323
*/
323324
int main(int argc, char** argv) {
324325
pthread_setname_np(pthread_self(), "test_main");
325326
const std::string characters("abcdefghijklmnopqrstuvwxyz");
326327
std::mt19937 random_generator(getpid());
327328
std::uniform_int_distribution<std::size_t> char_distribution(0, characters.size() - 1);
328-
const int num_args = 5;
329+
const int num_args = 6;
329330
if(argc < (num_args + 1) || (argc > (num_args + 1) && strcmp("--", argv[argc - (num_args + 1)]) != 0)) {
330331
std::cout << "Invalid command line arguments." << std::endl;
331-
std::cout << "Usage: " << argv[0] << " [derecho-config-options -- ] one_field_size two_field_size mixed_field_size unsigned_size num_updates" << std::endl;
332+
std::cout << "Usage: " << argv[0] << " [derecho-config-options -- ] one_field_size two_field_size mixed_field_size unsigned_size num_updates update_size" << std::endl;
332333
return -1;
333334
}
334335

335336
const unsigned int subgroup_1_size = std::stoi(argv[argc - num_args]);
336337
const unsigned int subgroup_2_size = std::stoi(argv[argc - num_args + 1]);
337338
const unsigned int subgroup_mixed_size = std::stoi(argv[argc - num_args + 2]);
338339
const unsigned int subgroup_unsigned_size = std::stoi(argv[argc - num_args + 3]);
339-
const unsigned int num_updates = std::stoi(argv[argc - 1]);
340+
const unsigned int num_updates = std::stoi(argv[argc - num_args + 4]);
341+
const unsigned int update_size = std::stoi(argv[argc - 1]);
340342
derecho::Conf::initialize(argc, argv);
341343

342344
derecho::SubgroupInfo subgroup_info(
@@ -401,7 +403,7 @@ int main(int argc, char** argv) {
401403
test_state.my_subgroup_is_unsigned = false;
402404
//Send random updates
403405
for(unsigned counter = 0; counter < num_updates; ++counter) {
404-
std::string new_string('a', 32);
406+
std::string new_string('a', update_size);
405407
std::generate(new_string.begin(), new_string.end(),
406408
[&]() { return characters[char_distribution(random_generator)]; });
407409
object_handle.ordered_send<RPC_NAME(update_state)>(new_string);
@@ -414,8 +416,8 @@ int main(int argc, char** argv) {
414416
test_state.my_subgroup_is_unsigned = false;
415417
//Send random updates
416418
for(unsigned counter = 0; counter < num_updates; ++counter) {
417-
std::string new_foo('a', 32);
418-
std::string new_bar('a', 32);
419+
std::string new_foo('a', update_size);
420+
std::string new_bar('a', update_size);
419421
std::generate(new_foo.begin(), new_foo.end(),
420422
[&]() { return characters[char_distribution(random_generator)]; });
421423
std::generate(new_bar.begin(), new_bar.end(),
@@ -430,7 +432,7 @@ int main(int argc, char** argv) {
430432
test_state.my_subgroup_is_unsigned = false;
431433
//Send random updates, alternating between the signed, unsigned, and nonpersistent fields
432434
for(unsigned counter = 0; counter < num_updates; ++counter) {
433-
std::string new_string_value('a', 32);
435+
std::string new_string_value('a', update_size);
434436
std::generate(new_string_value.begin(), new_string_value.end(),
435437
[&]() { return characters[char_distribution(random_generator)]; });
436438
if(counter % 3 == 0) {
@@ -449,7 +451,7 @@ int main(int argc, char** argv) {
449451
test_state.my_subgroup_is_unsigned = true;
450452
//Send random updates
451453
for(unsigned counter = 0; counter < num_updates; ++counter) {
452-
std::string new_string('a', 32);
454+
std::string new_string('a', update_size);
453455
std::generate(new_string.begin(), new_string.end(),
454456
[&]() { return characters[char_distribution(random_generator)]; });
455457
object_handle.ordered_send<RPC_NAME(update_state)>(new_string);

src/core/derecho_sst.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <derecho/core/detail/derecho_sst.hpp>
22

3+
#include <arpa/inet.h>
34
#include <atomic>
45
#include <cstring>
56

@@ -129,7 +130,7 @@ std::string DerechoSST::to_string() const {
129130
}
130131
s << "}, joiner_ips={ ";
131132
for(int n = 0; n < (num_changes[row] - num_installed[row]); ++n) {
132-
s << joiner_ips[row][n] << " ";
133+
s << inet_ntoa(in_addr{joiner_ips[row][n]}) << " ";
133134
}
134135
s << "}, joiner_gms_ports={ ";
135136
for(int n = 0; n < (num_changes[row] - num_installed[row]); ++n) {
@@ -170,7 +171,7 @@ std::string DerechoSST::to_string() const {
170171
s << (global_min_ready[row] ? "T" : "F") << " ";
171172
}
172173
s << "}"
173-
<< "local_stability_frontier={";
174+
<< ", local_stability_frontier={";
174175
for(unsigned int n = 0; n < local_stability_frontier.size(); n++) {
175176
s << local_stability_frontier[row][n] << " ";
176177
}

src/core/git_version.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace derecho {
1313
const int MAJOR_VERSION = 2;
1414
const int MINOR_VERSION = 4;
1515
const int PATCH_VERSION = 1;
16-
const int COMMITS_AHEAD_OF_VERSION = 6;
16+
const int COMMITS_AHEAD_OF_VERSION = 7;
1717
const char* VERSION_STRING = "2.4.1";
18-
const char* VERSION_STRING_PLUS_COMMITS = "2.4.1+6";
18+
const char* VERSION_STRING_PLUS_COMMITS = "2.4.1+7";
1919

2020
}

0 commit comments

Comments
 (0)