gtfsdb: compute batch size via SQLite limit and fail fast on invalid …#528
Merged
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom Mar 1, 2026
Merged
Conversation
aaronbrethorst
approved these changes
Mar 1, 2026
Member
aaronbrethorst
left a comment
There was a problem hiding this comment.
Hey Aditya, this is a really clean follow-up. Removing the dead BulkInsertBatchSize/DefaultBulkInsertBatchSize code, switching to a panic for what can only ever be a programmer error, and extracting the magic numbers into named constants — each change makes the code clearer and more honest about its invariants. I verified that stopTimeFieldsPerRow = 10 and shapeFieldsPerRow = 5 both match their respective INSERT column lists, placeholder counts, and args-per-row exactly. The updated batch size comment in bulkInsertShapes is also accurate (50 * 6553 = ~327k).
There's nothing left to change — this PR is ready to merge. Nice work keeping the follow-up focused and tidy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #517 addressing review feedback.
Changes
BulkInsertBatchSizefield andDefaultBulkInsertBatchSizeconstantSafeBatchSizeusing SQLite variable limit (32766)stopTimeFieldsPerRow=10andshapeFieldsPerRow=5constants for clarityfieldsPerRow <= 0(programmer error)bulkInsertShapesTestSafeBatchSizeto assert panic for invalid inputNotes
fieldsPerRowis a compile-time constant at call sites, so invalid valuesrepresent programmer error and should fail fast.
Follow-up to #517.