|
27 | 27 | ENGINE_ERROR_CODE select_bucket(Cookie& cookie, const std::string& bucketname) { |
28 | 28 | auto& connection = cookie.getConnection(); |
29 | 29 | if (!connection.isAuthenticated()) { |
| 30 | + cookie.setErrorContext("Not authenticated"); |
| 31 | + LOG_INFO( |
| 32 | + "{}: select_bucket failed - Not authenticated. " |
| 33 | + R"({{"cid":"{}/{:x}","connection":"{}","bucket":"{}"}})", |
| 34 | + connection.getId(), |
| 35 | + connection.getConnectionId().data(), |
| 36 | + ntohl(cookie.getRequest().getOpaque()), |
| 37 | + connection.getDescription(), |
| 38 | + bucketname); |
30 | 39 | return ENGINE_EACCESS; |
31 | 40 | } |
32 | 41 |
|
33 | 42 | // We can't switch bucket if we've got multiple commands in flight |
34 | 43 | if (connection.getNumberOfCookies() > 1) { |
35 | 44 | LOG_INFO( |
36 | | - "{}: {} select_bucket [{}] is not possible with multiple " |
37 | | - "commands in flight", |
| 45 | + "{}: select_bucket failed - multiple commands in flight. " |
| 46 | + R"({{"cid":"{}/{:x}","connection":"{}","bucket":"{}"}})", |
38 | 47 | connection.getId(), |
39 | | - bucketname, |
40 | | - connection.getDescription()); |
| 48 | + connection.getConnectionId().data(), |
| 49 | + ntohl(cookie.getRequest().getOpaque()), |
| 50 | + connection.getDescription(), |
| 51 | + bucketname); |
41 | 52 | return ENGINE_ENOTSUP; |
42 | 53 | } |
43 | 54 |
|
@@ -72,6 +83,14 @@ ENGINE_ERROR_CODE select_bucket(Cookie& cookie, const std::string& bucketname) { |
72 | 83 | return ENGINE_KEY_ENOENT; |
73 | 84 | } |
74 | 85 | } catch (const cb::rbac::Exception&) { |
| 86 | + LOG_INFO( |
| 87 | + "{}: select_bucket failed - No access. " |
| 88 | + R"({{"cid":"{}/{:x}","connection":"{}","bucket":"{}"}})", |
| 89 | + connection.getId(), |
| 90 | + connection.getConnectionId().data(), |
| 91 | + ntohl(cookie.getRequest().getOpaque()), |
| 92 | + connection.getDescription(), |
| 93 | + bucketname); |
75 | 94 | return ENGINE_EACCESS; |
76 | 95 | } |
77 | 96 | } |
|
0 commit comments