Skip to content

Commit 5729892

Browse files
fix: address latest pr11446 review feedback
1 parent 292a2b0 commit 5729892

4 files changed

Lines changed: 105 additions & 10 deletions

File tree

agent/src/ebpf/kernel/socket_trace.bpf.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,16 +1913,6 @@ static __inline int process_data(struct pt_regs *ctx, __u64 id,
19131913

19141914
if (act == INFER_TERMINATE)
19151915
return -1;
1916-
1917-
if (act == INFER_FINISH &&
1918-
conn_info->protocol != PROTO_UNKNOWN &&
1919-
is_socket_info_valid(conn_info->socket_info_ptr) &&
1920-
!conn_info->socket_info_ptr->allow_reassembly &&
1921-
is_proto_reasm_enabled(conn_info->protocol)) {
1922-
conn_info->socket_info_ptr->allow_reassembly = true;
1923-
conn_info->socket_info_ptr->reasm_bytes = 0;
1924-
check_and_set_data_reassembly(conn_info);
1925-
}
19261916
#if !defined(LINUX_VER_KFUNC) && !defined(LINUX_VER_5_2_PLUS)
19271917
if (disable_kprobe && extra->source == DATA_SOURCE_SYSCALL)
19281918
return -1;

agent/src/ebpf/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ cfg_if::cfg_if! {
177177
}
178178
}
179179

180+
#[cfg(test)]
181+
mod source_regression_tests {
182+
#[test]
183+
fn socket_trace_should_not_recheck_reassembly_after_infer_finish() {
184+
let src = include_str!("kernel/socket_trace.bpf.c");
185+
assert!(
186+
!src.contains("check_and_set_data_reassembly(conn_info);"),
187+
"post-INFER_FINISH reassembly recheck should not remain in socket_trace.bpf.c",
188+
);
189+
}
190+
}
191+
180192
// Message types
181193
// Currently, except for source=EBPF_TYPE_GO_HTTP2_UPROBE,
182194
// the correctness of this direction cannot be guaranteed.

server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.1.0.39.sql

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
DROP PROCEDURE IF EXISTS AddColumnIfNotExists;
2+
DROP PROCEDURE IF EXISTS InsertDataSourceIfNotExists;
23

34
CREATE PROCEDURE AddColumnIfNotExists(
45
IN tableName VARCHAR(255),
@@ -24,10 +25,47 @@ BEGIN
2425
END IF;
2526
END;
2627

28+
CREATE PROCEDURE InsertDataSourceIfNotExists(
29+
IN p_display_name VARCHAR(64),
30+
IN p_data_table_collection VARCHAR(64),
31+
IN p_interval_time INTEGER,
32+
IN p_retention_time INTEGER
33+
)
34+
BEGIN
35+
IF NOT EXISTS (
36+
SELECT 1
37+
FROM data_source
38+
WHERE data_table_collection = p_data_table_collection
39+
) THEN
40+
INSERT INTO data_source (
41+
display_name,
42+
data_table_collection,
43+
base_data_source_id,
44+
interval_time,
45+
retention_time,
46+
lcuuid
47+
)
48+
VALUES (
49+
p_display_name,
50+
p_data_table_collection,
51+
0,
52+
p_interval_time,
53+
p_retention_time,
54+
UUID()
55+
);
56+
END IF;
57+
END;
58+
2759
CALL AddColumnIfNotExists('process', 'biz_type', 'INTEGER DEFAULT 0', 'process_name');
2860
CALL AddColumnIfNotExists('genesis_process', 'biz_type', 'INTEGER DEFAULT 0', 'process_name');
2961
CALL AddColumnIfNotExists('ch_gprocess', 'biz_type', 'INTEGER DEFAULT 0', 'l3_epc_id');
3062

63+
CALL InsertDataSourceIfNotExists('事件-文件读写聚合事件', 'event.file_agg_event', 0, 7*24);
64+
CALL InsertDataSourceIfNotExists('事件-文件管理事件', 'event.file_mgmt_event', 0, 7*24);
65+
CALL InsertDataSourceIfNotExists('事件-进程权限事件', 'event.proc_perm_event', 0, 7*24);
66+
CALL InsertDataSourceIfNotExists('事件-进程操作事件', 'event.proc_ops_event', 0, 7*24);
67+
3168
DROP PROCEDURE AddColumnIfNotExists;
69+
DROP PROCEDURE InsertDataSourceIfNotExists;
3270

3371
UPDATE db_version SET version='7.1.0.39';
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package schema
2+
3+
import (
4+
"os"
5+
"path/filepath"
6+
"strconv"
7+
"strings"
8+
"testing"
9+
)
10+
11+
func TestDBVersionExpectedMatchesHighestMySQLIssue(t *testing.T) {
12+
issuDir := filepath.Join("rawsql", "mysql", "issu")
13+
entries, err := os.ReadDir(issuDir)
14+
if err != nil {
15+
t.Fatalf("read issu dir failed: %v", err)
16+
}
17+
18+
maxVersion := ""
19+
for _, entry := range entries {
20+
if entry.IsDir() {
21+
continue
22+
}
23+
name := strings.TrimSuffix(entry.Name(), filepath.Ext(entry.Name()))
24+
if maxVersion == "" || versionGreater(name, maxVersion) {
25+
maxVersion = name
26+
}
27+
}
28+
29+
if maxVersion == "" {
30+
t.Fatal("no mysql issue versions found")
31+
}
32+
if DB_VERSION_EXPECTED != maxVersion {
33+
t.Fatalf("DB_VERSION_EXPECTED=%s, want highest issue version %s", DB_VERSION_EXPECTED, maxVersion)
34+
}
35+
}
36+
37+
func versionGreater(left, right string) bool {
38+
leftParts := strings.Split(left, ".")
39+
rightParts := strings.Split(right, ".")
40+
for i := 0; i < len(leftParts) && i < len(rightParts); i++ {
41+
leftNum, err := strconv.Atoi(leftParts[i])
42+
if err != nil {
43+
panic(err)
44+
}
45+
rightNum, err := strconv.Atoi(rightParts[i])
46+
if err != nil {
47+
panic(err)
48+
}
49+
if leftNum == rightNum {
50+
continue
51+
}
52+
return leftNum > rightNum
53+
}
54+
return len(leftParts) > len(rightParts)
55+
}

0 commit comments

Comments
 (0)