Skip to content

Commit 4d4de9b

Browse files
committed
add warning to ldb_writer_with_changelog.go and remove debug printouts
1 parent 4dc0a35 commit 4d4de9b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

pkg/ldbwriter/ldb_callback_writer.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package ldbwriter
33
import (
44
"context"
55
"database/sql"
6-
"fmt"
7-
86
"github.com/segmentio/ctlstore/pkg/schema"
97
"github.com/segmentio/ctlstore/pkg/sqlite"
108
"github.com/segmentio/events/v2"
@@ -96,12 +94,9 @@ func (w *CallbackWriter) ApplyDMLStatement(ctx context.Context, statement schema
9694
}
9795
}
9896

99-
// DEBUG:
100-
fmt.Printf("CallbackWriter.ApplyDMLStatement: invoking callback: len(changes)=%d statement.ledgerSequence=%d\n", len(changes), statement.Sequence)
101-
//fmt.Printf("CallbackWriter.ApplyDMLStatement: len(changes)=%d changes=%+v\n", len(changes), changes)
10297
stats.Observe("ldb_changes_written", len(changes))
10398
for _, callback := range w.Callbacks {
104-
events.Debug("Writing DML callback for %{cb}T", callback)
99+
events.Debug("Writing DML callback for %{cb}T with %{changeCount}d changes", callback, len(changes))
105100
callback.LDBWritten(ctx, LDBWriteMetadata{
106101
DB: w.DB,
107102
Statement: statement,

pkg/ldbwriter/ldb_writer_with_changelog.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type LDBWriterWithChangelog struct {
1919
Seq int64
2020
}
2121

22+
// ⚠️ WARNING: This code is not used except in a unit test.
23+
// See ldb_callback_writer.go for the real code and more description.
2224
//
2325
// NOTE: How does the changelog work?
2426
//
@@ -33,7 +35,6 @@ type LDBWriterWithChangelog struct {
3335
// This is pretty complex, but after enumerating about 8 different options, it
3436
// ended up actually being the most simple. Other options involved not-so-great
3537
// options like parsing SQL or maintaining triggers on every table.
36-
//
3738
func (w *LDBWriterWithChangelog) ApplyDMLStatement(ctx context.Context, statement schema.DMLStatement) error {
3839
err := w.LdbWriter.ApplyDMLStatement(ctx, statement)
3940
if err != nil {

0 commit comments

Comments
 (0)