From 3dc03738bc6bfc37cbbe14f185ebfe64556ad334 Mon Sep 17 00:00:00 2001 From: Asias He Date: Fri, 29 May 2015 10:59:00 +0800 Subject: [PATCH] storage_service: Add debug info in gossip state change callback Now, we can verify that get_tokens_for(ip) get the correct tokens through gossip. Start the seed node first: $./seastar --listen-address 127.0.0.1 --seed-provider-parameters 127.0.0.1 Then start a normal node: $./seastar --listen-address 127.0.0.2 --seed-provider-parameters 127.0.0.1 On the second node: SS::on_join endpoint=127.0.0.1 endpoint=127.0.0.1, tokens_string=8768e8a2d360bce8;d99d50eae7e514a2;f937ba030e4f1fa2 t=87 68 e8 a2 d3 60 bc e8 t=d9 9d 50 ea e7 e5 14 a2 t=f9 37 ba 03 0e 4f 1f a2 ep=127.0.0.1, eps=EndpointState: HeartBeatState = generation = 1432868747, version = 52, AppStateMap = { 0 : Value(BOOT,TOKENS,11) } { 5 : Value(urchin_1_0,4) } { 8 : Value(,3) } { 11 : Value(ms_1_0,1) } { 12 : Value(9a6e8c60-05af-11e5-b9b8-000000000000,2) } { 13 : Value(8768e8a2d360bce8;d99d50eae7e514a2;f937ba030e4f1fa2,9) } --- service/storage_service.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/service/storage_service.hh b/service/storage_service.hh index 3ce7d6ebf7..ac77879cd3 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -645,6 +645,9 @@ private: // FIXME: SystemKeyspace.incrementAndGetGeneration() return gossiper.start(generation_number, app_states).then([] { print("Start gossiper service ...\n"); +#if SS_DEBUG + gms::get_local_gossiper().debug_show(); +#endif }); #if 0 // gossip snitch infos (local DC and rack) @@ -1330,6 +1333,7 @@ public: */ void on_change(gms::inet_address endpoint, gms::application_state state, gms::versioned_value value) override { + ss_debug("SS::on_change endpoint=%s\n", endpoint); #if 0 if (state == ApplicationState.STATUS) { @@ -1976,6 +1980,11 @@ private: public: void on_join(gms::inet_address endpoint, gms::endpoint_state ep_state) override { + ss_debug("SS::on_join endpoint=%s\n", endpoint); + auto tokens = get_tokens_for(endpoint); + for (auto t : tokens) { + ss_debug("t=%s\n", t); + } #if 0 for (Map.Entry entry : epState.getApplicationStateMap().entrySet()) { @@ -1987,6 +1996,7 @@ public: void on_alive(gms::inet_address endpoint, gms::endpoint_state state) override { + ss_debug("SS::on_alive endpoint=%s\n", endpoint); #if 0 MigrationManager.instance.scheduleSchemaPull(endpoint, state);