-
Notifications
You must be signed in to change notification settings - Fork 11
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
import multiple tables at same time - 1 #2191
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments
if err != nil { | ||
utils.ErrExit("preparing for file import: %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this PrepareForFileImport
here? we are already doing it in NewFileBatchProducer
lastBatchNumber: lastBatchNumber, | ||
lastOffset: lastOffset, | ||
fileFullySplit: fileFullySplit, | ||
completed: completed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: completed: len(pendingBatches) == 0 && fileFullySplit
return nil, err | ||
} | ||
if p.lineFromPreviousBatch != "" { | ||
err = batchWriter.WriteRecord(p.lineFromPreviousBatch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment for explaining about this lineFromPreviousBatch
} | ||
|
||
// 3 batches should be produced | ||
// while calculating for the first batch, the header is also considered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, while preparing the first batch - we add the bytes of the header to the batch's total bytes but for the further batches, we don't as we already have the header we don't include it in the batch's bytes.
I think worth testing if in some cases where the number of columns is huge can this header's bytes can also contribute to the batches' bytes and should be included.
Can you please add a TODO while we are adding a header to bthe atch file to fix this if required?
assert.NotNil(t, batch1) | ||
assert.Equal(t, int64(2), batch1.RecordCount) | ||
|
||
// simulate a crash and recover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test for recovery situation!
Describe the changes in this pull request
FileBatchProducer
Describe if there are any user-facing changes
How was this pull request tested?
Wrote unit tests.
To run integration tests:
Does your PR have changes that can cause upgrade issues?