You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by "acelyc111 (via GitHub)" <gi...@apache.org> on 2023/12/08 02:41:05 UTC
[PR] dump plog tool [incubator-pegasus]
acelyc111 opened a new pull request, #1760:
URL: https://github.com/apache/incubator-pegasus/pull/1760
(no comment)
--
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: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org
Re: [PR] feat(cpp-shell): make mlog_dump dump plog [incubator-pegasus]
Posted by "acelyc111 (via GitHub)" <gi...@apache.org>.
acelyc111 merged PR #1760:
URL: https://github.com/apache/incubator-pegasus/pull/1760
--
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: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org
Re: [PR] feat(cpp-shell): Make mlog_dump to dump slog [incubator-pegasus]
Posted by "empiredan (via GitHub)" <gi...@apache.org>.
empiredan commented on code in PR #1760:
URL: https://github.com/apache/incubator-pegasus/pull/1760#discussion_r1423381428
##########
src/shell/commands/debugger.cpp:
##########
@@ -78,7 +81,7 @@ bool mlog_dump(command_executor *e, shell_context *sc, arguments args)
{0, 0, 0, 0}};
bool detailed = false;
- std::string input;
+ std::string slog_dir;
Review Comment:
Should be `plog_dir`?
--
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: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org
Re: [PR] feat(cpp-shell): make mlog_dump dump plog [incubator-pegasus]
Posted by "empiredan (via GitHub)" <gi...@apache.org>.
empiredan commented on code in PR #1760:
URL: https://github.com/apache/incubator-pegasus/pull/1760#discussion_r1423503910
##########
src/shell/commands/debugger.cpp:
##########
@@ -101,12 +104,28 @@ bool mlog_dump(command_executor *e, shell_context *sc, arguments args)
return false;
}
}
- if (input.empty()) {
- fprintf(stderr, "ERROR: input is not specified\n");
+ if (plog_dir.empty()) {
+ fmt::print(stderr, "ERROR: 'input' is not specified\n");
return false;
}
- if (!dsn::utils::filesystem::directory_exists(input)) {
- fprintf(stderr, "ERROR: input %s is not a directory\n", input.c_str());
+ if (!dsn::utils::filesystem::directory_exists(plog_dir)) {
+ fmt::print(stderr, "ERROR: '{}' is not a directory\n", plog_dir);
+ return false;
+ }
+
+ char splitters[] = {'\\', '/', 0};
+ auto slog_dir_tmp = plog_dir;
+ std::string name =
+ dsn::utils::get_last_component(dirname((char *)slog_dir_tmp.c_str()), splitters);
+ if (name.empty()) {
+ fmt::print(stderr, "ERROR: '{}' is not a valid slog directory\n", plog_dir);
Review Comment:
```suggestion
fmt::print(stderr, "ERROR: '{}' is not a valid plog directory\n", plog_dir);
```
##########
src/shell/commands/debugger.cpp:
##########
@@ -101,12 +104,28 @@ bool mlog_dump(command_executor *e, shell_context *sc, arguments args)
return false;
}
}
- if (input.empty()) {
- fprintf(stderr, "ERROR: input is not specified\n");
+ if (plog_dir.empty()) {
+ fmt::print(stderr, "ERROR: 'input' is not specified\n");
return false;
}
- if (!dsn::utils::filesystem::directory_exists(input)) {
- fprintf(stderr, "ERROR: input %s is not a directory\n", input.c_str());
+ if (!dsn::utils::filesystem::directory_exists(plog_dir)) {
+ fmt::print(stderr, "ERROR: '{}' is not a directory\n", plog_dir);
+ return false;
+ }
+
+ char splitters[] = {'\\', '/', 0};
+ auto slog_dir_tmp = plog_dir;
+ std::string name =
+ dsn::utils::get_last_component(dirname((char *)slog_dir_tmp.c_str()), splitters);
+ if (name.empty()) {
+ fmt::print(stderr, "ERROR: '{}' is not a valid slog directory\n", plog_dir);
+ return false;
+ }
+
+ char app_type[128];
+ int32_t app_id, pidx;
+ if (3 != sscanf(name.c_str(), "%d.%d.%s", &app_id, &pidx, app_type)) {
+ fmt::print(stderr, "ERROR: '{}' is not a valid slog directory\n", plog_dir);
Review Comment:
```suggestion
fmt::print(stderr, "ERROR: '{}' is not a valid plog directory\n", plog_dir);
```
##########
src/shell/commands/debugger.cpp:
##########
@@ -101,12 +104,28 @@ bool mlog_dump(command_executor *e, shell_context *sc, arguments args)
return false;
}
}
- if (input.empty()) {
- fprintf(stderr, "ERROR: input is not specified\n");
+ if (plog_dir.empty()) {
+ fmt::print(stderr, "ERROR: 'input' is not specified\n");
return false;
}
- if (!dsn::utils::filesystem::directory_exists(input)) {
- fprintf(stderr, "ERROR: input %s is not a directory\n", input.c_str());
+ if (!dsn::utils::filesystem::directory_exists(plog_dir)) {
+ fmt::print(stderr, "ERROR: '{}' is not a directory\n", plog_dir);
+ return false;
+ }
+
+ char splitters[] = {'\\', '/', 0};
+ auto slog_dir_tmp = plog_dir;
+ std::string name =
+ dsn::utils::get_last_component(dirname((char *)slog_dir_tmp.c_str()), splitters);
Review Comment:
```suggestion
const auto replica_path = std::filesystem::path(plog_dir).parent_path();
const auto name = replica_path.filename().string();
```
--
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: dev-unsubscribe@pegasus.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org