This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to work around RAM limits
I wonder if the probelem in cgov is RAM limits in a container?
- Loading branch information
Showing
10 changed files
with
198 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,32 @@ | |
"name": "postgres", | ||
"password": "", | ||
"port": "5432", | ||
"uri": "postgres://USERNAMEINDIA:[email protected]:5432/DBNAMEINDIA", | ||
"uri": "postgres://[email protected]:5432/postgres?sslmode=disable", | ||
"username": "postgres" | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
}, | ||
{ | ||
"label": "fac-snapshot-db", | ||
"provider": null, | ||
"plan": null, | ||
"name": "fac-snapshot-db", | ||
"tags": [ | ||
"database", | ||
"docker" | ||
], | ||
"instance_guid": "UUIDJULIET1", | ||
"instance_name": "db", | ||
"binding_guid": "UUIDJULIET2", | ||
"binding_name": null, | ||
"credentials": { | ||
"db_name": "postgres", | ||
"host": "127.0.0.1", | ||
"name": "postgres", | ||
"password": "", | ||
"port": "6543", | ||
"uri": "postgres://[email protected]:6543/postgres?sslmode=disable", | ||
"username": "postgres" | ||
}, | ||
"syslog_drain_url": null, | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package util | ||
|
||
import ( | ||
"database/sql" | ||
"os" | ||
|
||
"gov.gsa.fac.cgov-util/internal/logging" | ||
"gov.gsa.fac.cgov-util/internal/vcap" | ||
) | ||
|
||
func Get_table_and_schema_names(source_creds *vcap.CredentialsRDS) map[string]string { | ||
// Do this table-by-table for RAM reasons. | ||
db, err := sql.Open("postgres", source_creds.Uri) | ||
if err != nil { | ||
logging.Logger.Println("BACKUPS could not connect to DB for table-by-table dump") | ||
logging.Logger.Printf("BACKUPS %s\n", err) | ||
os.Exit(-1) | ||
} | ||
|
||
tables, err := db.Query("SELECT schemaname, tablename FROM pg_tables WHERE schemaname = 'public'") | ||
if err != nil { | ||
logging.Logger.Println("BACKUPS could not get table names for table-by-table dump") | ||
logging.Logger.Printf("BACKUPS %s\n", err) | ||
os.Exit(-1) | ||
} | ||
|
||
table_names := make(map[string]string, 0) | ||
|
||
for tables.Next() { | ||
var table string | ||
var schema string | ||
if err := tables.Scan(&schema, &table); err != nil { | ||
logging.Logger.Println("BACKUPS could not scan table names in SELECT") | ||
os.Exit(-1) | ||
} | ||
table_names[table] = schema | ||
} | ||
|
||
return table_names | ||
} |
This file contains 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