Skip to content

Commit 314ddfc

Browse files
committed
Merge branch 'vector_continue' into kv2vector_topo
2 parents 5c810d2 + c1be6a3 commit 314ddfc

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protocol/src/vector/attachment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ impl RetrieveAttach {
368368
self.body.push(body_data);
369369
self.body_token_count += rows * columns;
370370
self.left_count = self.left_count.saturating_sub(rows);
371+
log::debug!("left_count: {}", self.left_count);
371372
}
372373

373374
#[inline]
@@ -413,6 +414,7 @@ impl RetrieveAttach {
413414
}
414415
}
415416
}
417+
log::debug!("si len: {},content: {:?}", self.si.len(), self.si);
416418
self.si.len() > 0
417419
}
418420
#[inline]

protocol/src/vector/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,18 @@ impl Protocol for Vector {
200200

201201
match vec_attach.attch_type() {
202202
AttachType::Retrieve => {
203-
// 如果header为none,说明查询结果为空,直接返回false
203+
let attach = vec_attach.retrieve_attach_mut();
204+
// 如果header为none,说明当前查询结果为空
205+
// 如果有si,则看是否还有后续请求
206+
// 如果没有si,直接返回false
204207
if response.header.is_none() {
208+
if attach.has_si() {
209+
return attach.left_count != 0;
210+
}
205211
return false;
206212
}
207213

208214
assert!(response.header.is_some(), "rsp:{}", response);
209-
let attach = vec_attach.retrieve_attach_mut();
210215
let body_data = response.data().0.to_vec();
211216
let header = response.header.as_mut().expect("rsp header");
212217

tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tokio.workspace = true
2525
ctor = "0.1.23"
2626
mysql_async = "0.31.3"
2727
chrono = "0.4"
28+
chrono-tz = { version = "0.5", default-features = false }
2829
lazy_static = "*"
2930

3031
mysql = "*"

tests/src/kvector/mod.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::{fs::File, io::BufRead};
22

3+
use chrono::TimeZone;
4+
use endpoint::kv::uuid::Uuid;
35
use serde::{Deserialize, Serialize};
46

57
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -16,12 +18,12 @@ const TCP_LOG_PREFIX_LENT: usize =
1618

1719
#[test]
1820
fn parse_like_by_me() {
19-
let file_name = "datas/consistency.log";
21+
let file_name = "tmp_data/vector.log";
2022
let file = File::open(file_name).unwrap();
2123
let reader = std::io::BufReader::new(file);
2224

2325
let mut mesh_ids = Vec::new();
24-
let mut tcp_ids = Vec::new();
26+
let mut _tcp_ids = Vec::new();
2527
let mut count = 0;
2628
const MAX_COUNT: usize = 1;
2729

@@ -43,32 +45,33 @@ fn parse_like_by_me() {
4345
// println!("mesh_ids: {:?}", mesh_ids);
4446
continue;
4547
} else {
46-
tcp_ids = ids;
48+
_tcp_ids = ids;
4749
// println!("tcp_ids: {:?}", tcp_ids);
4850

4951
let diff_in_mesh: Vec<usize> = mesh_ids
5052
.clone()
5153
.into_iter()
52-
.filter(|id| !tcp_ids.contains(id))
54+
.filter(|id| !_tcp_ids.contains(id))
5355
.collect();
54-
let diff_in_tcp: Vec<usize> = tcp_ids
56+
let diff_in_tcp: Vec<usize> = _tcp_ids
5557
.clone()
5658
.into_iter()
5759
.filter(|id| !mesh_ids.contains(id))
5860
.collect();
5961

6062
if diff_in_mesh.len() > 0 || diff_in_tcp.len() > 0 {
61-
println!("raw tcp line:{}", line);
63+
println!("mesh/tcp count:{}/{}", mesh_ids.len(), _tcp_ids.len());
6264
println!("mesh more ids:{:?}", diff_in_mesh);
6365
println!("tcp more ids: {:?}", diff_in_tcp);
64-
66+
println!("mesh:{:?}", mesh_ids);
67+
println!(" tcp:{:?}", _tcp_ids);
6568
count += 1;
6669
if count >= MAX_COUNT {
6770
break;
6871
}
6972

7073
mesh_ids.clear();
71-
tcp_ids.clear();
74+
_tcp_ids.clear();
7275
}
7376
continue;
7477
}
@@ -83,3 +86,18 @@ fn parse_line(line: &str) -> Vec<usize> {
8386
}
8487
ids
8588
}
89+
90+
#[test]
91+
fn parse_time() {
92+
// use endpoint::kv::uuid;
93+
let uuid = 5100423841317698 as i64;
94+
let seconds = uuid.unix_secs();
95+
96+
use chrono_tz::Asia::Shanghai;
97+
let t = chrono::Utc
98+
.timestamp_opt(seconds, 0)
99+
.unwrap()
100+
.with_timezone(&Shanghai)
101+
.naive_local();
102+
println!("{}", t);
103+
}

0 commit comments

Comments
 (0)