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/01/18 15:48:08 UTC
svn commit: r1725281 -
/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
Author: reschke
Date: Mon Jan 18 14:48:07 2016
New Revision: 1725281
URL: http://svn.apache.org/viewvc?rev=1725281&view=rev
Log:
OAK-3872: RDBBlobStore - fix problem when cleaning up data rows (ported to 1.0)
Thanks to Amit Jain for the report and the repro test case; used the fix proposed by Thomas Mueller, added diagnostics and tuned test case.
(Also refactored a bit to minimize differences from current branches; discovered a bug while doing so)
Modified:
jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java?rev=1725281&r1=1725280&r2=1725281&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java Mon Jan 18 14:48:07 2016
@@ -486,11 +486,15 @@ public class RDBBlobStore extends Cachin
@Override
public boolean deleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception {
+ return (chunkIds.size() == countDeleteChunks(chunkIds, maxLastModifiedTime));
+ }
+ // @Override OAK-2973
+ public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception {
// sanity check
if (chunkIds.isEmpty()) {
// sanity check, nothing to do
- return true;
+ return 0;
}
Connection con = this.ch.getRWConnection();
@@ -509,7 +513,7 @@ public class RDBBlobStore extends Cachin
// delete only if the last modified is OLDER than x
metaStatement.append(" and LASTMOD <= ?");
// delete if there is NO entry where the last modified of the meta is YOUNGER than x
- dataStatement.append(" and not exists(select * from " + this.tnMeta + " m where ID = m.ID and m.LASTMOD >= ?)");
+ dataStatement.append(" and not exists(select * from " + this.tnMeta + " m where ID = m.ID and m.LASTMOD > ?)");
}
prepMeta = con.prepareStatement(metaStatement.toString());
@@ -531,10 +535,10 @@ public class RDBBlobStore extends Cachin
String message = String.format(
"chunk deletion affected different numbers of DATA records (%s) and META records (%s)", deletedMeta,
deletedData);
- System.err.println(message);
LOG.info(message);
}
- return deletedMeta == chunkIds.size();
+
+ return deletedMeta;
} finally {
closeStatement(prepMeta);
closeStatement(prepData);