Commit Graph

32 Commits

Author SHA1 Message Date
Avi Kivity
171fe67a64 gms: remove unneeded #include "types.hh" 2017-08-27 15:18:57 +03:00
Gleb Natapov
8ca1432b04 Distribute cache temperature over gossiper.
When a node start it does not have any information about cache temperature
of other nodes in the cluster and it is hard (if not impossible) to make
right guess. During cluster startup all nodes have cold caches, so there
is no point to redirect reads to other nodes even though local cache it
cold, but if only that node restarted than other nodes have populated
cache and reads should be redirected.

The node will get up-to-date information about other nodes caches,
but only after receiving first reply, until then it does not have the
information to make right decisions which may cause unwanted spikes
immediately after restart. Having cache temperature in gossiper helps
to solve the problem.
2017-06-13 09:57:14 +03:00
Pekka Enberg
47a904c0f6 Merge "gossip: Introduce SUPPORTED_FEATURES" from Asias
"There is a need to have an ability to detect whether a feature is
supported by entire cluster. The way to do it is to advertise feature
availability over gossip and then each node will be able to check if all
other nodes have a feature in question.

The idea is to have new application state SUPPORTED_FEATURES that will contain
set of strings, each string holding feature name.

This series adds API to do so.

The following patch on top of this series demostreates how to wait for features
during boot up. FEATURE1 and FEATURE2 are introduced. We use
wait_for_feature_on_all_node to wait for FEATURE1 and FEATURE2 successfully.
Since FEATURE3 is not supported, the wait will not succeed, the wait will timeout.

   --- a/service/storage_service.cc
   +++ b/service/storage_service.cc
   @@ -95,7 +95,7 @@ sstring storage_service::get_config_supported_features() {
        // Add features supported by this local node. When a new feature is
        // introduced in scylla, update it here, e.g.,
        // return sstring("FEATURE1,FEATURE2")
   -    return sstring("");
   +    return sstring("FEATURE1,FEATURE2");
    }

    std::set<inet_address> get_seeds() {
   @@ -212,6 +212,11 @@ void storage_service::prepare_to_join() {
        // gossip snitch infos (local DC and rack)
        gossip_snitch_info().get();

   +    gossiper.wait_for_feature_on_all_node(std::set<sstring>{sstring("FEATURE1"), sstring("FEATURE2")}, std::chrono::seconds(30)).get();
   +    logger.info("Wait for FEATURE1 and FEATURE2 done");
   +    gossiper.wait_for_feature_on_all_node(std::set<sstring>{sstring("FEATURE3")}).get();
   +    logger.info("Wait for FEATURE3 done");
   +

We can query the supported_features:

    cqlsh> SELECT supported_features from system.peers;

     supported_features
    --------------------
      FEATURE1,FEATURE2
      FEATURE1,FEATURE2

    (2 rows)
    cqlsh> SELECT supported_features from system.local;

     supported_features
    --------------------
      FEATURE1,FEATURE2

    (1 rows)"
2016-04-08 09:22:50 +03:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Asias He
e0a82a1107 gossip: Add supported_features helper in versioned_value
Give a supported features sstring, return a versioned_value for it.
2016-04-06 07:12:34 +08:00
Asias He
d7c7994f37 gossip: Drop unused serialization code
- versioned_value
2016-01-25 11:28:29 +08:00
Amnon Heiman
8a4d211a99 Changes the versioned_value to make serializeble
This patch contains two changes, it make the constructor with parameters
public. And it removes the dependency in messaging_service.hh from the
header file by moving some of the code to the .cc file.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2016-01-24 12:13:01 +02:00
Asias He
fa3c84db10 gossip: Kill default constructor for versioned_value
The only reason we needed it is to make
   _application_state[key] = value
work.

With the current default constructor, we increase the version number
needlessly. To fix and to be safe, remove the default constructor
completely.
2015-12-09 12:29:15 +08:00
Vlad Zolotarov
564cb2bcd1 gms::versioned_value: don't use to_sstring_sprintf() directly
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-12-06 12:24:54 +02:00
Asias He
f62a6f234b gossip: Add shutdown gossip state
Backported: CASSANDRA-8336 and CASSANDRA-9871

84b2846 remove redundant state
b2c62bb Add shutdown gossip state to prevent timeouts during rolling restarts
8f9ca07 Cannot replace token does not exist - DN node removed as Fat Client

Fixes:

When X is shutdown, X sends SHUTDOWN message to both Y and Z, but for
some reason, only Y receives the message and Z does not receive the
message. If Z has a higher gossip version for X than Y has for
X, Z will initiate a gossip with Y and Y will mark X alive again.

X ------> Y
 \      /
  \    /
    Z
2015-12-01 17:29:25 +08:00
Asias He
23723991ed gossip: Fix STATUS field in nodetool gossipinfo
Before:
   === with c* cluster ===
   $ nodetool -p 7100 gossipinfo

   STATUS:NORMAL,-1139428872328849340

   === with scylla ===
   $ nodetool -p 7100 gossipinfo

   0:NORMAL,8251763528961471825;-9147358554612963965;5334343410266177046

After:
   === with scylla ===
   $ nodetool -p 7100 gossipinfo

   0:NORMAL,8251763528961471825

To align with c*, print one token in the STATUS field.

Refs #508.
2015-11-20 10:57:49 +02:00
Asias He
80f1b9781a gossip: Simplify make_token_string with boost::adaptors::transformed 2015-10-23 16:13:31 +08:00
Asias He
6b7ca7e334 gossip: Cleanup versioned_value class 2015-10-23 10:06:19 +08:00
Asias He
5556861ac0 gossip: Fix nodetool gossipinfo
Use dht::global_partitioner().{to_sstring and from_sstring) to handle
tokens.

Before:
$ nodetool -p 7199  gossipinfo
127.0.0.1
  generation:1445528714
  heartbeat:105
  0:NORMAL,TOKENS
  2:c1e6c9ef-22c8-3f93-bca1-ea5810bafd36
  3:datacenter1
  4:rack1
  5:2.1.8
  8:127.0.0.1
  11:0
  12:d24aef9c-fc4e-4290-92f4-1fd317b8883a

After:
$ nodetool -p 7199  gossipinfo
127.0.0.1
  generation:1445528714
  heartbeat:105
  0:NORMAL,-3524784140453853209;2276970246802708341;-4108982606669659076
  2:c1e6c9ef-22c8-3f93-bca1-ea5810bafd36
  3:datacenter1
  4:rack1
  5:2.1.8
  8:127.0.0.1
  11:0
  12:d24aef9c-fc4e-4290-92f4-1fd317b8883a
2015-10-23 09:40:59 +08:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Asias He
ad4008d50e gms: Fix release_version
With this patch, the release_version column in system.peers is now correct.
2015-08-27 11:01:08 +03:00
Asias He
b16eb27c58 gms/versioned_value: Fix rpcaddress 2015-07-21 17:00:15 +08:00
Asias He
ba04f0bc6b gms/versioned_value: Fix network_version 2015-07-21 17:00:15 +08:00
Asias He
fa2aee57ac utils: Move util/serialization.hh to utils/serialization.hh
Now we will not have the ugly utils and util directories, only utils.
2015-07-21 16:12:54 +08:00
Vlad Zolotarov
1e32bdf090 gms: added missing operator==() required for endpoint_state_map comparison.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-09 15:18:46 +03:00
Asias He
9c5cd2bca8 storage_service: Switch to use unordered_set for tokens
We do not care about the order of the tokens.

Also, in token_metadata, we use unordered_set for tokens as well, e.g.
update_normal_tokens. Unify the usage.
2015-06-04 17:12:09 +08:00
Asias He
1e289018ea gossip: Implement versioned_value for tokens
Tokens are store in versioned_value hex string split by semicolon, e.g.:

9f6fd6dd5149e39c;59068b2415190651;63684ccb1b73c1e3
2015-06-01 11:24:38 +08:00
Asias He
ff099c44ce gossip: Convert more versioned_value 2015-05-27 15:03:29 +08:00
Asias He
87a8d1f77e gossip: Convert more versioned_value factory functions 2015-05-26 16:16:52 +08:00
Asias He
7ac5277822 gossip: Fix link error with versioned_value
With the next patch "gossip: Add storage_service_value_factory helper"
in this series.

[asias@hjpc urchin]$ ninja-build

[8/10] LINK build/release/seastar

build/release/gms/gossiper.o: In function
`gms::versioned_value::versioned_value_factory::removing_nonlocal(utils::UUID
const&)':
/home/asias/src/cloudius-systems/urchin/./gms/versioned_value.hh:201:
undefined reference to `gms::versioned_value::DELIMITER_STR'
build/release/gms/gossiper.o: In function
`gms::versioned_value::versioned_value_factory::removal_coordinator(utils::UUID
const&)':
/home/asias/src/cloudius-systems/urchin/./gms/versioned_value.hh:211:
undefined reference to `gms::versioned_value::DELIMITER_STR'
build/release/gms/gossiper.o: In function
`gms::versioned_value::versioned_value_factory::removed_nonlocal(utils::UUID
const&, long)':
/home/asias/src/cloudius-systems/urchin/./gms/versioned_value.hh:206:
undefined reference to `gms::versioned_value::DELIMITER_STR'
/home/asias/src/cloudius-systems/urchin/./gms/versioned_value.hh:206:
undefined reference to `gms::versioned_value::DELIMITER_STR'
collect2: error: ld returned 1 exit status

Fix by defining the symbol in gms/versioned_value.cc.
2015-05-07 15:29:13 +08:00
Asias He
5f0050dc97 gossip: Fix add_application_state
If the key exists, we should update the new value.
2015-04-23 14:55:26 +08:00
Asias He
eeafdf5815 gossip: Make gms::versioned_value::load static
We are supposed to call it without an instance.
We will convert other similar functions in follow up patches.
2015-04-16 17:03:46 +08:00
Asias He
5f2c156d41 gossip: Convert to use bytes version of serialize 2015-03-16 12:46:37 +01:00
Asias He
818136cfd7 gossip: Add "operator<<" for class versioned_value
Will be used by class endpoint_state.
2015-03-09 20:45:20 +08:00
Asias He
c2052c8791 gossip: Convert to bytes_view for deserialization 2015-03-05 18:25:57 +08:00
Asias He
d5f0ce2663 gossip: Add missing #pragma once 2015-03-04 15:51:35 +08:00
Nadav Har'El
65f8ee2e5c gossip: Convert gms/VersionedValue.java to C++
Left some of the stuff I got tired of converting in #if 0. Most likely
I'll need them later, and convert them then.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-04 15:48:58 +08:00