@@ -53,7 +53,7 @@ var _ = Describe("BatchFinder", func() {
5353 err := helper .InsertTestLog (ctx , testutil.TestLogRecord {
5454 LoggingEnabled : true ,
5555 BucketName : "test-bucket" ,
56- StartTime : time .Now (),
56+ StartTime : time .Now (). UnixMilli () ,
5757 ReqID : fmt .Sprintf ("req-%d" , i ),
5858 Action : "GetObject" ,
5959 })
@@ -83,12 +83,12 @@ var _ = Describe("BatchFinder", func() {
8383 err := helper .Client ().Exec (ctx , query ,
8484 oldTime .Add (time .Duration (i )* time .Second ), // insertedAt
8585 "test-bucket" , // bucketName
86- oldTime .Add (time .Duration (i )* time .Second ), // startTime
87- fmt .Sprintf ("req-%03d" , i ), // req_id
88- "GetObject" , // operation
89- true , // loggingEnabled
90- uint16 (0 ), // raftSessionID
91- "/test-bucket/key" , // requestURI
86+ oldTime .Add (time .Duration (i )* time .Second ). UnixMilli () , // startTime
87+ fmt .Sprintf ("req-%03d" , i ), // req_id
88+ "GetObject" , // operation
89+ true , // loggingEnabled
90+ uint16 (0 ), // raftSessionID
91+ "/test-bucket/key" , // requestURI
9292 )
9393 Expect (err ).NotTo (HaveOccurred ())
9494 }
@@ -99,7 +99,7 @@ var _ = Describe("BatchFinder", func() {
9999 "INSERT INTO %s.%s (bucketName, raftSessionID, lastProcessedInsertedAt, lastProcessedStartTime, lastProcessedReqId) VALUES (?, ?, ?, ?, ?)" ,
100100 helper .DatabaseName , clickhouse .TableOffsetsFederated )
101101 err := helper .Client ().Exec (ctx , offsetQuery ,
102- "test-bucket" , uint16 (0 ), lastLogTime , lastLogTime , "req-007" )
102+ "test-bucket" , uint16 (0 ), lastLogTime , lastLogTime . UnixMilli () , "req-007" )
103103 Expect (err ).NotTo (HaveOccurred ())
104104
105105 batches , err := finder .FindBatches (ctx )
@@ -123,34 +123,34 @@ var _ = Describe("BatchFinder", func() {
123123 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
124124 ` , helper .DatabaseName , clickhouse .TableAccessLogsFederated )
125125 err := helper .Client ().Exec (ctx , query ,
126- "" , // bucketOwner
127- "test-bucket" , // bucketName
128- time .Now (), // startTime
129- "" , // clientIP
130- "" , // requester
131- "req-old" , // req_id
132- "GetObject" , // operation
133- "" , // objectKey
134- "/test-bucket/key" , // requestURI
135- uint16 (0 ), // httpCode
136- "" , // errorCode
137- uint64 (0 ), // bytesSent
138- uint64 (0 ), // objectSize
139- float32 (0 ), // totalTime
140- float32 (0 ), // turnAroundTime
141- "" , // referer
142- "" , // userAgent
143- "" , // versionId
144- "" , // signatureVersion
145- "" , // cipherSuite
146- "" , // authenticationType
147- "" , // hostHeader
148- "" , // tlsVersion
149- "" , // aclRequired
150- oldTime , // insertedAt (old)
151- "" , // loggingTargetBucket
152- "" , // loggingTargetPrefix
153- uint16 (0 ), // raftSessionID
126+ "" , // bucketOwner
127+ "test-bucket" , // bucketName
128+ time .Now (). UnixMilli (), // startTime
129+ "" , // clientIP
130+ "" , // requester
131+ "req-old" , // req_id
132+ "GetObject" , // operation
133+ "" , // objectKey
134+ "/test-bucket/key" , // requestURI
135+ uint16 (0 ), // httpCode
136+ "" , // errorCode
137+ uint64 (0 ), // bytesSent
138+ uint64 (0 ), // objectSize
139+ float32 (0 ), // totalTime
140+ float32 (0 ), // turnAroundTime
141+ "" , // referer
142+ "" , // userAgent
143+ "" , // versionId
144+ "" , // signatureVersion
145+ "" , // cipherSuite
146+ "" , // authenticationType
147+ "" , // hostHeader
148+ "" , // tlsVersion
149+ "" , // aclRequired
150+ oldTime , // insertedAt (old)
151+ "" , // loggingTargetBucket
152+ "" , // loggingTargetPrefix
153+ uint16 (0 ), // raftSessionID
154154 )
155155 Expect (err ).NotTo (HaveOccurred ())
156156
@@ -172,7 +172,7 @@ var _ = Describe("BatchFinder", func() {
172172 err := helper .Client ().Exec (ctx , query ,
173173 oldTime , // insertedAt (old)
174174 "test-bucket" , // bucketName
175- oldTime , // startTime
175+ oldTime . UnixMilli (), // startTime
176176 fmt .Sprintf ("req-%03d" , i ), // req_id
177177 "GetObject" , // operation
178178 true , // loggingEnabled
@@ -194,7 +194,7 @@ var _ = Describe("BatchFinder", func() {
194194 err := helper .InsertTestLog (ctx , testutil.TestLogRecord {
195195 LoggingEnabled : true ,
196196 BucketName : "test-bucket" ,
197- StartTime : time .Now (),
197+ StartTime : time .Now (). UnixMilli () ,
198198 ReqID : fmt .Sprintf ("req-%d" , i ),
199199 Action : "GetObject" ,
200200 })
@@ -210,7 +210,7 @@ var _ = Describe("BatchFinder", func() {
210210 Describe ("Composite Offset Filtering" , func () {
211211 It ("should filter when offset differs in insertedAt" , func () {
212212 baseTime := time .Now ().Add (- 2 * time .Hour )
213- startTime := baseTime
213+ startTimeVal := baseTime
214214 reqID := "req-1"
215215
216216 // Insert 6 logs with insertedAt from T to T+5s, same startTime and reqID
@@ -222,13 +222,13 @@ var _ = Describe("BatchFinder", func() {
222222 ` , helper .DatabaseName , clickhouse .TableAccessLogsFederated )
223223 err := helper .Client ().Exec (ctx , query ,
224224 baseTime .Add (time .Duration (i )* time .Second ), // insertedAt varies
225- "test-bucket" , // bucketName
226- startTime , // startTime (same for all)
227- reqID , // req_id (same for all)
228- "GetObject" , // operation
229- true , // loggingEnabled
230- uint16 (0 ), // raftSessionID
231- "/test-bucket/key" , // requestURI
225+ "test-bucket" , // bucketName
226+ startTimeVal . UnixMilli (), // startTime (same for all)
227+ reqID , // req_id (same for all)
228+ "GetObject" , // operation
229+ true , // loggingEnabled
230+ uint16 (0 ), // raftSessionID
231+ "/test-bucket/key" , // requestURI
232232 )
233233 Expect (err ).NotTo (HaveOccurred ())
234234 }
@@ -239,7 +239,7 @@ var _ = Describe("BatchFinder", func() {
239239 "INSERT INTO %s.%s (bucketName, raftSessionID, lastProcessedInsertedAt, lastProcessedStartTime, lastProcessedReqId) VALUES (?, ?, ?, ?, ?)" ,
240240 helper .DatabaseName , clickhouse .TableOffsetsFederated )
241241 err := helper .Client ().Exec (ctx , offsetQuery ,
242- "test-bucket" , uint16 (0 ), offsetTime , startTime , reqID )
242+ "test-bucket" , uint16 (0 ), offsetTime , startTimeVal . UnixMilli () , reqID )
243243 Expect (err ).NotTo (HaveOccurred ())
244244
245245 batches , err := finder .FindBatches (ctx )
@@ -256,7 +256,7 @@ var _ = Describe("BatchFinder", func() {
256256
257257 // Insert 6 logs with same insertedAt, varying startTime
258258 for i := 0 ; i < 6 ; i ++ {
259- startTime := baseTime .Add (time .Duration (i ) * time .Second )
259+ startTimeVal := baseTime .Add (time .Duration (i ) * time .Second )
260260 query := fmt .Sprintf (`
261261 INSERT INTO %s.%s
262262 (insertedAt, bucketName, startTime, req_id, operation, loggingEnabled, raftSessionID, requestURI)
@@ -265,7 +265,7 @@ var _ = Describe("BatchFinder", func() {
265265 err := helper .Client ().Exec (ctx , query ,
266266 insertedAt , // insertedAt (same for all)
267267 "test-bucket" , // bucketName
268- startTime , // startTime varies
268+ startTimeVal . UnixMilli (), // startTime varies
269269 fmt .Sprintf ("req-%03d" , i ), // req_id
270270 "GetObject" , // operation
271271 true , // loggingEnabled
@@ -281,7 +281,7 @@ var _ = Describe("BatchFinder", func() {
281281 "INSERT INTO %s.%s (bucketName, raftSessionID, lastProcessedInsertedAt, lastProcessedStartTime, lastProcessedReqId) VALUES (?, ?, ?, ?, ?)" ,
282282 helper .DatabaseName , clickhouse .TableOffsetsFederated )
283283 err := helper .Client ().Exec (ctx , offsetQuery ,
284- "test-bucket" , uint16 (0 ), insertedAt , offsetTimestamp , "req-003" )
284+ "test-bucket" , uint16 (0 ), insertedAt , offsetTimestamp . UnixMilli () , "req-003" )
285285 Expect (err ).NotTo (HaveOccurred ())
286286
287287 batches , err := finder .FindBatches (ctx )
@@ -306,7 +306,7 @@ var _ = Describe("BatchFinder", func() {
306306 err := helper .Client ().Exec (ctx , query ,
307307 insertedAt , // insertedAt
308308 "test-bucket" , // bucketName
309- insertedAt , // startTime
309+ insertedAt . UnixMilli (), // startTime
310310 fmt .Sprintf ("req-%03d" , i ), // req_id
311311 "GetObject" , // operation
312312 true , // loggingEnabled
@@ -323,17 +323,17 @@ var _ = Describe("BatchFinder", func() {
323323
324324 t0 := baseTime
325325 err := helper .Client ().Exec (ctx , offsetQuery ,
326- "test-bucket" , uint16 (0 ), t0 , t0 , "req-000" )
326+ "test-bucket" , uint16 (0 ), t0 , t0 . UnixMilli () , "req-000" )
327327 Expect (err ).NotTo (HaveOccurred ())
328328
329329 t2 := baseTime .Add (2 * time .Second )
330330 err = helper .Client ().Exec (ctx , offsetQuery ,
331- "test-bucket" , uint16 (0 ), t2 , t2 , "req-002" )
331+ "test-bucket" , uint16 (0 ), t2 , t2 . UnixMilli () , "req-002" )
332332 Expect (err ).NotTo (HaveOccurred ())
333333
334334 t1 := baseTime .Add (1 * time .Second )
335335 err = helper .Client ().Exec (ctx , offsetQuery ,
336- "test-bucket" , uint16 (0 ), t1 , t1 , "req-001" )
336+ "test-bucket" , uint16 (0 ), t1 , t1 . UnixMilli () , "req-001" )
337337 Expect (err ).NotTo (HaveOccurred ())
338338
339339 batches , err := finder .FindBatches (ctx )
@@ -353,7 +353,7 @@ var _ = Describe("BatchFinder", func() {
353353 err := helper .InsertTestLog (ctx , testutil.TestLogRecord {
354354 LoggingEnabled : true ,
355355 BucketName : "bucket-1" ,
356- StartTime : time .Now (),
356+ StartTime : time .Now (). UnixMilli () ,
357357 ReqID : fmt .Sprintf ("req-1-%d" , i ),
358358 Action : "GetObject" ,
359359 })
@@ -364,7 +364,7 @@ var _ = Describe("BatchFinder", func() {
364364 err := helper .InsertTestLog (ctx , testutil.TestLogRecord {
365365 LoggingEnabled : true ,
366366 BucketName : "bucket-2" ,
367- StartTime : time .Now (),
367+ StartTime : time .Now (). UnixMilli () ,
368368 ReqID : fmt .Sprintf ("req-2-%d" , i ),
369369 Action : "PutObject" ,
370370 })
@@ -393,7 +393,7 @@ var _ = Describe("BatchFinder", func() {
393393 err := helper .Client ().Exec (ctx , query ,
394394 oldTime , // insertedAt (older)
395395 "bucket-A" , // bucketName
396- oldTime , // startTime
396+ oldTime . UnixMilli (), // startTime
397397 fmt .Sprintf ("req-a-%03d" , i ), // req_id
398398 "GetObject" , // operation
399399 true , // loggingEnabled
@@ -413,7 +413,7 @@ var _ = Describe("BatchFinder", func() {
413413 err := helper .Client ().Exec (ctx , query ,
414414 newerTime , // insertedAt (newer)
415415 "bucket-B" , // bucketName
416- newerTime , // startTime
416+ newerTime . UnixMilli (), // startTime
417417 fmt .Sprintf ("req-b-%03d" , i ), // req_id
418418 "GetObject" , // operation
419419 true , // loggingEnabled
@@ -441,7 +441,7 @@ var _ = Describe("BatchFinder", func() {
441441 LoggingEnabled : true ,
442442 BucketName : "test-bucket" ,
443443 RaftSessionID : 1 ,
444- StartTime : time .Now (),
444+ StartTime : time .Now (). UnixMilli () ,
445445 ReqID : fmt .Sprintf ("req-1-%d" , i ),
446446 Action : "GetObject" ,
447447 })
@@ -454,7 +454,7 @@ var _ = Describe("BatchFinder", func() {
454454 LoggingEnabled : true ,
455455 BucketName : "test-bucket" ,
456456 RaftSessionID : 2 ,
457- StartTime : time .Now (),
457+ StartTime : time .Now (). UnixMilli () ,
458458 ReqID : fmt .Sprintf ("req-2-%d" , i ),
459459 Action : "GetObject" ,
460460 })
@@ -490,15 +490,15 @@ var _ = Describe("BatchFinder", func() {
490490 VALUES (?, ?, ?, ?, ?, ?, ?, ?)
491491 ` , helper .DatabaseName , clickhouse .TableAccessLogsFederated )
492492 err := helper .Client ().Exec (ctx , query ,
493- logAInsertedAt , "test-bucket" , logAStartTime , "req-A" ,
493+ logAInsertedAt , "test-bucket" , logAStartTime . UnixMilli () , "req-A" ,
494494 "GetObject" , true , uint16 (0 ), "/test-bucket/key-a" )
495495 Expect (err ).NotTo (HaveOccurred ())
496496
497497 // Insert Log B: operation at :01, arrives at :05
498498 logBStartTime := baseTime .Add (1 * time .Second )
499499 logBInsertedAt := baseTime .Add (5 * time .Second )
500500 err = helper .Client ().Exec (ctx , query ,
501- logBInsertedAt , "test-bucket" , logBStartTime , "req-B" ,
501+ logBInsertedAt , "test-bucket" , logBStartTime . UnixMilli () , "req-B" ,
502502 "GetObject" , true , uint16 (0 ), "/test-bucket/key-b" )
503503 Expect (err ).NotTo (HaveOccurred ())
504504
@@ -538,7 +538,7 @@ var _ = Describe("BatchFinder", func() {
538538 err := helper .InsertTestLog (ctx , testutil.TestLogRecord {
539539 LoggingEnabled : true ,
540540 BucketName : "bucket-recent" ,
541- StartTime : recentTime ,
541+ StartTime : recentTime . UnixMilli () ,
542542 ReqID : fmt .Sprintf ("req-recent-%d" , i ),
543543 Action : "GetObject" ,
544544 })
@@ -557,7 +557,7 @@ var _ = Describe("BatchFinder", func() {
557557 err := helper .Client ().Exec (ctx , query ,
558558 oldTime ,
559559 "bucket-old" ,
560- oldTime ,
560+ oldTime . UnixMilli () ,
561561 fmt .Sprintf ("req-old-%d" , i ),
562562 "GetObject" ,
563563 true ,
@@ -591,7 +591,7 @@ var _ = Describe("BatchFinder", func() {
591591 err := helper .Client ().Exec (ctx , query ,
592592 insertTime ,
593593 bucketName ,
594- insertTime ,
594+ insertTime . UnixMilli () ,
595595 fmt .Sprintf ("req-%d-%d" , bucketNum , i ),
596596 "GetObject" ,
597597 true ,
0 commit comments