forked from apache/inlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
680 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
inlong-audit/audit-service/src/main/java/config/SqlConstants.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
inlong-audit/audit-service/src/main/java/org/apache/inlong/audit/config/SqlConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.audit.config; | ||
|
||
/** | ||
* Sql constants | ||
*/ | ||
public class SqlConstants { | ||
|
||
// HA selector sql | ||
public static final String SELECTOR_SQL = | ||
"insert ignore into {0} (service_id, leader_id, last_seen_active) values (''{1}'', ''{2}'', now()) on duplicate key update leader_id = if(last_seen_active < now() - interval # second, values(leader_id), leader_id),last_seen_active = if(leader_id = values(leader_id), values(last_seen_active), last_seen_active)"; | ||
public static final String REPLACE_LEADER_SQL = | ||
"replace into {0} ( service_id, leader_id, last_seen_active ) values (''{1}'', ''#'', now())"; | ||
public static final String RELEASE_SQL = "delete from {0} where service_id=''{1}'' and leader_id= ''{2}''"; | ||
public static final String IS_LEADER_SQL = | ||
"select count(*) as is_leader from {0} where service_id=''{1}'' and leader_id=''{2}''"; | ||
public static final String SEARCH_CURRENT_LEADER_SQL = | ||
"select leader_id as leader from {0} where service_id=''{1}''"; | ||
public static final String SELECT_TEST_SQL = "SELECT 1 "; | ||
|
||
// ClickHouse query sql | ||
public static final String KEY_CLICKHOUSE_SOURCE_QUERY_SQL = "clickhouse.source.query.sql"; | ||
public static final String DEFAULT_CLICKHOUSE_SOURCE_QUERY_SQL = | ||
"SELECT inlong_group_id, inlong_stream_id, audit_id, audit_tag\n" + | ||
" , sum(cnt) AS cnt, sum(size) AS size\n" + | ||
" , sum(delay) AS delay\n" + | ||
"FROM (\n" + | ||
" SELECT max(audit_version), ip, docker_id, thread_id\n" + | ||
" , inlong_group_id, inlong_stream_id, audit_id, audit_tag, cnt\n" + | ||
" , size, delay\n" + | ||
" FROM (\n" + | ||
" SELECT audit_version, ip, docker_id, thread_id, inlong_group_id\n" + | ||
" , inlong_stream_id, audit_id, audit_tag, sum(count) AS cnt\n" + | ||
" , sum(size) AS size, sum(delay) AS delay\n" + | ||
" FROM (\n" + | ||
" SELECT audit_version, docker_id, thread_id, sdk_ts, packet_id\n" + | ||
" , log_ts, ip, inlong_group_id, inlong_stream_id, audit_id\n" + | ||
" , audit_tag, count, size, delay\n" + | ||
" FROM audit_data \n" + | ||
" WHERE log_ts BETWEEN ? AND ? \n" + | ||
" AND audit_id = ? \n" + | ||
" GROUP BY audit_version, docker_id, thread_id, sdk_ts, packet_id, log_ts, ip, inlong_group_id, inlong_stream_id, audit_id, audit_tag, count, size, delay\n" | ||
+ | ||
" ) t1\n" + | ||
" GROUP BY audit_version, ip, docker_id, thread_id, inlong_group_id, inlong_stream_id, audit_id, audit_tag\n" | ||
+ | ||
" ) t2\n" + | ||
" GROUP BY ip, docker_id, thread_id, inlong_group_id, inlong_stream_id, audit_id, audit_tag, cnt, size, delay\n" | ||
+ | ||
") t3\n" + | ||
"GROUP BY inlong_group_id, inlong_stream_id, audit_id, audit_tag"; | ||
|
||
// Mysql query sql | ||
public static final String KEY_MYSQL_SOURCE_QUERY_TEMP_SQL = "mysql.query.temp.sql"; | ||
public static final String DEFAULT_MYSQL_SOURCE_QUERY_TEMP_SQL = | ||
"SELECT inlong_group_id, inlong_stream_id, audit_id, audit_tag\n" + | ||
", sum(count) AS cnt, sum(size) AS size\n" + | ||
", sum(delay) AS delay\n" + | ||
"FROM audit_data_temp\n" + | ||
"WHERE log_ts BETWEEN ? AND ? \n" + | ||
"AND audit_id = ? \n" + | ||
"GROUP BY inlong_group_id, inlong_stream_id, audit_id, audit_tag"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.