Skip to content

Commit

Permalink
MINIFICPP-2491 Upgrade GRPC and Abseil libs
Browse files Browse the repository at this point in the history
Fixes Windows build CI failure

Closes #1897

Signed-off-by: Marton Szasz <[email protected]>
  • Loading branch information
lordgamez authored and szaszm committed Nov 21, 2024
1 parent c5b4d4e commit 96dd2a6
Show file tree
Hide file tree
Showing 10 changed files with 508 additions and 25 deletions.
4 changes: 2 additions & 2 deletions cmake/Abseil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ set(PC ${Bash_EXECUTABLE} -c "set -x &&\

FetchContent_Declare(
absl
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz
URL_HASH SHA256=59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.tar.gz
URL_HASH SHA256=f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3
PATCH_COMMAND "${PC}"
OVERRIDE_FIND_PACKAGE
)
Expand Down
11 changes: 9 additions & 2 deletions cmake/Grpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ set(gRPC_SSL_PROVIDER "package" CACHE STRING "" FORCE)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER "package" CACHE STRING "" FORCE)

set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/remove-custom-commands-for-unused-dependencies.patch")
set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/fix-constants-on-windows.patch")
set(PC ${Bash_EXECUTABLE} -c "set -x &&\
(\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\
(\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")")

FetchContent_Declare(
grpc
GIT_REPOSITORY https://github.com/grpc/grpc
GIT_TAG v1.59.2
GIT_SUBMODULES "third_party/cares/cares third_party/protobuf third_party/re2"
GIT_TAG v1.68.0
GIT_SUBMODULES "third_party/cares/cares third_party/protobuf third_party/re2 third_party/upb"
PATCH_COMMAND "${PC}"
)
set(FETCHCONTENT_QUIET OFF)
FetchContent_MakeAvailable(grpc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class GrafanaLokiChecker:
def __init__(self):
self.url = "localhost:3100/loki/api/v1/query"
self.url = "localhost:3100/loki/api/v1/query_range"

def veify_log_lines_on_grafana_loki(self, lines: List[str], ssl: bool, tenant_id: str):
labels = '{job="minifi"}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def __init__(self, feature_context, name, vols, network, image_store, options: G
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v11
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -167,7 +167,7 @@ def deploy(self):
))

self.client.containers.run(
image="grafana/loki:2.9.2",
image="grafana/loki:3.2.1",
detach=True,
name=self.name,
network=self.network.name,
Expand Down
6 changes: 3 additions & 3 deletions docker/test/integration/features/grafana_loki.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Feature: MiNiFi can publish logs to Grafana Loki server
Given a Grafana Loki server is set up
And a TailFile processor with the "File to Tail" property set to "/tmp/input/test_file.log"
And a file with filename "test_file.log" and content "log line 1\nlog line 2\nlog line 3\n" is present in "/tmp/input"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095/"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095"
And the "Stream Labels" property of the PushGrafanaLokiGrpc processor is set to "job=minifi,id=docker-test"
And the "success" relationship of the TailFile processor is connected to the PushGrafanaLokiGrpc
When all instances start up
Expand All @@ -78,7 +78,7 @@ Feature: MiNiFi can publish logs to Grafana Loki server
Given a Grafana Loki server is set up with multi-tenancy enabled
And a TailFile processor with the "File to Tail" property set to "/tmp/input/test_file.log"
And a file with filename "test_file.log" and content "log line 1\nlog line 2\nlog line 3\n" is present in "/tmp/input"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095/"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095"
And the "Stream Labels" property of the PushGrafanaLokiGrpc processor is set to "job=minifi,id=docker-test"
And the "Tenant ID" property of the PushGrafanaLokiGrpc processor is set to "mytenant"
And the "success" relationship of the TailFile processor is connected to the PushGrafanaLokiGrpc
Expand All @@ -89,7 +89,7 @@ Feature: MiNiFi can publish logs to Grafana Loki server
Given a Grafana Loki server with SSL is set up
And a TailFile processor with the "File to Tail" property set to "/tmp/input/test_file.log"
And a file with filename "test_file.log" and content "log line 1\nlog line 2\nlog line 3\n" is present in "/tmp/input"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095/"
And a PushGrafanaLokiGrpc processor with the "Url" property set to "grafana-loki-server-${feature_id}:9095"
And the "Stream Labels" property of the PushGrafanaLokiGrpc processor is set to "job=minifi,id=docker-test"
And the "success" relationship of the TailFile processor is connected to the PushGrafanaLokiGrpc
And a SSL context service is set up for Grafana Loki processor "PushGrafanaLokiGrpc"
Expand Down
2 changes: 1 addition & 1 deletion extensions/grafana-loki/PushGrafanaLokiGrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ nonstd::expected<void, std::string> PushGrafanaLokiGrpc::submitRequest(const std
}

if (!push_channel_->WaitForConnected(std::chrono::system_clock::now() + connection_timeout_ms_)) {
return nonstd::make_unexpected("Timeout waiting for connection to Grafana Loki gRPC server");
return nonstd::make_unexpected("Timeout waiting for connection to Grafana Loki gRPC server. Please check if the server is running and reachable and the Url value is correct.");
}

logproto::PushResponse response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <algorithm>
#include <string_view>
#include "unit/Catch.h"
#include "RollingWindow.h"
Expand Down
35 changes: 24 additions & 11 deletions thirdparty/abseil/rename-crc32.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index f0d984ae..6e6dc40b 100644
index 32cc28fb..8e9dc702 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -474,7 +474,7 @@ set(ABSL_INTERNAL_DLL_TARGETS
@@ -521,7 +521,7 @@ set(ABSL_INTERNAL_DLL_TARGETS
"crc_cord_state"
"crc_cpu_detect"
"crc_internal"
Expand All @@ -12,10 +12,10 @@ index f0d984ae..6e6dc40b 100644
"debugging_internal"
"demangle_internal"
diff --git a/absl/crc/BUILD.bazel b/absl/crc/BUILD.bazel
index cdbaa9b2..78dac82e 100644
index 890d637c..8d680c22 100644
--- a/absl/crc/BUILD.bazel
+++ b/absl/crc/BUILD.bazel
@@ -67,7 +67,7 @@ cc_library(
@@ -72,7 +72,7 @@ cc_library(
)

cc_library(
Expand All @@ -25,10 +25,10 @@ index cdbaa9b2..78dac82e 100644
"crc32c.cc",
"internal/crc32c_inline.h",
diff --git a/absl/crc/CMakeLists.txt b/absl/crc/CMakeLists.txt
index 21247160..f72b6cb3 100644
index d52a1bc4..3cec9dcb 100644
--- a/absl/crc/CMakeLists.txt
+++ b/absl/crc/CMakeLists.txt
@@ -55,7 +55,7 @@ absl_cc_library(
@@ -53,7 +53,7 @@ absl_cc_library(

absl_cc_library(
NAME
Expand All @@ -37,7 +37,7 @@ index 21247160..f72b6cb3 100644
HDRS
"crc32c.h"
"internal/crc32c.h"
@@ -89,7 +89,7 @@ absl_cc_test(
@@ -86,7 +86,7 @@ absl_cc_test(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
Expand All @@ -46,7 +46,7 @@ index 21247160..f72b6cb3 100644
absl::strings
absl::str_format
GTest::gtest_main
@@ -129,7 +129,7 @@ absl_cc_test(
@@ -126,7 +126,7 @@ absl_cc_test(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
Expand All @@ -55,20 +55,33 @@ index 21247160..f72b6cb3 100644
absl::memory
absl::random_random
absl::random_distributions
@@ -159,7 +159,7 @@ absl_cc_library(
@@ -156,7 +156,7 @@ absl_cc_library(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
- absl::crc32c
+ absl::crc32c_internal
absl::config
absl::strings
)
@@ -173,6 +173,6 @@ absl_cc_test(
absl::no_destructor
@@ -171,6 +171,6 @@ absl_cc_test(
${ABSL_DEFAULT_COPTS}
DEPS
absl::crc_cord_state
- absl::crc32c
+ absl::crc32c_internal
GTest::gtest_main
)
diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt
index 3a1619e8..2c368cf2 100644
--- a/absl/strings/CMakeLists.txt
+++ b/absl/strings/CMakeLists.txt
@@ -987,7 +987,7 @@ absl_cc_library(
absl::cordz_update_scope
absl::cordz_update_tracker
absl::core_headers
- absl::crc32c
+ absl::crc32c_internal
absl::crc_cord_state
absl::endian
absl::function_ref
35 changes: 35 additions & 0 deletions thirdparty/grpc/fix-constants-on-windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/third_party/protobuf/upb/message/internal/message.c b/third_party/protobuf/upb/message/internal/message.c
index 57ab2d737..5f321c7bb 100644
--- a/third_party/protobuf/upb/message/internal/message.c
+++ b/third_party/protobuf/upb/message/internal/message.c
@@ -17,9 +17,9 @@
// Must be last.
#include "upb/port/def.inc"

-const float kUpb_FltInfinity = INFINITY;
-const double kUpb_Infinity = INFINITY;
-const double kUpb_NaN = NAN;
+const float kUpb_FltInfinity = (float)(1.0 / 0.0);
+const double kUpb_Infinity = 1.0 / 0.0;
+const double kUpb_NaN = 0.0 / 0.0;

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* a) {
diff --git a/third_party/upb/upb/message/internal/message.c b/third_party/upb/upb/message/internal/message.c
index 57ab2d737..5f321c7bb 100644
--- a/third_party/upb/upb/message/internal/message.c
+++ b/third_party/upb/upb/message/internal/message.c
@@ -17,9 +17,9 @@
// Must be last.
#include "upb/port/def.inc"

-const float kUpb_FltInfinity = INFINITY;
-const double kUpb_Infinity = INFINITY;
-const double kUpb_NaN = NAN;
+const float kUpb_FltInfinity = (float)(1.0 / 0.0);
+const double kUpb_Infinity = 1.0 / 0.0;
+const double kUpb_NaN = 0.0 / 0.0;

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* a) {

Loading

0 comments on commit 96dd2a6

Please sign in to comment.