Skip to content
This repository has been archived by the owner on Jan 6, 2018. It is now read-only.

Commit

Permalink
Closes OOZIE-22 (Apache) Add support PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Abdelnur committed Aug 23, 2011
1 parent 379d428 commit 513a0ce
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 7 deletions.
6 changes: 6 additions & 0 deletions core/pom.xml
Expand Up @@ -187,6 +187,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
13 changes: 13 additions & 0 deletions core/src/main/resources/META-INF/oozie-postgresql-orm.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<entity class="org.apache.oozie.client.rest.JsonSLAEvent">
<attributes>
<id name="event_id">
<generated-value strategy="SEQUENCE"/>
</id>
</attributes>
</entity>
</entity-mappings>
46 changes: 46 additions & 0 deletions core/src/main/resources/META-INF/persistence.xml
Expand Up @@ -206,4 +206,50 @@
</properties>
</persistence-unit>

<persistence-unit name="oozie-postgresql" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

<mapping-file>META-INF/oozie-postgresql-orm.xml</mapping-file> <!--CUSTOM-->

<class>org.apache.oozie.WorkflowActionBean</class>
<class>org.apache.oozie.WorkflowJobBean</class>
<class>org.apache.oozie.CoordinatorJobBean</class>
<class>org.apache.oozie.CoordinatorActionBean</class>
<class>org.apache.oozie.SLAEventBean</class>
<class>org.apache.oozie.client.rest.JsonWorkflowJob</class>
<class>org.apache.oozie.client.rest.JsonWorkflowAction</class>
<class>org.apache.oozie.client.rest.JsonCoordinatorJob</class>
<class>org.apache.oozie.client.rest.JsonCoordinatorAction</class>
<class>org.apache.oozie.client.rest.JsonSLAEvent</class>

<properties>
<property name="openjpa.ConnectionDriverName" value="org.apache.oozie.util.db.InstrumentedBasicDataSource"/>

<property name="openjpa.ConnectionProperties" value="**INVALID**"/> <!--Set by StoreService at init time -->

<property name="openjpa.MetaDataFactory" value="jpa(Types=org.apache.oozie.WorkflowActionBean;
org.apache.oozie.WorkflowJobBean;
org.apache.oozie.CoordinatorJobBean;
org.apache.oozie.CoordinatorActionBean;
org.apache.oozie.SLAEventBean;
org.apache.oozie.client.rest.JsonSLAEvent;
org.apache.oozie.client.rest.JsonWorkflowJob;
org.apache.oozie.client.rest.JsonWorkflowAction;
org.apache.oozie.client.rest.JsonCoordinatorJob;
org.apache.oozie.client.rest.JsonCoordinatorAction)"></property>

<property name="openjpa.DetachState" value="fetch-groups(DetachedStateField=true)"/>
<property name="openjpa.LockManager" value="pessimistic"/>
<property name="openjpa.ReadLockLevel" value="read"/>
<property name="openjpa.WriteLockLevel" value="write"/>
<property name="openjpa.jdbc.TransactionIsolation" value="read-committed"/> <!--CUSTOM-->
<property name="openjpa.jdbc.DBDictionary" value="UseGetBytesForBlobs=true"/>
<property name="openjpa.jdbc.DBDictionary" value="UseSetBytesForBlobs=true"/>
<property name="openjpa.jdbc.DBDictionary" value="BlobBufferSize=500000"/>
<property name="openjpa.jdbc.DBDictionary" value="batchLimit=50"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
<property name="openjpa.Log" value="log4j"/>
</properties>
</persistence-unit>

</persistence>
41 changes: 41 additions & 0 deletions core/src/test/resources/postgresql-oozie-site.xml
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Copyright (c) 2010 Yahoo! Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<configuration>
<property>
<name>oozie.service.JPAService.jdbc.driver</name>
<value>org.postgresql.Driver</value>
<description>JDBC driver class.</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.url</name>
<value>jdbc:postgresql://localhost:5432/OOZIEDB</value>
<description>JDBC URL.</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.username</name>
<value>OOZIE</value>
<description>DB user name.</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.password</name>
<value>oozie</value>
<description>
DB user password. IMPORTANT: if password is emtpy leave a 1 space string, the service trims the
value, if empty Configuration assumes it is NULL.
</description>
</property>
</configuration>
7 changes: 4 additions & 3 deletions docs/src/site/twiki/AG_Install.twiki
Expand Up @@ -97,15 +97,16 @@ servlet container (if using Tomcat, copy the prepared =oozie.war= file to Tomcat

---++ Database Configuration

Oozie works with HSQL, Derby, MySQL and Oracle databases.
Oozie works with HSQL, Derby, MySQL, Oracle and PostgreSQL databases.

By default, Oozie is configured to use Embedded Derby.

Oozie bundles the JDBC drivers for HSQL and Embedded Derby.
Oozie bundles the JDBC drivers for HSQL, Embedded Derby and PostgreSQL.

HSQL is normally used for testcases as it is an in-memory database and all data is lost everytime Oozie is stopped.

If using MySQL or Oracle, the Oozie database schema must be created. By default, Oozie creates its tables automatically.
If using MySQL, Oracle or PostgreSQL, the Oozie database schema must be created. By default, Oozie creates its
tables automatically.

The =bin/addtowar.sh= and the =oozie-setup.sh= scripts have an option =-jars= that can be used to add the Oracle or
MySQL JDBC driver JARs to the Oozie WAR file.
Expand Down
9 changes: 6 additions & 3 deletions docs/src/site/twiki/ENG_Building.twiki
Expand Up @@ -115,9 +115,12 @@ undefined (Hadoop JARs are not included).

*hadoop20*= (*) : indicates the build/test should not include classes for Hadoop 20S, default is 'false'

*oozie.test.db*= (*): indicates the database to use for running the testcases, supported values are 'hsqldb' and 'derby',
default value is 'hsqldb'. IMPORTANT, when using 'derby' a Maven profile is activated to run all the testcases in
'always' fork mode (otherwise Derby driver goes bonker after 50 testcases or so due to repeated initializations).
*oozie.test.db*= (*): indicates the database to use for running the testcases, supported values are 'hsqldb', 'derby'
and 'other'; default value is 'hsqldb'. IMPORTANT, when using 'derby' a Maven profile is activated to run all the
testcases in 'always' fork mode (otherwise Derby driver goes bonker after 50 testcases or so due to repeated
initializations). Use 'other' when using MySQL, Oracle or PostgreSQL databases, if using 'other' a
'-Doozie.test.config.file=' must be used with the correct JDBC information must be provided (the
core/src/test/resources/ directory has samples for the different databases).

*oozie.test.properties* (*): indicates the file to load the test properties from, by default is =test.properties=.
Having this option allows having different test properties sets, for example: minicluster, simple & kerberos.
Expand Down
11 changes: 10 additions & 1 deletion pom.xml
Expand Up @@ -51,6 +51,8 @@

<test.exclude>_</test.exclude>
<test.exclude.pattern>_</test.exclude.pattern>

<oozie.data.dir>${project.build.directory}/test-data</oozie.data.dir>
</properties>

<modules>
Expand Down Expand Up @@ -439,7 +441,13 @@
<artifactId>greenmail</artifactId>
<version>1.3.1b</version>
</dependency>


<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -564,6 +572,7 @@
<argLine>-Xmx1024m</argLine>
<systemPropertiesVariables>
<hadoop.log.dir>/tmp</hadoop.log.dir>
<oozie.data.dir>${oozie.data.dir}</oozie.data.dir>
</systemPropertiesVariables>
<excludes>
<exclude>**/${test.exclude}.java</exclude>
Expand Down
1 change: 1 addition & 0 deletions release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 2.3.2 release

OOZIE-22 (Apache) Add support PostgreSQL
OOZIE-9 (Apache) Launcher job should be able to run in different queue than job itself
OOZIE-135 support multiple shared lib path in oozie
OOZIE-81 Add an email action to Oozie
Expand Down

0 comments on commit 513a0ce

Please sign in to comment.