Track partition offsets and only log unsafe for non-selects
This commit is contained in:
parent
bfecc8e0e9
commit
7bf2a27319
|
@ -53,7 +53,7 @@ func (in *traceInterceptor) StmtQueryContext(ctx context.Context, stmt driver.St
|
||||||
safe = w.Safe()
|
safe = w.Safe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if safe != "" {
|
if safe != "" && !strings.HasPrefix(query, "SELECT ") {
|
||||||
logrus.Infof("unsafe: %s -- %s", safe, query)
|
logrus.Infof("unsafe: %s -- %s", safe, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (in *traceInterceptor) StmtExecContext(ctx context.Context, stmt driver.Stm
|
||||||
safe = w.Safe()
|
safe = w.Safe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if safe != "" {
|
if safe != "" && !strings.HasPrefix(query, "SELECT ") {
|
||||||
logrus.Infof("unsafe: %s -- %s", safe, query)
|
logrus.Infof("unsafe: %s -- %s", safe, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,3 +258,16 @@ func (d *SyncServerDatasource) PutFilter(ctx context.Context, localpart string,
|
||||||
func (d *SyncServerDatasource) RedactEvent(ctx context.Context, redactedEventID string, redactedBecause *gomatrixserverlib.HeaderedEvent) error {
|
func (d *SyncServerDatasource) RedactEvent(ctx context.Context, redactedEventID string, redactedBecause *gomatrixserverlib.HeaderedEvent) error {
|
||||||
return d.Database.RedactEvent(d.dbctx, redactedEventID, redactedBecause)
|
return d.Database.RedactEvent(d.dbctx, redactedEventID, redactedBecause)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *SyncServerDatasource) PartitionOffsets(
|
||||||
|
ctx context.Context, topic string,
|
||||||
|
) ([]sqlutil.PartitionOffset, error) {
|
||||||
|
return d.PartitionOffsetStatements.PartitionOffsets(d.dbctx, topic)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPartitionOffset implements PartitionStorer
|
||||||
|
func (d *SyncServerDatasource) SetPartitionOffset(
|
||||||
|
ctx context.Context, topic string, partition int32, offset int64,
|
||||||
|
) error {
|
||||||
|
return d.PartitionOffsetStatements.SetPartitionOffset(d.dbctx, topic, partition, offset)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue