Skip to content

Conversation

@abhinav-1305
Copy link

Description

Fixes #319

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Scenario A
  • Scenario B

Screenshots or Recordings

Related PR's (If Any):

@abhinav-1305 abhinav-1305 changed the title Fix ctx refactor(postgres): pass context to database queries in chunk processing functions Jun 21, 2025
@abhinav-1305
Copy link
Author

please review - @hash-data

Copy link
Collaborator

@ImDoubD-datazip ImDoubD-datazip Jun 23, 2025

Choose a reason for hiding this comment

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

Use QueryContext function in ChunkIterator function in postgres backfill.go.
@abhinav-1305

err := p.client.QueryRowContext(ctx, nextChunkEnd).Scan(&chunkEnd)
if err != nil {
return nil, fmt.Errorf("failed to query[%s] next chunk end: %s", nextChunkEnd, err)
}
Copy link
Collaborator

@ImDoubD-datazip ImDoubD-datazip Jun 23, 2025

Choose a reason for hiding this comment

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

Check for context in MySQL and MongoDB drivers as well, where ever there is a direct call for driver instance or server.
@abhinav-1305

Copy link
Author

@abhinav-1305 abhinav-1305 Jun 23, 2025

Choose a reason for hiding this comment

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

Can this be addressed in other pr?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be addressed in other pr?

Do changes in the CDC for postgres. For mongoDB you can raise another PR if there is any context changes, for the MySQL one please do changes here itself if possible. Pease check for CDC for other drivers as well.

@abhinav-1305

})
}

func (p *Postgres) GetOrSplitChunks(_ context.Context, pool *destination.WriterPool, stream types.StreamInterface) (*types.Set[types.Chunk], error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

in doesReplicationSlotExists as well use QueryRowContext

@datazip-inc datazip-inc deleted a comment from vikaxsh Jun 23, 2025
@ImDoubD-datazip
Copy link
Collaborator

ImDoubD-datazip commented Sep 8, 2025

@abhinav-1305 , any update from your side. also change the merge branch to staging

@ImDoubD-datazip
Copy link
Collaborator

closing. contributor has gotten stale. PR for this #319 is now up by another contributor.
PR: #566

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.

improvement: use context while querying (sql/sqlx)

3 participants