Gabriella Lotz has posted comments on this change. ( http://gerrit.cloudera.org:8080/21823 )
Change subject: KUDU-3608: REST API for Metadata Management ...................................................................... Patch Set 30: (14 comments) http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/master.cc File src/kudu/master/master.cc: http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/master.cc@179 PS30, Line 179: LOG(ERROR) << "REST API endpoints cannot be enabled when webserver is disabled. " : << "Please set --webserver_enabled=true to use REST API."; : return false; > nit: wrong ident Done http://gerrit.cloudera.org:8080/#/c/21823/29/src/kudu/master/rest_catalog_path_handlers.cc File src/kudu/master/rest_catalog_path_handlers.cc: http://gerrit.cloudera.org:8080/#/c/21823/29/src/kudu/master/rest_catalog_path_handlers.cc@110 PS29, Line 110: jw, l.catalog_status().ToString(), > here and all the other handler implementations: Done http://gerrit.cloudera.org:8080/#/c/21823/29/src/kudu/master/rest_catalog_path_handlers.cc@210 PS29, Line 210: ; > Please define a flag in this file for this: Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc File src/kudu/master/rest_catalog_path_handlers.cc: http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@69 PS30, Line 69: CatalogManager::ScopedLeaderSharedLock l(master_->catalog_manager()); : if (!l.catalog_status().ok()) { : RETURN_JSON_ERROR( : jw, l.catalog_status().ToString(), resp->status_code, HttpStatusCode::ServiceUnavailable); : } : if (!l.leader_status().ok()) { : RETURN_JSON_ERROR( : jw, "Master is not the leader", resp->status_code, HttpStatusCode::ServiceUnavailable); : } > consider extracting this to a utility method, to avoid repeated use Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@70 PS30, Line 70: if (!l.catalog_status().ok()) { : RETURN_JSON_ERROR( : jw, l.catalog_status().ToString(), resp->status_code, HttpStatusCode::ServiceUnavailable); : } : if (!l.leader_status().ok()) { : RETURN_JSON_ERROR( : jw, "Master is not the leader", resp->status_code, HttpStatusCode::ServiceUnavailable); : } > since this comes up in multiple places i think its worth to create a functi Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@95 PS30, Line 95: } else { : RETURN_JSON_ERROR( : jw, "Method not allowed", resp->status_code, HttpStatusCode::MethodNotAllowed); : } > IMO it makes sense to do a check for the supported methods earlier. It makes sense, but checking the request method at the beginning means we first verify whether it's GET/POST or GET/PUT/DELETE. If it doesn't match, we return an error. Then, after additional error handling, we check the method again to differentiate the cases. My concern is that this results in checking the request method twice. http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@106 PS30, Line 106: if (req.request_method == "GET") { > why not simplify these checks, so that the locks are only checked once, the Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@108 PS30, Line 108: if (!l.catalog_status().ok()) { : RETURN_JSON_ERROR( : jw, l.catalog_status().ToString(), resp->status_code, HttpStatusCode::ServiceUnavailable); : } : if (!l.leader_status().ok()) { : RETURN_JSON_ERROR( : jw, "Master is not the leader", resp->status_code, HttpStatusCode::ServiceUnavailable); : } > same as above Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@119 PS30, Line 119: if (!l.catalog_status().ok()) { : RETURN_JSON_ERROR( : jw, l.catalog_status().ToString(), resp->status_code, HttpStatusCode::ServiceUnavailable); : } : if (!l.leader_status().ok()) { : RETURN_JSON_ERROR( : jw, "Master is not the leader", resp->status_code, HttpStatusCode::ServiceUnavailable); : } > same as above Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@172 PS30, Line 172: google::protobuf::util::Status google_status > nit: const auto s = ... Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@213 PS30, Line 213: google::protobuf::util::Status google_status > nit: const auto s = ... Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@234 PS30, Line 234: 60 > consider making this a flag instead of a hard coded value Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@237 PS30, Line 237: status = master_->catalog_manager()->IsAlterTableDone(&check_req, &check_resp, user); > I guess since this logic is also available for create table, it would make Done http://gerrit.cloudera.org:8080/#/c/21823/30/src/kudu/master/rest_catalog_path_handlers.cc@260 PS30, Line 260: RETURN_JSON_ERROR(jw, "Alter table timed out", *status_code, HttpStatusCode::ServiceUnavailable); > nit: Alter table timed out while waiting for operation completion Done -- To view, visit http://gerrit.cloudera.org:8080/21823 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I67f964c4f950edfde31772cafd5c3ed5d6b87413 Gerrit-Change-Number: 21823 Gerrit-PatchSet: 30 Gerrit-Owner: Gabriella Lotz <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Gabriella Lotz <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Marton Greber <[email protected]> Gerrit-Reviewer: Zoltan Chovan <[email protected]> Gerrit-Comment-Date: Mon, 24 Mar 2025 14:20:36 +0000 Gerrit-HasComments: Yes
