-
Notifications
You must be signed in to change notification settings - Fork 304
Labels
Description
Versions
- Client: Plain HTTP (integration test using Electric.Client)
- Electric: sync-service (Elixir backend) - current main branch
Bug Description
Batch INSERT statements with row counts exactly divisible by 100 (100, 200, 300, 400, 500, etc.) fail to replicate. The database insert succeeds, but zero messages are received by clients instead of the expected number of change messages.
Affected Batch Sizes
- ✅ Works: 25, 50, 75, 125, 150, 175, 225, 250, 275, 325, 350, 375, 425, 450, 475
- ❌ Fails: 100, 200, 300, 400, 500 (and presumably 600, 700, etc.)
Expected Behavior
When executing a batch INSERT statement with N rows (e.g., INSERT INTO items VALUES (...), (...), ... with 100 rows), the Electric sync service should:
- Successfully insert all N rows into the database (this works)
- Replicate all N change messages to subscribed clients (this fails for N divisible by 100)
- Clients should receive N
ChangeMessageevents withoperation: :insert
Steps to Reproduce
- Set up a table and Electric shape subscription
- Execute a batch INSERT with exactly 100 rows (or 200, 300, etc.)
- Wait for replication
- Observe that 0 messages are received instead of 100
Test Case
See attached test file: packages/sync-service/test/integration/batch_insert_test.exs (Please remove the extension .txt as github won't let me attach a .exs file`
- Test:
"receives all rows from batch insert (100 rows)" - Expected: 100 messages
- Actual: 0 messages