Author: chetanm
Date: Wed Nov 16 04:09:26 2016
New Revision: 1769923
URL: http://svn.apache.org/viewvc?rev=1769923&view=rev
Log:
OAK-2719 - Misleading warn message about local copy size different than remote
copy in oak-lucene with copyOnRead enabled
Check if the file's copy is in progress before logging a warn message
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java?rev=1769923&r1=1769922&r2=1769923&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
Wed Nov 16 04:09:26 2016
@@ -279,6 +279,10 @@ public class IndexCopier implements Copy
return System.currentTimeMillis();
}
+ public boolean isCopyInProgress(LocalIndexFile file) {
+ return copyInProgressFiles.contains(file);
+ }
+
public void doneCopy(LocalIndexFile file, long start) {
copyInProgressFiles.remove(file);
copyInProgressCount.decrementAndGet();
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java?rev=1769923&r1=1769922&r2=1769923&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java
Wed Nov 16 04:09:26 2016
@@ -216,10 +216,15 @@ public class CopyOnReadDirectory extends
//Do a simple consistency check. Ideally Lucene index files
are never
//updated but still do a check if the copy is consistent
if (localLength != remoteLength) {
- log.warn("[{}] Found local copy for {} in {} but size of
local {} differs from remote {}. " +
- "Content would be read from remote file
only",
- indexPath, name, local, localLength, remoteLength);
- indexCopier.foundInvalidFile();
+ LocalIndexFile file = new LocalIndexFile(local, name,
remoteLength, true);
+ if (!indexCopier.isCopyInProgress(file)) {
+ log.warn("[{}] Found local copy for {} in {} but size
of local {} differs from remote {}. " +
+ "Content would be read from remote
file only",
+ indexPath, name, local, localLength,
remoteLength);
+ indexCopier.foundInvalidFile();
+ } else {
+ log.trace("[{}] Found in progress copy of file {}.
Would read from remote", indexPath, name);
+ }
} else {
reference.markValid();
log.trace("[{}] found local copy of file {}",