Skip to content

Commit

Permalink
Fix errant changes
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Feb 27, 2024
1 parent 36c7896 commit c0012c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletmanager/vreplication/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func insertLog(dbClient *vdbClient, typ string, vreplID int32, state, message st
maxMessageLen := 65535
truncationStr := fmt.Sprintf(" ... %s ... ", sqlparser.TruncationText)
if len(message) > maxMessageLen {
mid := ((len(message) / 2) - len(truncationStr)) - 1
mid := (len(message) / 2) - len(truncationStr)
for mid > (maxMessageLen / 2) {
mid = mid / 2
}
tail := (len(message) - mid + len(truncationStr))
tail := (len(message) - (mid + len(truncationStr))) + 1
message = fmt.Sprintf("%s%s%s", message[:mid], truncationStr, message[tail:])
}
buf.Myprintf("insert into %s.vreplication_log(vrepl_id, type, state, message) values(%s, %s, %s, %s)",
Expand Down
2 changes: 0 additions & 2 deletions go/vt/vttablet/tabletmanager/vreplication/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/binlog/binlogplayer"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"

binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
Expand Down Expand Up @@ -81,7 +80,6 @@ func TestInsertLogTruncation(t *testing.T) {
t.Run("insertLog", func(t *testing.T) {
var messageOut string
if tc.expectTruncation {
log.Errorf("BEFORE:: Message length: %d", len(tc.message))
mid := (len(tc.message) / 2) - len(truncationStr)
for mid > (maxMessageLen / 2) {
mid = mid / 2
Expand Down

0 comments on commit c0012c5

Please sign in to comment.