-
Notifications
You must be signed in to change notification settings - Fork 0
LOGC-46: Fix distributed ClickHouse operations and StartTime handling #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aa8a931
1d8affd
bf8d84b
59ad425
26c413d
60b9cf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,9 @@ func NewLogFetcher(client *clickhouse.Client, database string, maxLogsPerBatch i | |||||||
| // LogBuilder will re-sort by startTime, req_id. | ||||||||
| // Uses composite filter to fetch only logs after LastProcessedOffset. | ||||||||
| func (lf *LogFetcher) FetchLogs(ctx context.Context, batch LogBatch) ([]LogRecord, error) { | ||||||||
| // StartTime is stored as milliseconds since epoch | ||||||||
| startTimeMillis := batch.LastProcessedOffset.StartTime | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was it require to change the type of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this: but it fails with: I'd also prefer to not change the datatype, but it is the only apprach that worked. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking Doing the conversion at the struct level, also forces you to convert back to log-courier/pkg/logcourier/logobject.go Line 86 in 60b9cf1
log-courier/pkg/logcourier/logobject.go Line 177 in 60b9cf1
log-courier/pkg/logcourier/processor.go Line 684 in 60b9cf1
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see the confusion. Is converting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't have the time you can merge it. But it would be better to have only a three line change instead of changing hundred of lines and loosing the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We discussed with @leif-scality and indeed we found a simpler fix. See: #95 |
||||||||
|
|
||||||||
| query := fmt.Sprintf(` | ||||||||
| SELECT | ||||||||
| bucketOwner, | ||||||||
|
|
@@ -63,19 +66,19 @@ func (lf *LogFetcher) FetchLogs(ctx context.Context, batch LogBatch) ([]LogRecor | |||||||
| AND raftSessionID = ? | ||||||||
| AND ( | ||||||||
| insertedAt > ? | ||||||||
| OR (insertedAt = ? AND startTime > ?) | ||||||||
| OR (insertedAt = ? AND startTime = ? AND req_id > ?) | ||||||||
| OR (insertedAt = ? AND startTime > %d) | ||||||||
| OR (insertedAt = ? AND startTime = %d AND req_id > ?) | ||||||||
| ) | ||||||||
| ORDER BY insertedAt ASC, startTime ASC, req_id ASC | ||||||||
| LIMIT ? | ||||||||
| `, lf.database, clickhouse.TableAccessLogsFederated) | ||||||||
| `, lf.database, clickhouse.TableAccessLogsFederated, startTimeMillis, startTimeMillis) | ||||||||
|
|
||||||||
| rows, err := lf.client.Query(ctx, query, | ||||||||
| batch.Bucket, | ||||||||
| batch.RaftSessionID, | ||||||||
| batch.LastProcessedOffset.InsertedAt, | ||||||||
| batch.LastProcessedOffset.InsertedAt, batch.LastProcessedOffset.StartTime, | ||||||||
| batch.LastProcessedOffset.InsertedAt, batch.LastProcessedOffset.StartTime, batch.LastProcessedOffset.ReqID, | ||||||||
| batch.LastProcessedOffset.InsertedAt, | ||||||||
| batch.LastProcessedOffset.InsertedAt, batch.LastProcessedOffset.ReqID, | ||||||||
| lf.maxLogsPerBatch, | ||||||||
| ) | ||||||||
| if err != nil { | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?