scylladb / scylladb

NoSQL data store using the seastar framework, compatible with Apache Cassandra
http://scylladb.com
GNU Affero General Public License v3.0
13.46k stars 1.27k forks source link

API: SET storage_service/slow_query command doesn't work #2083

Closed vladzcloudius closed 7 years ago

vladzcloudius commented 7 years ago

Installation details Scylla version (or git commit hash): 8b1d34f39dc3296186470081eb90ce4c8ff18706 Cluster size: 1 OS: Ubuntu 16.04

Description Found on the ccm cluster with a single Node run on a local machine.

$ curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" "http://localhost:10000/storage_service/slow_query?enable=true?ttl=8600?threshold=1"
$ curl -X GET --header "Content-Type: application/json" --header "Accept: application/json" "http://localhost:10000/storage_service/slow_query"
{"threshold": 500000, "enable": false, "ttl": 86400}
vladzcloudius commented 7 years ago

When I printed the enable string received from the following line in api/storage_service.cc: line 706

auto enable = req->get_query_param("enable");

using the following patch:

diff --git a/api/storage_service.cc b/api/storage_service.cc
index 1feabae..8ee253b 100644
--- a/api/storage_service.cc
+++ b/api/storage_service.cc
@@ -715,6 +715,7 @@ void set_storage_service(http_context& ctx, routes& r) {
                     local_tracing.set_slow_query_record_ttl(std::chrono::seconds(std::stol(ttl.c_str())));
                 }
                 if (enable != "") {
+                    printf("Got \"enable\" = %s\n", enable.c_str());
                     local_tracing.set_slow_query_enabled(strcasecmp(enable.c_str(), "true") == 0);
                 }
             }).then([] {

The value was:

Got "enable" = true?ttl=8600?threshold=1

Something is really broken here. ;)

amnonh commented 7 years ago

On Wed, Feb 15, 2017 at 1:34 AM, vladzcloudius notifications@github.com wrote:

Installation details Scylla version (or git commit hash): 8b1d34f https://github.com/scylladb/scylla/commit/8b1d34f39dc3296186470081eb90ce4c8ff18706 Cluster size: 1 OS: Ubuntu 16.04

Description Found on the ccm cluster with a single Node run on a local machine.

$ curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" "http://localhost:10000/storage_service/slow_query?enable=true?ttl=8600?threshold=1" $ curl -X GET --header "Content-Type: application/json" --header "Accept: application/json" "http://localhost:10000/storage_service/slow_query" {"threshold": 500000, "enable": false, "ttl": 86400}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scylladb/scylla/issues/2083, or mute the thread https://github.com/notifications/unsubscribe-auth/ACBRvy1HpnbjV_Qztus7lTEuxGtRBCpUks5rcjnvgaJpZM4MBIXf .

The URL is wrong, when query parameters should use & not ? for multiple parameters your url should be:

http://localhost:10000/storage_service/slow_query?enable=true&ttl=8600&threshold=1 http://localhost:10000/storage_service/slow_query?enable=true?ttl=8600?threshold=1