Skip to content

refactor: use pglogrepl's message parser for WAL parsing#15

Merged
Imtiaz246 merged 2 commits intomasterfrom
refactor/use-pglogrepl-parser
Jan 15, 2026
Merged

refactor: use pglogrepl's message parser for WAL parsing#15
Imtiaz246 merged 2 commits intomasterfrom
refactor/use-pglogrepl-parser

Conversation

@tamalsaha
Copy link

Summary

Replace custom BinaryParser with pglogrepl.Parse() for consistency with the upstream library and improved maintainability.

Changes

Core Refactoring

  • parser.go: Replace BinaryParser with Parser using pglogrepl.Parse()
  • wal.go: Update WAL struct to use pglogrepl.LSN and uint32 for relationID
  • wal.go: Update CreateActionData() to accept *pglogrepl.TupleData instead of []TupleData
  • protocol.go: Remove custom message types (now uses pglogrepl types)
  • main.go: Use NewParser() instead of NewBinaryParser()

Test Updates

  • Rewrite parser tests for new implementation
  • Update wal tests for new types (pglogrepl.LSN, uint32, *pglogrepl.TupleData)
  • Fix nats_test.go subject name expectation

Bug Fixes

  • Remove valid:"required" from NatsCredPath (only needed for NATS publisher)
  • Fix config test expectations for lowercase field names

Documentation

  • Update copilot-instructions.md to document pglogrepl usage

Benefits

  • Eliminates ~950 lines of custom WAL parsing code
  • Uses battle-tested pglogrepl library for message parsing
  • Simpler, more maintainable codebase
  • Consistent with upstream pglogrepl types

kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
@tamalsaha tamalsaha dismissed kodiakhq[bot]’s stale review January 6, 2026 17:07

The merge-base changed after approval.

kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
@kubeops kubeops deleted a comment from CLAassistant Jan 6, 2026
@tamalsaha tamalsaha force-pushed the refactor/use-pglogrepl-parser branch from 367a85b to 27a25b8 Compare January 6, 2026 17:08
@tamalsaha tamalsaha force-pushed the refactor/use-pglogrepl-parser branch from 27a25b8 to cdb62dd Compare January 6, 2026 17:16
kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
kodiakhq[bot]
kodiakhq bot previously approved these changes Jan 6, 2026
Replace custom BinaryParser with pglogrepl.Parse() for consistency
with the upstream library and improved maintainability.

Changes:
- Replace BinaryParser with Parser using pglogrepl.Parse()
- Update WAL struct to use pglogrepl.LSN and uint32 for relationID
- Update CreateActionData to accept *pglogrepl.TupleData
- Remove custom message types from protocol.go (now uses pglogrepl types)
- Rewrite parser tests for new implementation
- Update wal tests for new types
- Fix main.go to use NewParser() instead of NewBinaryParser()
- Fix NatsCredPath validation (not required for all publisher types)
- Fix config test expectations for lowercase field names
- Fix nats_test.go subject name expectation
- Update copilot-instructions.md to document pglogrepl usage

Signed-off-by: Tamal Saha <tamal@appscode.com>
Signed-off-by: Imtiaz Uddin <imtiaz@appscode.com>
@Imtiaz246 Imtiaz246 merged commit e2e87a0 into master Jan 15, 2026
4 checks passed
@Imtiaz246 Imtiaz246 deleted the refactor/use-pglogrepl-parser branch January 15, 2026 18:41
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.

2 participants