You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2016/05/10 15:18:42 UTC

svn commit: r1743211 - in /jackrabbit/oak/branches/1.4: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java

Author: reschke
Date: Tue May 10 15:18:42 2016
New Revision: 1743211

URL: http://svn.apache.org/viewvc?rev=1743211&view=rev
Log:
OAK-4250: add test coverage for find() with ultra-long keys, also avoid misleading ERROR logging in RDBDocumentStore (ported to 1.4)

Modified:
    jackrabbit/oak/branches/1.4/   (props changed)
    jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
    jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java

Propchange: jackrabbit/oak/branches/1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 15:18:42 2016
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738775,1738833,1738950,1738957,1738963,1739894,1740971,1741032,1741339,1741343,1742520,1742888,1742916,1743097,1743172
+/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738775,1738833,1738950,1738957,1738963,1739894,1740116,1740971,1741032,1741339,1741343,1742520,1742888,1742916,1743097,1743172
 /jackrabbit/trunk:1345480

Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java?rev=1743211&r1=1743210&r2=1743211&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java (original)
+++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java Tue May 10 15:18:42 2016
@@ -604,7 +604,7 @@ public class RDBDocumentStoreJDBC {
                     rows.add(row);
                 }
             } catch (SQLException ex) {
-                LOG.error("attempting to read " + keys, ex);
+                LOG.debug("attempting to read " + keys, ex);
                 // DB2 throws an SQLException for invalid keys; handle this more
                 // gracefully
                 if ("22001".equals(ex.getSQLState())) {
@@ -664,7 +664,7 @@ public class RDBDocumentStoreJDBC {
                 return null;
             }
         } catch (SQLException ex) {
-            LOG.error("attempting to read " + id + " (id length is " + id.length() + ")", ex);
+            LOG.debug("attempting to read " + id + " (id length is " + id.length() + ")", ex);
             // DB2 throws an SQLException for invalid keys; handle this more
             // gracefully
             if ("22001".equals(ex.getSQLState())) {

Modified: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java?rev=1743211&r1=1743210&r2=1743211&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java (original)
+++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java Tue May 10 15:18:42 2016
@@ -268,6 +268,18 @@ public class BasicDocumentStoreTest exte
         testMaxId(false);
     }
 
+    @Test
+    public void testLongId() {
+        String id = "0:/" + generateId(2048, true);
+        assertNull("find() with ultra-long id needs to return 'null'", super.ds.find(Collection.NODES, id));
+
+        if (! super.dsname.contains("Memory")) {
+            UpdateOp up = new UpdateOp(id,  true);
+            up.set("_id", id);
+            assertFalse("create() with ultra-long id needs to fail", super.ds.create(Collection.NODES, Collections.singletonList(up)));
+        }
+    }
+
     private int testMaxId(boolean ascii) {
         int min = 0;
         int max = 32768;