Skip to content

Commit

Permalink
Adding additional stats work
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Mar 29, 2022
1 parent c579047 commit ac8564a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions go/vt/vttablet/tabletserver/vstreamer/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (

"context"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql/fakesqldb"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/dbconfigs"
Expand Down Expand Up @@ -251,4 +253,6 @@ func TestVStreamerWaitForMySQL(t *testing.T) {
}
})
}

require.Equal(t, engine.rowStreamerWaits.Counts()["VStreamerTest.waitForMySQL"], int64(2))
}
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (rs *rowStreamer) buildSelect() (string, error) {
}

func (rs *rowStreamer) streamQuery(conn *snapshotConn, send func(*binlogdatapb.VStreamRowsResponse) error) error {
// Let's be sure we MySQL is in good shape to stream rows
// Let's be sure MySQL is in good shape to stream rows
if err := rs.vse.waitForMySQL(rs.ctx, rs.cp); err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func resetMetrics(t *testing.T) {
engine.resultStreamerNumRows.Reset()
engine.rowStreamerNumRows.Reset()
engine.vstreamerPhaseTimings.Reset()
engine.rowStreamerWaits.Reset()
}

func validateMetrics(t *testing.T) {
Expand All @@ -325,6 +326,7 @@ func validateMetrics(t *testing.T) {
require.Equal(t, engine.vstreamerPhaseTimings.Counts()["VStreamerTest.copy"], int64(3))
require.Equal(t, engine.vstreamerPhaseTimings.Counts()["VStreamerTest.catchup"], int64(2))
require.Equal(t, engine.vstreamerPhaseTimings.Counts()["VStreamerTest.fastforward"], int64(2))
require.Equal(t, engine.rowStreamerWaits.Counts()["VStreamerTest.waitForMySQL"], int64(0))
}

func insertMultipleRows(t *testing.T, table string, idx int, numRows int) {
Expand Down

0 comments on commit ac8564a

Please sign in to comment.