Skip to content
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

FIx case where table has no rows #1393

Merged
merged 1 commit into from
Feb 28, 2024
Merged

FIx case where table has no rows #1393

merged 1 commit into from
Feb 28, 2024

Conversation

Amogh-Bharadwaj
Copy link
Contributor

@Amogh-Bharadwaj Amogh-Bharadwaj commented Feb 28, 2024

Currently for a table with no rows in it, initial load fails with:

WorkflowTaskFailed
--
  "message": "runtime error: integer divide by zero",

This was occurring in processPartitions in qrep_flow.go:

	chunkSize := shared.DivCeil(len(partitions), maxParallelWorkers)
	batches := make([][]*protos.QRepPartition, 0, len(partitions)/chunkSize+1) -- div by zero if no partitions

This PR fixes this by skipping processPartitions if there are no partitions

Functionally tested

@Amogh-Bharadwaj Amogh-Bharadwaj merged commit a8a1f47 into main Feb 28, 2024
7 checks passed
@Amogh-Bharadwaj Amogh-Bharadwaj deleted the fix-no-rows-case branch February 28, 2024 05:23
@iskakaushik
Copy link
Contributor

test needed

@Amogh-Bharadwaj
Copy link
Contributor Author

test needed

#1396

Amogh-Bharadwaj added a commit that referenced this pull request Feb 28, 2024
Adds a test for syncing an empty table via QRep. 
This PR is to address [this
comment](#1393 (comment))

The test successfully caught the error which was seen
[pre-patch](#1393):
```
        qrep_flow_pg_test.go:340: 
                Error Trace: peerdb/flow/e2e/postgres/qrep_flow_pg_test.go:340
                Error:          Received unexpected error:
                                workflow execution error (type: QRepFlowWorkflow, workflowID: default-test-workflow-id, runID: default-test-run-id): 
runtime error: integer divide by zero
```
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.

3 participants