Type: New Feature
Affects Version/s: None
Fix Version/s: 1.4.3
- Fast data export into PostgreSQL database with pg_bulkload.
- User can get benefit of functionality of pg_bulkload such as
- fast export bypassing shared bufferes and WAL,
- removing invalid data which cause parse error,
- ETL feature with filter functions.
At first, each map tasks create their own staging table with names based on task attempt id because pg_bulkload holds table level lock.
Arguments of pg_bulkload command can be passed via configuration object.
The Mapper export data by invoking pg_bulkload command as external process.
Commnad execution is done in the same way as DirectPostgresqlManager.
Reducer migrates data from staging tables into destination table.
Reducer gets the names of staging tables as map output values.
In order to do migration in a transaction, the number of reducers must be 1. (It is set by ConnectionManager internally).
Migration is done in same way as Sqoop defalt connectors using "INSERT INTO dst ( SELECT * FROM src )".
In the cleanup method, staging tables are dropped.
If exception is raised in the reducer, garbage staging tables are left.
User can delete them by executing this connector with --clear-staging-table option.
- pg_bulkload must be installed on DB server and all slave nodes.
- RPM for RedHat or CentOS is available in download page.
- PostgreSQL JDBC is also required on client node (same as PostgresqlManager).
- Superuser role of PostgreSQL database is required for execution of pg_bulkload.
Currently there is no Factory class.
Specify connection manager class name with --connection-manager option to use.
You can also specify pg_bulkload configuration with Hadoop configuration properties.
There is test class named PGBulkloadManagerManualTest extending TestExport.
This test expects that
- The major version of PostgreSQL is 9.0,
- The version of pg_bulkload is 3.1.1,
- PostgreSQL server is running on localhost:5432 of testing node,
- there is database named sqooptest,
- super user role named sqooptest exists,
- no password is set for the role, or .pgpass file is created.
Tests can be invoked as below.
Install JDK and Ant:
Setup for PostgreSQL:
Setup for pg_bulkload and PostgreSQL JDBC Driver:
Setup for PostgreSQL JDBC Driver: