diff --git a/digest_algorithm.hh b/digest_algorithm.hh index 26e31b0c11..ae52eb6a59 100644 --- a/digest_algorithm.hh +++ b/digest_algorithm.hh @@ -25,8 +25,8 @@ namespace query { enum class digest_algorithm : uint8_t { none = 0, // digest not required - MD5 = 1, // default algorithm - xxHash = 2, + MD5 = 1, + xxHash = 2,// default algorithm }; } diff --git a/idl/query.idl.hh b/idl/query.idl.hh index b2aa14dbc8..6aca9a59fa 100644 --- a/idl/query.idl.hh +++ b/idl/query.idl.hh @@ -31,7 +31,8 @@ class query_result stub [[writable]] { enum class digest_algorithm : uint8_t { none = 0, // digest not required - MD5 = 1, // default algorithm + MD5 = 1, + xxHash = 2,// default algorithm }; } diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 65ad986185..b67e777132 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -2457,7 +2457,9 @@ public: }; query::digest_algorithm digest_algorithm() { - return query::digest_algorithm::MD5; + return service::get_local_storage_service().cluster_supports_xxhash_digest_algorithm() + ? query::digest_algorithm::xxHash + : query::digest_algorithm::MD5; } class abstract_read_executor : public enable_shared_from_this { diff --git a/service/storage_service.cc b/service/storage_service.cc index 199ea1747b..aba80db83e 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -92,6 +92,7 @@ static const sstring CORRECT_COUNTER_ORDER_FEATURE = "CORRECT_COUNTER_ORDER"; static const sstring SCHEMA_TABLES_V3 = "SCHEMA_TABLES_V3"; static const sstring CORRECT_NON_COMPOUND_RANGE_TOMBSTONES = "CORRECT_NON_COMPOUND_RANGE_TOMBSTONES"; static const sstring WRITE_FAILURE_REPLY_FEATURE = "WRITE_FAILURE_REPLY"; +static const sstring XXHASH_FEATURE = "XXHASH"; distributed _the_storage_service; @@ -139,6 +140,7 @@ sstring storage_service::get_config_supported_features() { SCHEMA_TABLES_V3, CORRECT_NON_COMPOUND_RANGE_TOMBSTONES, WRITE_FAILURE_REPLY_FEATURE, + XXHASH_FEATURE, }; if (service::get_local_storage_service()._db.local().get_config().experimental()) { features.push_back(MATERIALIZED_VIEWS_FEATURE); @@ -351,6 +353,7 @@ void storage_service::register_features() { _schema_tables_v3 = gms::feature(SCHEMA_TABLES_V3); _correct_non_compound_range_tombstones = gms::feature(CORRECT_NON_COMPOUND_RANGE_TOMBSTONES); _write_failure_reply_feature = gms::feature(WRITE_FAILURE_REPLY_FEATURE); + _xxhash_feature = gms::feature(XXHASH_FEATURE); if (_db.local().get_config().experimental()) { _materialized_views_feature = gms::feature(MATERIALIZED_VIEWS_FEATURE); diff --git a/service/storage_service.hh b/service/storage_service.hh index c689b73a6c..76b64e4051 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -275,6 +275,7 @@ private: gms::feature _schema_tables_v3; gms::feature _correct_non_compound_range_tombstones; gms::feature _write_failure_reply_feature; + gms::feature _xxhash_feature; public: void enable_all_features() { _range_tombstones_feature.enable(); @@ -287,6 +288,7 @@ public: _schema_tables_v3.enable(); _correct_non_compound_range_tombstones.enable(); _write_failure_reply_feature.enable(); + _xxhash_feature.enable(); } void finish_bootstrapping() { @@ -2259,6 +2261,10 @@ public: bool cluster_supports_write_failure_reply() const { return bool(_write_failure_reply_feature); } + + bool cluster_supports_xxhash_digest_algorithm() const { + return bool(_xxhash_feature); + } }; inline future<> init_storage_service(distributed& db, sharded& auth_service) {