-
Notifications
You must be signed in to change notification settings - Fork 288
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
redo(ticdc): make implementation in manager asynchronously #5683
Changes from all commits
97e5c88
7059663
e1f24e3
889545e
ffba111
60d86b4
cedc654
ec0ae94
8f2cdcc
be511e9
5ef2f75
f96452d
2a50c31
374d695
515377f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -891,6 +891,10 @@ func (p *processor) createTablePipelineImpl( | |
return nil | ||
}) | ||
|
||
if p.redoManager.Enabled() { | ||
p.redoManager.AddTable(tableID, replicaInfo.StartTs) | ||
} | ||
|
||
tableName := p.getTableName(ctx, tableID) | ||
|
||
s, err := sink.NewTableSink(p.sink, tableID, p.metricsTableSinkTotalRows) | ||
Comment on lines
+894
to
900
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. Is there sequence restriction among 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. There are no strict sequence restrictions. This is a defensive optimization to prevent access to related interface before adding a table. |
||
|
@@ -911,10 +915,6 @@ func (p *processor) createTablePipelineImpl( | |
return nil, errors.Trace(err) | ||
} | ||
|
||
if p.redoManager.Enabled() { | ||
p.redoManager.AddTable(tableID, replicaInfo.StartTs) | ||
} | ||
|
||
log.Info("Add table pipeline", zap.Int64("tableID", tableID), | ||
cdcContext.ZapFieldChangefeed(ctx), | ||
zap.String("name", table.Name()), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright 2021 PingCAP, Inc. | ||
// | ||
// Licensed 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, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package common | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
const ( | ||
namespace = "ticdc" | ||
subsystem = "redo" | ||
) | ||
|
||
var ( | ||
// RedoWriteBytesGauge records the total number of bytes written to redo log. | ||
RedoWriteBytesGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "write_bytes_total", | ||
Help: "Total number of bytes redo log written", | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// RedoFsyncDurationHistogram records the latency distributions of fsync called by redo writer. | ||
RedoFsyncDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "fsync_duration_seconds", | ||
Help: "The latency distributions of fsync called by redo writer", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2.0, 13), | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// RedoFlushAllDurationHistogram records the latency distributions of flushAll | ||
// called by redo writer. | ||
RedoFlushAllDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "flushall_duration_seconds", | ||
Help: "The latency distributions of flushall called by redo writer", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2.0, 13), | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// RedoTotalRowsCountGauge records the total number of rows written to redo log. | ||
RedoTotalRowsCountGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "total_rows_count", | ||
Help: "The total count of rows that are processed by redo writer", | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// RedoWriteLogDurationHistogram records the latency distributions of writeLog. | ||
RedoWriteLogDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "write_log_duration_seconds", | ||
Help: "The latency distributions of writeLog called by redoManager", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2.0, 13), | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// RedoFlushLogDurationHistogram records the latency distributions of flushLog. | ||
RedoFlushLogDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "flush_log_duration_seconds", | ||
Help: "The latency distributions of flushLog called by redoManager", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2.0, 13), | ||
}, []string{"namespace", "changefeed"}) | ||
) | ||
|
||
// InitMetrics registers all metrics in this file | ||
func InitMetrics(registry *prometheus.Registry) { | ||
registry.MustRegister(RedoFsyncDurationHistogram) | ||
registry.MustRegister(RedoTotalRowsCountGauge) | ||
registry.MustRegister(RedoWriteBytesGauge) | ||
registry.MustRegister(RedoFlushAllDurationHistogram) | ||
registry.MustRegister(RedoWriteLogDurationHistogram) | ||
registry.MustRegister(RedoFlushLogDurationHistogram) | ||
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. The two metrics 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. Compared with |
||
} |
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 change related to this PR?
It seems to change the interpolate way from level trigger to edge trigger.
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.
lastSentResolvedTs
has an initial value of 0, so it is possible to send a event withresolvedTs=0
tosinkNode
andredoManager
, which will violate defensive verification inredoManager
.