You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/28 04:25:45 UTC
[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15429: [Enhancement](jemalloc):support heap dump by http requst at runtime
github-actions[bot] commented on code in PR #15429:
URL: https://github.com/apache/doris/pull/15429#discussion_r1058047997
##########
be/src/http/action/jeprofile_actions.cpp:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "http/action/jeprofile_actions.h"
+
+#include <jemalloc/jemalloc.h>
+
+#include <ctime>
+#include <fstream>
+#include <mutex>
+#include <sstream>
+
+#include "common/config.h"
+#include "common/object_pool.h"
+#include "http/ev_http_server.h"
+#include "http/http_channel.h"
+#include "http/http_handler.h"
+#include "http/http_headers.h"
+#include "http/http_request.h"
+#include "util/file_utils.h"
+
+namespace doris {
+
+static std::mutex kJeprofileActionMutex;
+class JeHeapAction : public HttpHandler {
+public:
+ JeHeapAction() {}
+ virtual ~JeHeapAction() {}
+
+ virtual void handle(HttpRequest* req) override;
+};
+
+void JeHeapAction::handle(HttpRequest* req) {
+ std::lock_guard<std::mutex> lock(kJeprofileActionMutex);
+#ifndef USE_JEMALLOC
+ std::string str = "jemalloc heap dump is not available without setting USE_JEMALLOC";
+ HttpChannel::send_reply(req, str);
+#else
+ std::stringstream tmp_jeprof_file_name;
+ std::time_t now = std::time(0);
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
std::time_t now = std::time(nullptr);
```
##########
be/src/http/action/jeprofile_actions.cpp:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "http/action/jeprofile_actions.h"
+
+#include <jemalloc/jemalloc.h>
+
+#include <ctime>
+#include <fstream>
+#include <mutex>
+#include <sstream>
+
+#include "common/config.h"
+#include "common/object_pool.h"
+#include "http/ev_http_server.h"
+#include "http/http_channel.h"
+#include "http/http_handler.h"
+#include "http/http_headers.h"
+#include "http/http_request.h"
+#include "util/file_utils.h"
+
+namespace doris {
+
+static std::mutex kJeprofileActionMutex;
+class JeHeapAction : public HttpHandler {
+public:
+ JeHeapAction() {}
+ virtual ~JeHeapAction() {}
+
+ virtual void handle(HttpRequest* req) override;
Review Comment:
warning: 'virtual' is redundant since the function is already declared 'override' [modernize-use-override]
```suggestion
void handle(HttpRequest* req) override;
```
##########
be/src/http/action/jeprofile_actions.cpp:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "http/action/jeprofile_actions.h"
+
+#include <jemalloc/jemalloc.h>
+
+#include <ctime>
+#include <fstream>
+#include <mutex>
+#include <sstream>
+
+#include "common/config.h"
+#include "common/object_pool.h"
+#include "http/ev_http_server.h"
+#include "http/http_channel.h"
+#include "http/http_handler.h"
+#include "http/http_headers.h"
+#include "http/http_request.h"
+#include "util/file_utils.h"
+
+namespace doris {
+
+static std::mutex kJeprofileActionMutex;
+class JeHeapAction : public HttpHandler {
+public:
+ JeHeapAction() {}
+ virtual ~JeHeapAction() {}
Review Comment:
warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
```suggestion
virtual ~JeHeapAction() = default;
```
##########
be/src/http/action/jeprofile_actions.cpp:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "http/action/jeprofile_actions.h"
+
+#include <jemalloc/jemalloc.h>
+
+#include <ctime>
+#include <fstream>
+#include <mutex>
+#include <sstream>
+
+#include "common/config.h"
+#include "common/object_pool.h"
+#include "http/ev_http_server.h"
+#include "http/http_channel.h"
+#include "http/http_handler.h"
+#include "http/http_headers.h"
+#include "http/http_request.h"
+#include "util/file_utils.h"
+
+namespace doris {
+
+static std::mutex kJeprofileActionMutex;
+class JeHeapAction : public HttpHandler {
+public:
+ JeHeapAction() {}
+ virtual ~JeHeapAction() {}
Review Comment:
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
```suggestion
~JeHeapAction() override {}
```
##########
be/src/http/action/jeprofile_actions.cpp:
##########
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "http/action/jeprofile_actions.h"
+
+#include <jemalloc/jemalloc.h>
+
+#include <ctime>
+#include <fstream>
+#include <mutex>
+#include <sstream>
+
+#include "common/config.h"
+#include "common/object_pool.h"
+#include "http/ev_http_server.h"
+#include "http/http_channel.h"
+#include "http/http_handler.h"
+#include "http/http_headers.h"
+#include "http/http_request.h"
+#include "util/file_utils.h"
+
+namespace doris {
+
+static std::mutex kJeprofileActionMutex;
+class JeHeapAction : public HttpHandler {
+public:
+ JeHeapAction() {}
Review Comment:
warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
```suggestion
JeHeapAction() = default;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org