)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1004368,"name":"Richard de Mellow","email":"richard.demellow@couchbase.com","username":"rdemellow","avatars":[{"url":"https://www.gravatar.com/avatar/35c97da872c07458f5e5bc4938b2489f.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/35c97da872c07458f5e5bc4938b2489f.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/35c97da872c07458f5e5bc4938b2489f.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/35c97da872c07458f5e5bc4938b2489f.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"d11e235969541dade8cc477a38ff6b5f7fc554c6","unresolved":true,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"MB-27146: add err msg for non-KVnode cbstats calls"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Instead of raising \"mc_bin_client.ErrorKeyEnoent: Memcached error #1:"},{"line_number":10,"context_line":"KEY_ENOENT : Not Found :\" any time a cbstats call is executed against a"},{"line_number":11,"context_line":"node that is not running the Data (KV) Service, catch and specifically"},{"line_number":12,"context_line":"handle this error - printing a more user-friendly error message."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I26f41ed3ec4f14fa5259bc182978503a8e872c4c"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"0a3d5757_8b27f7b3","line":12,"range":{"start_line":9,"start_character":0,"end_line":12,"end_character":64},"updated":"2022-03-17 09:28:36.000000000","message":"If you try to connect to a non data node on:11200 what happens? Have you tested this as I thought it would just wouldn\u0027t connect rather than not give us stats?","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"},{"author":{"_account_id":1004851,"name":"Douglas","email":"douglas.3598032@couchbase.com","username":"redm2","avatars":[{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"8b30eca33a7fe5d94b96d06592a35a751f4b4900","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"MB-27146: add err msg for non-KVnode cbstats calls"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Instead of raising \"mc_bin_client.ErrorKeyEnoent: Memcached error #1:"},{"line_number":10,"context_line":"KEY_ENOENT : Not Found :\" any time a cbstats call is executed against a"},{"line_number":11,"context_line":"node that is not running the Data (KV) Service, catch and specifically"},{"line_number":12,"context_line":"handle this error - printing a more user-friendly error message."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I26f41ed3ec4f14fa5259bc182978503a8e872c4c"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"ba91dc2f_42b7ab05","line":12,"range":{"start_line":9,"start_character":0,"end_line":12,"end_character":64},"in_reply_to":"0a3d5757_8b27f7b3","updated":"2022-03-17 14:15:47.000000000","message":"Yeah, errors with KEY_ENOENT for non-data nodes but stats call succeeds on a data node.","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"}],"engines/ep/management/cli_auth_utils.py":[{"author":{"_account_id":1000966,"name":"Dave Rigby","email":"daver@couchbase.com","username":"drigby","avatars":[{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"8e9bdedc11027fa2417c63ae6dca61deeb66d5a8","unresolved":true,"context_lines":[{"line_number":111,"context_line":"                  \"or bucket does not exist.\".format(bucket))"},{"line_number":112,"context_line":"            sys.exit(1)"},{"line_number":113,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":114,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":115,"context_line":"            sys.exit(1)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    return g"}],"source_content_type":"text/x-python","patch_set":2,"id":"e58505af_45d3d036","line":114,"updated":"2022-03-18 17:06:03.000000000","message":"Style: \n\n- First letter of sentence is not capitalised.\n- Exclamation mark isn\u0027t in line with other messages.\n- Message is arguably still at bit prescriptive - it doesn\u0027t actually tell the user what the problem is par-se. I\u0027d suggest something more along the lines of describing what the problem is (that no bucket with the given name exists), and then possible solutions.\n\nNote from looking at the code (https://github.com/couchbase/kv_engine/blob/master/daemon/protocol/mcbp/select_bucket_executor.cc#L63), it _appears_ that key_enoent could still be returned for a case where the specified bucket name doesn\u0027t exist. Out of interest what happens if the allBuckets (-a?) argument to cbstats is passed when you target a non- Data Service node?","commit_id":"d009b4be697520bd0493c04992d0ecd033808393"},{"author":{"_account_id":1004851,"name":"Douglas","email":"douglas.3598032@couchbase.com","username":"redm2","avatars":[{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"3e0a1b9a87800008236fe49294a70820210968ac","unresolved":true,"context_lines":[{"line_number":111,"context_line":"                  \"or bucket does not exist.\".format(bucket))"},{"line_number":112,"context_line":"            sys.exit(1)"},{"line_number":113,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":114,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":115,"context_line":"            sys.exit(1)"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    return g"}],"source_content_type":"text/x-python","patch_set":2,"id":"2532260f_f8c823cf","line":114,"in_reply_to":"e58505af_45d3d036","updated":"2022-03-28 14:06:23.000000000","message":"Good points, thanks. Passing -a returns \"No accessible buckets found\" because of https://github.com/couchbase/kv_engine/blob/master/engines/ep/management/cli_auth_utils.py#L94-L97.\n\nSince, AIUI:\n* All nodes run memcached, but without the Data Service configured there are no buckets present;\n* The !mayAccessBucket (https://github.com/couchbase/kv_engine/blob/master/daemon/protocol/mcbp/select_bucket_executor.cc#L26) block is entered only if the bucket was not explicitly named as accessible to the user, and the user does not have wildcard permissions;\n* associate_bucket returns false if there is no bucket found with that name, or there is but it is in a state other than Ready\n\nBoth of these conditions must hold to fall through to key_enoent, i.e.,\n* User must have a permissions entry to that bucket name, or a wildcard entry\n* No Ready bucket with the given name [at the time the lock is held] on the specified node\u0027s memcached\n\nSo key_enoent is raised when either:\n(1) the bucket doesn\u0027t exist and the user has wildcard permissions;\n(2) the bucket exists in the _cluster_ (and so the permissions map), but this is a non-data node and so no bucket with that name is found by memcached;\n\nBut it\u0027s also raised in cases we may want to be more explicit about:\n(3) The user has permissions and the bucket exists but is not yet active on the supplied node (e.g., Creating, Initializing, Stopping, Destroying).","commit_id":"d009b4be697520bd0493c04992d0ecd033808393"}],"engines/ep/management/clitool.py":[{"author":{"_account_id":1000966,"name":"Dave Rigby","email":"daver@couchbase.com","username":"drigby","avatars":[{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/514e75a8d75cc1fcdb22433d445ae8f1.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"d501311655a5b5d209a3b13ac4b319a0decd4816","unresolved":true,"context_lines":[{"line_number":92,"context_line":"            else:"},{"line_number":93,"context_line":"                raise"},{"line_number":94,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":95,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":96,"context_line":"            return"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def format_command_list(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5eb6d131_bd4ec85f","line":95,"updated":"2022-03-18 09:45:12.000000000","message":"I think this catch is too general / assuming what the underlying problem is.\n\nFrom the MB\u0027s backtrace, the mc_bin_client exception being thrown was from the bucket_select() method, when the specified bucket does not exist.\n\nI believe that exception could equally be printed if the specified bucket does not exist, but the node is otherwise a valid Data Service node (some context: we run memcached on _all_ cluster nodes for the purposes of client bootstrap, but on non Data Service nodes they have no buckets at all present.\n\nI think you need to add an exception handler in a more specific place - say the `g` function in cli_auth_utils.py.\n\nIn terms of testing, I would experiment with what behaviour you see from cbstats when:\n\n1. Requesting stats from a Data Service node for a valid bucket name and which the user has access to.\n2. As (1), but bucket name which does not exist.\n3. As (1), but for a bucket which the user does not have permission to access.\n4. Requesting stats from a non- Data Service node (which by definition has zero buckets) with a valid username / password\n5. As (4), but with an invalid username password.\n\nIn all cases, we should aim to give an error message which is meaningful, but doesn\u0027t mislead the user. For example, I believe at the moment for case (2) your current error message \"cbstats must be executed against a data node\" will be printed.","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"},{"author":{"_account_id":1004851,"name":"Douglas","email":"douglas.3598032@couchbase.com","username":"redm2","avatars":[{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"28f28b4495d90d9771305f5b5d6cbc24e2cdd482","unresolved":true,"context_lines":[{"line_number":92,"context_line":"            else:"},{"line_number":93,"context_line":"                raise"},{"line_number":94,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":95,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":96,"context_line":"            return"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def format_command_list(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"e0fd3e2c_1749d094","line":95,"in_reply_to":"243e464a_dc3b8003","updated":"2022-03-18 15:48:15.000000000","message":"(and the try/except is less catchy)","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"},{"author":{"_account_id":1004851,"name":"Douglas","email":"douglas.3598032@couchbase.com","username":"redm2","avatars":[{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"e221f7f324150b8166d5836337e357292c8ba40f","unresolved":true,"context_lines":[{"line_number":92,"context_line":"            else:"},{"line_number":93,"context_line":"                raise"},{"line_number":94,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":95,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":96,"context_line":"            return"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def format_command_list(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"cf3b1ca9_2f65bd48","line":95,"in_reply_to":"5eb6d131_bd4ec85f","updated":"2022-03-18 15:42:06.000000000","message":"Good point. I didn\u0027t test permissions etc., but seem to have gotten away with it this time since all those cases work as expected:\n(1) Success\n(2) \"No access to bucket:{bucket} - permission denied or bucket does not exist.\"\n(3) \"No access to bucket:{bucket} - permission denied or bucket does not exist.\"\n(4) \"cbstats must be executed against a data node!\"\n(5) \"Authentication error for user:{user} bucket:{bucket}","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"},{"author":{"_account_id":1004851,"name":"Douglas","email":"douglas.3598032@couchbase.com","username":"redm2","avatars":[{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/0b72991cd0c2b88a575af79166516630.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d120","height":120}]},"change_message_id":"f88d8470529c58b1eec1a25d89e0514f09639235","unresolved":true,"context_lines":[{"line_number":92,"context_line":"            else:"},{"line_number":93,"context_line":"                raise"},{"line_number":94,"context_line":"        except mc_bin_client.ErrorKeyEnoent:"},{"line_number":95,"context_line":"            print(\"cbstats must be executed against a data node!\")"},{"line_number":96,"context_line":"            return"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    def format_command_list(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"243e464a_dc3b8003","line":95,"in_reply_to":"cf3b1ca9_2f65bd48","updated":"2022-03-18 15:43:58.000000000","message":"That\u0027s not to say all cases work, though. Will move to g in cli_auth_utils.py since that\u0027s where the other exceptions are already.","commit_id":"2804a8e2486cfde3f1e668a83504994af046b61b"}]}
