Permalink
Browse files

Closes OOZIE-22 (Apache) Add support PostgreSQL

  • Loading branch information...
1 parent e7b4d9d commit 5fc50a73228705fd0e070d6ce2c442e5580137d1 Alejandro Abdelnur committed Aug 22, 2011
View
@@ -187,6 +187,12 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
</dependencies>
<build>
@@ -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>
@@ -241,4 +241,59 @@
</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.BundleJobBean</class>
+ <class>org.apache.oozie.BundleActionBean</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>
+ <class>org.apache.oozie.client.rest.JsonBundleJob</class>
+ <class>org.apache.oozie.util.db.ValidateConnectionBean</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.BundleJobBean;
+ org.apache.oozie.BundleActionBean;
+ 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;
+ org.apache.oozie.client.rest.JsonBundleJob;
+ org.apache.oozie.util.db.ValidateConnectionBean)"></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>
@@ -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>
@@ -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.
@@ -115,9 +115,9 @@ 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',
+*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).
+'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.
View
11 pom.xml
@@ -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>
@@ -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>
@@ -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>
View
@@ -1,5 +1,6 @@
-- Oozie 3.1.0 release
+OOZIE-22 (Apache) Add support PostgreSQL
OOZIE-10 add user-retry in workflow action
OOZIE-123 CoordKillXCommand command uniqueness and increase priority
OOZIE-9 (Apache) Launcher job should be able to run in different queue than job itself

0 comments on commit 5fc50a7

Please sign in to comment.