jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1594222 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
Date Tue, 13 May 2014 13:03:48 GMT
Author: reschke
Date: Tue May 13 13:03:47 2014
New Revision: 1594222

URL: http://svn.apache.org/r1594222
Log:
OAK-1812 - Fix commit mode for Postgres, remove prinln from test case

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java?rev=1594222&r1=1594221&r2=1594222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
Tue May 13 13:03:47 2014
@@ -76,7 +76,7 @@ public class RDBBlobStore extends Cachin
     private void initialize(DataSource ds) throws Exception {
 
         this.ds = ds;
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
 
         try {
             con.setAutoCommit(false);
@@ -138,7 +138,7 @@ public class RDBBlobStore extends Cachin
 
         String id = StringUtils.convertBytesToHex(digest);
         cache.put(id, data);
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
 
         try {
             long now = System.currentTimeMillis();
@@ -190,7 +190,7 @@ public class RDBBlobStore extends Cachin
     // needed in test
     protected byte[] readBlockFromBackend(byte[] digest) throws Exception {
         String id = StringUtils.convertBytesToHex(digest);
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
         byte[] data;
 
         try {
@@ -217,7 +217,7 @@ public class RDBBlobStore extends Cachin
 
         String id = StringUtils.convertBytesToHex(blockId.getDigest());
         byte[] data = cache.get(id);
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
 
         try {
             PreparedStatement prep = con.prepareStatement("select data from datastore_data
where id = ?");
@@ -263,7 +263,7 @@ public class RDBBlobStore extends Cachin
 
     @Override
     protected void mark(BlockId blockId) throws Exception {
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
         try {
             if (minLastModified == 0) {
                 return;
@@ -291,7 +291,7 @@ public class RDBBlobStore extends Cachin
     }
 
     private int sweepFromDatabase() throws SQLException {
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
         try {
             int count = 0;
             PreparedStatement prep = con.prepareStatement("select id from datastore_meta
where lastMod < ?");
@@ -329,7 +329,7 @@ public class RDBBlobStore extends Cachin
             return true;
         }
 
-        Connection con = ds.getConnection();
+        Connection con = getConnection();
         try {
             PreparedStatement prep = null;
             PreparedStatement prepData = null;
@@ -434,6 +434,7 @@ public class RDBBlobStore extends Cachin
             Connection connection = null;
             try {
                 connection = ds.getConnection();
+                connection.setAutoCommit(false);
                 try {
                     PreparedStatement prep = connection.prepareStatement(query.toString());
                     int idx = 1;
@@ -466,4 +467,10 @@ public class RDBBlobStore extends Cachin
             }
         }
     }
+
+    private Connection getConnection() throws SQLException {
+        Connection c = this.ds.getConnection();
+        c.setAutoCommit(false);
+        return c;
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java?rev=1594222&r1=1594221&r2=1594222&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
Tue May 13 13:03:47 2014
@@ -90,7 +90,6 @@ public class RDBBlobStoreTest extends Ab
 
         while (max - min >= 2) {
             test = (max + min) / 2;
-            System.err.println(test);
             byte[] data = new byte[test];
             Random r = new Random(0);
             r.nextBytes(data);



Mime
View raw message