Skip to content

Commit 8f00de2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into basic-sql
2 parents d687fe4 + 53c4f52 commit 8f00de2

25 files changed

+214
-83
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<!--
2-
Set the PR title to a meaningful commit message in imperative form. E.g.:
3-
4-
clp-s: Don't add implicit wildcards ('*') at the beginning and the end of a query (fixes #390).
2+
Set the PR title to a meaningful commit message that:
3+
- follows the Conventional Commits specification (https://www.conventionalcommits.org).
4+
- is in imperative form.
5+
Example:
6+
fix: Don't add implicit wildcards ('*') at the beginning and the end of a query (fixes #390).
57
-->
68

79
# Description

.github/workflows/clp-core-build-macos.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ on:
2727
- "deps-tasks.yml"
2828
- "Taskfile.yml"
2929
- "tools/scripts/deps-download/**"
30+
schedule:
31+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
32+
- cron: "15 0 * * *"
3033
workflow_dispatch:
3134

3235
concurrency:

.github/workflows/clp-core-build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
- "Taskfile.yml"
2424
- "tools/scripts/deps-download/**"
2525
- "!components/core/tools/scripts/lib_install/macos/**"
26+
schedule:
27+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
28+
- cron: "15 0 * * *"
2629
workflow_dispatch:
2730

2831
env:

.github/workflows/clp-docs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: "clp-docs"
33
on:
44
pull_request:
55
push:
6+
schedule:
7+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
8+
- cron: "15 0 * * *"
69
workflow_dispatch:
710

811
concurrency:

.github/workflows/clp-execution-image-build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- ".github/actions/clp-execution-image-build/action.yaml"
1212
- ".github/workflows/clp-execution-image-build.yaml"
1313
- "tools/docker-images/**/*"
14+
schedule:
15+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
16+
- cron: "15 0 * * *"
1417
workflow_dispatch:
1518

1619
concurrency:

.github/workflows/clp-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
push:
66
schedule:
7-
# Run at midnight UTC every day with 15 minutes delay added to avoid high load periods
7+
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
88
- cron: "15 0 * * *"
99
workflow_dispatch:
1010

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "clp-pr-title-checks"
2+
3+
on:
4+
pull_request_target:
5+
types: ["edited", "opened", "reopened"]
6+
branches: ["main"]
7+
8+
concurrency:
9+
group: "${{github.workflow}}-${{github.ref}}"
10+
11+
# Cancel in-progress jobs for efficiency
12+
cancel-in-progress: true
13+
14+
jobs:
15+
conventional-commits:
16+
permissions:
17+
# For amannn/action-semantic-pull-request
18+
pull-requests: "read"
19+
runs-on: "ubuntu-latest"
20+
steps:
21+
- uses: "amannn/action-semantic-pull-request@v5"
22+
env:
23+
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ tasks:
228228
- "client/src/**/*.css"
229229
- "client/src/**/*.jsx"
230230
- "client/src/webpack.config.js"
231-
- "yscope-log-viewer/.babelrc"
232-
- "yscope-log-viewer/customized-packages/**/*"
233231
- "yscope-log-viewer/package.json"
232+
- "yscope-log-viewer/public/**/*"
234233
- "yscope-log-viewer/src/**/*"
234+
- "yscope-log-viewer/tsconfig.json"
235235
- "yscope-log-viewer/webpack.common.js"
236236
- "yscope-log-viewer/webpack.prod.js"
237237
dir: "components/log-viewer-webui"
@@ -348,7 +348,7 @@ tasks:
348348
- "mkdir -p '{{.OUTPUT_TMP_DIR}}'"
349349
- >-
350350
curl --fail --location --show-error
351-
"{{.URL_PREFIX}}/{{.TAR_NAME}}"
351+
"{{trimSuffix "/" .URL_PREFIX}}/{{.TAR_NAME}}"
352352
--output "{{.TAR_PATH}}"
353353
- "tar xf '{{.TAR_PATH}}' --directory '{{.OUTPUT_TMP_DIR}}'"
354354
- "mv '{{.EXTRACTED_DIR}}' '{{.OUTPUT_DIR}}'"

components/core/cmake/Modules/FindMariaDBClient.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ include(cmake/Modules/FindLibraryDependencies.cmake)
2020
find_package(PkgConfig)
2121
pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}")
2222

23+
if(NOT mariadbclient_PKGCONF_FOUND AND APPLE)
24+
execute_process(
25+
COMMAND brew --prefix mariadb-connector-c
26+
RESULT_VARIABLE mariadbclient_BREW_RESULT
27+
OUTPUT_VARIABLE mariadbclient_MACOS_PREFIX
28+
)
29+
if(NOT mariadbclient_BREW_RESULT EQUAL 0)
30+
message(
31+
FATAL_ERROR
32+
"pkg-config cannot find ${mariadbclient_LIBNAME} and mariadb-connector-c isn't"
33+
" installed via Homebrew"
34+
)
35+
endif()
36+
string(STRIP "${mariadbclient_MACOS_PREFIX}" mariadbclient_MACOS_PREFIX)
37+
list(PREPEND CMAKE_PREFIX_PATH ${mariadbclient_MACOS_PREFIX})
38+
pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}")
39+
endif()
40+
41+
if(NOT mariadbclient_PKGCONF_FOUND)
42+
message(FATAL_ERROR "pkg-config cannot find ${mariadbclient_LIBNAME}")
43+
endif()
44+
2345
# Set include directory
2446
find_path(MariaDBClient_INCLUDE_DIR mysql.h
2547
HINTS ${mariadbclient_PKGCONF_INCLUDEDIR}

components/core/src/clp/ffi/KeyValuePairLogEvent.cpp

Lines changed: 31 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,6 @@ node_type_matches_value_type(SchemaTree::Node::Type type, Value const& value) ->
153153
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs
154154
) -> bool;
155155

156-
/**
157-
* @param node_id_value_pairs
158-
* @param schema_tree
159-
* @return A result containing a bitmap where every bit corresponds to the ID of a node in the
160-
* schema tree, and the set bits correspond to the nodes in the subtree defined by all paths from
161-
* the root node to the nodes in `node_id_value_pairs`; or an error code indicating a failure:
162-
* - std::errc::result_out_of_range if a node ID in `node_id_value_pairs` doesn't exist in the
163-
* schema tree.
164-
*/
165-
[[nodiscard]] auto get_schema_subtree_bitmap(
166-
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
167-
SchemaTree const& schema_tree
168-
) -> OUTCOME_V2_NAMESPACE::std_result<vector<bool>>;
169-
170156
/**
171157
* Inserts the given key-value pair into the JSON object (map).
172158
* @param node The schema tree node of the key to insert.
@@ -283,38 +269,6 @@ auto is_leaf_node(
283269
return true;
284270
}
285271

286-
auto get_schema_subtree_bitmap(
287-
KeyValuePairLogEvent::NodeIdValuePairs const& node_id_value_pairs,
288-
SchemaTree const& schema_tree
289-
) -> OUTCOME_V2_NAMESPACE::std_result<vector<bool>> {
290-
auto schema_subtree_bitmap{vector<bool>(schema_tree.get_size(), false)};
291-
for (auto const& [node_id, val] : node_id_value_pairs) {
292-
if (node_id >= schema_subtree_bitmap.size()) {
293-
return std::errc::result_out_of_range;
294-
}
295-
schema_subtree_bitmap[node_id] = true;
296-
297-
// Iteratively mark the parents as true
298-
auto optional_parent_id{schema_tree.get_node(node_id).get_parent_id()};
299-
while (true) {
300-
// Ideally, we'd use this if statement as the loop condition, but clang-tidy will
301-
// complain about an unchecked `optional` access.
302-
if (false == optional_parent_id.has_value()) {
303-
// Reached the root
304-
break;
305-
}
306-
auto const parent_id{optional_parent_id.value()};
307-
if (schema_subtree_bitmap[parent_id]) {
308-
// Parent already set by other child
309-
break;
310-
}
311-
schema_subtree_bitmap[parent_id] = true;
312-
optional_parent_id = schema_tree.get_node(parent_id).get_parent_id();
313-
}
314-
}
315-
return schema_subtree_bitmap;
316-
}
317-
318272
auto insert_kv_pair_into_json_obj(
319273
SchemaTree::Node const& node,
320274
std::optional<Value> const& optional_val,
@@ -393,6 +347,36 @@ auto KeyValuePairLogEvent::create(
393347
return KeyValuePairLogEvent{std::move(schema_tree), std::move(node_id_value_pairs), utc_offset};
394348
}
395349

350+
auto KeyValuePairLogEvent::get_schema_subtree_bitmap(
351+
) const -> OUTCOME_V2_NAMESPACE::std_result<vector<bool>> {
352+
auto schema_subtree_bitmap{vector<bool>(m_schema_tree->get_size(), false)};
353+
for (auto const& [node_id, val] : m_node_id_value_pairs) {
354+
if (node_id >= schema_subtree_bitmap.size()) {
355+
return std::errc::result_out_of_range;
356+
}
357+
schema_subtree_bitmap[node_id] = true;
358+
359+
// Iteratively mark the parents as true
360+
auto optional_parent_id{m_schema_tree->get_node(node_id).get_parent_id()};
361+
while (true) {
362+
// Ideally, we'd use this if statement as the loop condition, but clang-tidy will
363+
// complain about an unchecked `optional` access.
364+
if (false == optional_parent_id.has_value()) {
365+
// Reached the root
366+
break;
367+
}
368+
auto const parent_id{optional_parent_id.value()};
369+
if (schema_subtree_bitmap[parent_id]) {
370+
// Parent already set by other child
371+
break;
372+
}
373+
schema_subtree_bitmap[parent_id] = true;
374+
optional_parent_id = m_schema_tree->get_node(parent_id).get_parent_id();
375+
}
376+
}
377+
return schema_subtree_bitmap;
378+
}
379+
396380
auto KeyValuePairLogEvent::serialize_to_json(
397381
) const -> OUTCOME_V2_NAMESPACE::std_result<nlohmann::json> {
398382
if (m_node_id_value_pairs.empty()) {
@@ -409,9 +393,7 @@ auto KeyValuePairLogEvent::serialize_to_json(
409393
// vector grows).
410394
std::stack<DfsIterator> dfs_stack;
411395

412-
auto const schema_subtree_bitmap_ret{
413-
get_schema_subtree_bitmap(m_node_id_value_pairs, *m_schema_tree)
414-
};
396+
auto const schema_subtree_bitmap_ret{get_schema_subtree_bitmap()};
415397
if (schema_subtree_bitmap_ret.has_error()) {
416398
return schema_subtree_bitmap_ret.error();
417399
}

0 commit comments

Comments
 (0)