You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/10/04 17:08:49 UTC
[GitHub] [nifi-minifi-cpp] fgerlits opened a new pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
fgerlits opened a new pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192
https://issues.apache.org/jira/browse/MINIFICPP-1645
`RocksDbPersistableKeyValueStoreService` is registered in the class loader under two different names, so we can refer to it from `minifi.properties` using different capitalization: eg. "RocksDBPersistableKeyValueStoreService" is accepted, too. This is nice, but a side effect is that it used to be included in the heartbeat manifest twice.
---
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file?
- [ ] If applicable, have you updated the NOTICE file?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] adamdebreceni closed pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
adamdebreceni closed pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r721632735
##########
File path: extensions/http-curl/tests/C2LogHeartbeatTest.cpp
##########
@@ -17,14 +17,18 @@
*/
#undef NDEBUG
+
#include "TestBase.h"
+
#include "c2/C2Agent.h"
+#include "c2/HeartbeatLogger.h"
#include "protocols/RESTProtocol.h"
#include "protocols/RESTSender.h"
#include "HTTPIntegrationBase.h"
#include "HTTPHandlers.h"
+#include "range/v3/all.hpp"
Review comment:
Ranges are powerful, but the range-v3 lib is also not the fastest to compile. On my machine, the difference is about 0.6 seconds between a translation unit that includes all vs. only the necessary utils. It's not a big deal, but it's also an easy improvement.
The list of includes necessary here are:
```
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
```
I recognize that this is a bit tedious, but it will only last until we can migrate to standard ranges. I'm also not insisting on the change if 0.6 seconds of saved compilation time is not convincing enough to spend extra time looking up the necessary headers.
My tests:
```
szaszm@szaszm-pc:~$ cat ranges-all.cpp
#include "range/v3/all.hpp"
#include <cstdio>
int main() { puts("Hello world"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-all ranges-all.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m1.221s
user 0m1.129s
sys 0m0.090s
szaszm@szaszm-pc:~$ cat ranges-selective.cpp
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective ranges-selective.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.670s
user 0m0.601s
sys 0m0.068s
szaszm@szaszm-pc:~$ cat ranges-selective2.cpp
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective2 ranges-selective2.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.591s
user 0m0.535s
sys 0m0.055s
szaszm@szaszm-pc:~$ cat ranges-std.cpp
#include <ranges>
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-std ranges-std.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.370s
user 0m0.326s
sys 0m0.043s
szaszm@szaszm-pc:~$ cat ranges-control.cpp
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-control ranges-control.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.097s
user 0m0.066s
sys 0m0.031s
```
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r721980831
##########
File path: extensions/http-curl/tests/C2LogHeartbeatTest.cpp
##########
@@ -17,14 +17,18 @@
*/
#undef NDEBUG
+
#include "TestBase.h"
+
#include "c2/C2Agent.h"
+#include "c2/HeartbeatLogger.h"
#include "protocols/RESTProtocol.h"
#include "protocols/RESTSender.h"
#include "HTTPIntegrationBase.h"
#include "HTTPHandlers.h"
+#include "range/v3/all.hpp"
Review comment:
Yeah, 0.6s (times many files, as I expect we'll use it all over the place) off the compilation time is a good thing. I've changed the includes in https://github.com/apache/nifi-minifi-cpp/pull/1192/commits/1888957191f4a103acf51acae767aa89679e9cc6.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r722062783
##########
File path: libminifi/include/core/ClassLoader.h
##########
@@ -93,18 +94,18 @@ class ClassLoader {
std::vector<std::string> getClasses(const std::string &group) const {
std::lock_guard<std::mutex> lock(internal_mutex_);
- std::vector<std::string> classes;
+ std::vector<std::string> class_names;
for (const auto& child_loader : class_loaders_) {
for (auto&& clazz : child_loader.second.getClasses(group)) {
- classes.push_back(std::move(clazz));
+ class_names.push_back(std::move(clazz));
}
}
for (const auto& factory : loaded_factories_) {
if (factory.second->getGroupName() == group) {
- classes.push_back(factory.second->getClassName());
+ class_names.push_back(factory.second->getClassName());
}
}
- return classes;
+ return std::move(class_names) | ranges::actions::sort | ranges::actions::unique;
Review comment:
I think we should move this to the source file (and its dependency on ranges) as many source files include ClassLoader.h transitively through Resource.h
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r721980831
##########
File path: extensions/http-curl/tests/C2LogHeartbeatTest.cpp
##########
@@ -17,14 +17,18 @@
*/
#undef NDEBUG
+
#include "TestBase.h"
+
#include "c2/C2Agent.h"
+#include "c2/HeartbeatLogger.h"
#include "protocols/RESTProtocol.h"
#include "protocols/RESTSender.h"
#include "HTTPIntegrationBase.h"
#include "HTTPHandlers.h"
+#include "range/v3/all.hpp"
Review comment:
Yeah, 0.6s (times many files, as I expect we'll use it all over the place) off the compilation time is a good thing. I've changed the includes in https://github.com/apache/nifi-minifi-cpp/pull/1192/commits/6d76f4aca20e5a868ef43ef357ccd7b981442dd4.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r721632735
##########
File path: extensions/http-curl/tests/C2LogHeartbeatTest.cpp
##########
@@ -17,14 +17,18 @@
*/
#undef NDEBUG
+
#include "TestBase.h"
+
#include "c2/C2Agent.h"
+#include "c2/HeartbeatLogger.h"
#include "protocols/RESTProtocol.h"
#include "protocols/RESTSender.h"
#include "HTTPIntegrationBase.h"
#include "HTTPHandlers.h"
+#include "range/v3/all.hpp"
Review comment:
Ranges are powerful, but the range-v3 lib is also not the fastest to compile. On my machine, the difference is about 0.6 seconds between a translation unit that includes all vs. only the necessary utils. It's not a big deal, but it's also an easy improvement.
The list of includes necessary here are:
```
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
```
I recognize that this is a bit tedious, but it will only last until we can migrate to standard ranges. I'm also not insisting on the change if 0.6 seconds of saved compilation time is not convincing enough to spend extra time looking up the necessary headers.
My tests:
```
szaszm@szaszm-pc:~$ cat ranges-all.cpp
#include "range/v3/all.hpp"
#include <cstdio>
int main() { puts("Hello world"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-all ranges-all.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m1.221s
user 0m1.129s
sys 0m0.090s
szaszm@szaszm-pc:~$ cat ranges-selective.cpp
#include "range/v3/view/split.hpp"
#include "range/v3/view/transform.hpp"
#include "range/v3/view/filter.hpp"
#include "range/v3/range/conversion.hpp"
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective ranges-selective.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.670s
user 0m0.601s
sys 0m0.068s
szaszm@szaszm-pc:~$ cat ranges-selective2.cpp
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-selective2 ranges-selective2.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.591s
user 0m0.535s
sys 0m0.055s
szaszm@szaszm-pc:~$ cat ranges-std.cpp
#include <ranges>
#include <cstdio>
int main() { puts("Hello World"); }
szaszm@szaszm-pc:~$ time g++ -o ranges-std ranges-std.cpp -std=c++2a -O3 -Wall -Wextra -pedantic -flto
real 0m0.370s
user 0m0.326s
sys 0m0.043s
```
##########
File path: libminifi/include/core/ClassLoader.h
##########
@@ -24,10 +24,10 @@
#include <string>
#include <map>
#include <memory>
-#include "utils/StringUtils.h"
+
#include "core/Core.h"
-#include "io/BufferStream.h"
#include "ObjectFactory.h"
+#include "range/v3/all.hpp"
Review comment:
Same here. Interestingly, the difference is still about 0.6 seconds despite using less utilities.
```
#include "range/v3/action/sort.hpp"
#include "range/v3/action/unique.hpp"
```
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1192: MINIFICPP-1645 Only include each processor or controller service in the heartbeat once
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1192:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1192#discussion_r722088982
##########
File path: libminifi/include/core/ClassLoader.h
##########
@@ -93,18 +94,18 @@ class ClassLoader {
std::vector<std::string> getClasses(const std::string &group) const {
std::lock_guard<std::mutex> lock(internal_mutex_);
- std::vector<std::string> classes;
+ std::vector<std::string> class_names;
for (const auto& child_loader : class_loaders_) {
for (auto&& clazz : child_loader.second.getClasses(group)) {
- classes.push_back(std::move(clazz));
+ class_names.push_back(std::move(clazz));
}
}
for (const auto& factory : loaded_factories_) {
if (factory.second->getGroupName() == group) {
- classes.push_back(factory.second->getClassName());
+ class_names.push_back(factory.second->getClassName());
}
}
- return classes;
+ return std::move(class_names) | ranges::actions::sort | ranges::actions::unique;
Review comment:
makes sense; done in https://github.com/apache/nifi-minifi-cpp/pull/1192/commits/112db412cba844cc8014d76c2108434ef34d016d
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org