Skip to content
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

WIP - mysql stream #521

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

WIP - mysql stream #521

wants to merge 5 commits into from

Conversation

nathan-artie
Copy link
Collaborator

No description provided.

@nathan-artie nathan-artie changed the title Nv/mysql stream WIP - mysql stream Oct 23, 2024
@@ -6,3 +6,4 @@ services:
MYSQL_ROOT_PASSWORD: mysql
ports:
- 3306:3306
command: --binlog-row-metadata=FULL
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it so that in the binlog change events we get all the column names. Without this the column names are empty.

}

func (s *StreamingSource) Run(ctx context.Context, writer writers.Writer) error {
streamer, err := s.syncer.StartSync(mysql.Position{})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want offsets this is where we would pass them in.

return fmt.Errorf("unable to cast event to replication.RowsEvent")
}

if string(rowsEvent.Table.Table) != "foo" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing with a local table named foo, this is where we need to filter for the tables we care about.

slog.Error("Failed to convert event to messages", slog.Any("err", err))
} else {
for i, message := range messages {
slog.Info("messages", slog.Int("index", i), slog.Any("event", message.Event()))
Copy link
Collaborator Author

@nathan-artie nathan-artie Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emit the messages to Kafka.

}

collationMap := event.Table.CollationMap()
dataTypes := make([]schema.DataType, len(event.Table.ColumnType))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mapping to the data types that we use for backfilling, we may not want to do this though and build our own list of converters.

@@ -88,7 +88,7 @@ func (m MySQLAdapter) PartitionKeys() []string {
return m.table.PrimaryKeys
}

func valueConverterForType(d schema.DataType, opts *schema.Opts) (converters.ValueConverter, error) {
func ValueConverterForType(d schema.DataType, opts *schema.Opts) (converters.ValueConverter, error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to share these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant