From c1629ac6e43716a2aa8c57499519a9a99d92241c Mon Sep 17 00:00:00 2001 From: Dekinet Date: Fri, 28 Feb 2025 11:33:06 +1000 Subject: [PATCH 1/3] Implement C++ line_sender::flush_and_keep_with_flags() --- include/questdb/ingress/line_sender.hpp | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/questdb/ingress/line_sender.hpp b/include/questdb/ingress/line_sender.hpp index b4c8f7d3..2ae58e62 100644 --- a/include/questdb/ingress/line_sender.hpp +++ b/include/questdb/ingress/line_sender.hpp @@ -1247,6 +1247,42 @@ namespace questdb::ingress } } + /** + * Send the batch of rows in the buffer to the QuestDB server, and, if the parameter + * `transactional` is true, ensure the flush will be transactional. + * See docs on the ::line_sender_flush_and_keep_with_flags() function for more details. + */ + bool flush_and_keep_with_flags(const line_sender_buffer& buffer, bool transactional) + { + try + { + if (buffer._impl) + { + ensure_impl(); + line_sender_error::wrapped_call( + ::line_sender_flush_and_keep_with_flags, + _impl, + buffer._impl, + transactional); + } + else + { + line_sender_buffer buffer2{0}; + buffer2.may_init(); + line_sender_error::wrapped_call( + ::line_sender_flush_and_keep_with_flags, + _impl, + buffer2._impl, + transactional); + } + } + catch (...) + { + return false; + } + return true; + } + /** * Check if an error occurred previously and the sender must be closed. * This happens when there was an earlier failure. From 68acea9209b9946a79358eb00f75a00769e081b2 Mon Sep 17 00:00:00 2001 From: Dekinet Date: Mon, 26 May 2025 15:08:52 +1000 Subject: [PATCH 2/3] Revert change adding flush_and_keep_with_flags() to facilitate merging without conflicts. --- include/questdb/ingress/line_sender.hpp | 36 ------------------------- 1 file changed, 36 deletions(-) diff --git a/include/questdb/ingress/line_sender.hpp b/include/questdb/ingress/line_sender.hpp index 2ae58e62..b4c8f7d3 100644 --- a/include/questdb/ingress/line_sender.hpp +++ b/include/questdb/ingress/line_sender.hpp @@ -1247,42 +1247,6 @@ namespace questdb::ingress } } - /** - * Send the batch of rows in the buffer to the QuestDB server, and, if the parameter - * `transactional` is true, ensure the flush will be transactional. - * See docs on the ::line_sender_flush_and_keep_with_flags() function for more details. - */ - bool flush_and_keep_with_flags(const line_sender_buffer& buffer, bool transactional) - { - try - { - if (buffer._impl) - { - ensure_impl(); - line_sender_error::wrapped_call( - ::line_sender_flush_and_keep_with_flags, - _impl, - buffer._impl, - transactional); - } - else - { - line_sender_buffer buffer2{0}; - buffer2.may_init(); - line_sender_error::wrapped_call( - ::line_sender_flush_and_keep_with_flags, - _impl, - buffer2._impl, - transactional); - } - } - catch (...) - { - return false; - } - return true; - } - /** * Check if an error occurred previously and the sender must be closed. * This happens when there was an earlier failure. From 5d09c0d7224014ea649e6be4c92c085657880f0e Mon Sep 17 00:00:00 2001 From: Dekinet Date: Mon, 26 May 2025 15:11:02 +1000 Subject: [PATCH 3/3] Re-add flush_and_keep_with_flags() --- include/questdb/ingress/line_sender.hpp | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/questdb/ingress/line_sender.hpp b/include/questdb/ingress/line_sender.hpp index e118a22f..53315e40 100644 --- a/include/questdb/ingress/line_sender.hpp +++ b/include/questdb/ingress/line_sender.hpp @@ -1246,6 +1246,42 @@ class line_sender } } + /** + * Send the batch of rows in the buffer to the QuestDB server, and, if the parameter + * `transactional` is true, ensure the flush will be transactional. + * See docs on the ::line_sender_flush_and_keep_with_flags() function for more details. + */ + bool flush_and_keep_with_flags(const line_sender_buffer& buffer, bool transactional) + { + try + { + if (buffer._impl) + { + ensure_impl(); + line_sender_error::wrapped_call( + ::line_sender_flush_and_keep_with_flags, + _impl, + buffer._impl, + transactional); + } + else + { + line_sender_buffer buffer2{0}; + buffer2.may_init(); + line_sender_error::wrapped_call( + ::line_sender_flush_and_keep_with_flags, + _impl, + buffer2._impl, + transactional); + } + } + catch (...) + { + return false; + } + return true; + } + /** * Check if an error occurred previously and the sender must be closed. * This happens when there was an earlier failure.