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

Occasionally recycle Postgres source connections #20

Merged
merged 1 commit into from
Jun 13, 2016

Conversation

ashawley
Copy link
Contributor

As mentioned in #16, I try reopening fresh connections with this change after uploading a file to S3. It is a useful change, since uploading a file could take a while, and the connection could become stale. I've found it makes the script progress further with the larger tables, but the same error will still happen.

According to the documentation for PG::Connection, the reset method:

Resets the backend connection. This method closes the backend connection and tries to re-connect.)

This fix is a stopgap for some large tables, but the code will need a refactor to successfully handle really large tables.

	* postgres_to_redshift.rb (PostgresToRedshift#copy_table): Call
	PG::Conection.reset after uploading a file to S3.
@toothrot
Copy link
Owner

Merging this, but we definitely need to figure out whats happening here. I'll try generating a big data set and playing with the Simply Monthly Calculator to see how much it costs :)

@toothrot toothrot merged commit e1ed251 into toothrot:master Jun 13, 2016
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