Skip to content

Commit

Permalink
fix several prepared for (INSERT IGNORE INTO hosts_hosts_parents (chi…
Browse files Browse the repository at this point in the history
…ld_id,parent_id) VALUE(?,?)) (#1938) (#1947)
  • Loading branch information
jean-christophe81 authored Dec 19, 2024
1 parent 5331722 commit 843c515
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion broker/unified_sql/src/stream_sql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ void stream::_process_pb_host_parent(const std::shared_ptr<io::data>& d) {
hp.parent_id(), hp.child_id());

// Prepare queries.
if (!_host_parent_insert.prepared()) {
if (!_pb_host_parent_insert.prepared()) {
query_preparator::event_pb_unique unique{
{3, "child_id", io::protobuf_base::invalid_on_zero, 0},
{4, "parent_id", io::protobuf_base::invalid_on_zero, 0}};
Expand Down
10 changes: 7 additions & 3 deletions tests/broker-engine/bbdo-protobuf.robot
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ BEPBHostParent
[Tags] broker engine protobuf bbdo
Ctn Config Engine ${1}
Ctn Add Parent To Host 0 host_1 host_2
Ctn Add Parent To Host 0 host_3 host_2
Ctn Config Broker central
Ctn Config BBDO3 ${1}
Ctn Broker Config Log central sql trace
Expand All @@ -267,10 +268,9 @@ BEPBHostParent
... SELECT child_id, parent_id FROM hosts_hosts_parents
Log To Console ${output}
Sleep 1s
IF "${output}" == "((1, 2),)" BREAK
IF "${output}" == "((1, 2), (3, 2))" BREAK
END
Should Be Equal As Strings ${output} ((1, 2),) host parent not inserted

Should Be Equal As Strings ${output} ((1, 2), (3, 2)) host parent not inserted
# remove host
Ctn Config Engine ${1}
Ctn Reload Broker True
Expand All @@ -285,6 +285,10 @@ BEPBHostParent
END
Should Be Equal As Strings ${output} () host parent not deleted

${content} Create List [sql] [error]
${result} Ctn Find In Log With Timeout ${centralLog} ${start} ${content} 1
Should Not Be True ${result} sql error

[Teardown] Ctn Stop Engine Broker And Save Logs True

BEPBINST_CONF
Expand Down

0 comments on commit 843c515

Please sign in to comment.