chenBright commented on code in PR #3746:
URL: https://github.com/apache/brpc/pull/3746#discussion_r4582785280
##########
src/brpc/rdma/rdma_helper.cpp:
##########
@@ -715,10 +715,13 @@ void GlobalDisableRdma() {
bool SupportedByRdma(std::string protocol) {
if (protocol.compare("baidu_std") == 0) {
- // Since rdma is used for high performance scenario,
- // we consider baidu_std for the only protocol to support.
return true;
}
+#if BRPC_WITH_FLATBUFFERS
Review Comment:
In 39d0b9ad30be6010cf293076d6e19ce21d961736, added FlatBuffers + RDMA
compile coverage to the existing GCC and Clang Bazel all-options jobs. Both
root and external builds now enable both features.
The root jobs also build `brpc_flatbuffers_rdma_unittest` without running
it, so these compile checks do not require RDMA hardware on GitHub-hosted
runners.
##########
src/brpc/flatbuffers/message.cpp:
##########
@@ -20,12 +20,66 @@
#if BRPC_WITH_FLATBUFFERS
#include <cstring>
#include <cerrno>
+#include <cstdlib>
#include "butil/logging.h"
+#if BRPC_WITH_RDMA
+#include "butil/iobuf_inl.h"
+#include "butil/memory/scope_guard.h"
+#include "brpc/rdma/block_pool.h"
+#include "brpc/rdma/rdma_helper.h"
+#endif // BRPC_WITH_RDMA
namespace brpc {
namespace flatbuffers {
namespace {
+void* AllocateStorage(butil::SingleIOBuf* storage, uint32_t size) {
+#if BRPC_WITH_RDMA
+ // SingleIOBuf normally uses the registered IOBuf pool. Its largest block
+ // class (type 2) is 2 MiB, including the IOBuf block header. FlatBuffers
+ // requires contiguous storage, so larger buffers need their own MR.
+ if (!rdma::IsRdmaAvailable() ||
Review Comment:
Fixed in 39d0b9ad30be6010cf293076d6e19ce21d961736. Pool allocation failures
now fall back to separately allocated memory with RDMA registration. If
registration fails, the buffer remains usable over TCP; sending it over RDMA
returns `ERDMAMEM` instead of aborting during message construction.
The deleter only deregisters successfully registered memory. Added
regression tests covering both failure paths, receive-side reassembly, TCP/RDMA
behavior, and registration lifetime.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]