remove some core changes; add missing sync that caused stress test failure

This commit is contained in:
Mike McCandless 2016-02-10 09:09:49 -05:00
parent 027bc0e4d6
commit 3a47dd29bc
3 changed files with 33 additions and 36 deletions

View File

@ -175,10 +175,8 @@ public class NRTCachingDirectory extends FilterDirectory implements Accountable
@Override @Override
public void renameFile(String source, String dest) throws IOException { public void renameFile(String source, String dest) throws IOException {
unCache(source); unCache(source);
try { if (cache.fileNameExists(dest)) {
cache.deleteFile(dest); throw new IllegalArgumentException("target file " + dest + " already exists");
} catch (FileNotFoundException fnfe) {
// OK -- it may not exist
} }
in.renameFile(source, dest); in.renameFile(source, dest);
} }

View File

@ -107,9 +107,6 @@ public final class IOUtils {
* objects to call <tt>close()</tt> on * objects to call <tt>close()</tt> on
*/ */
public static void closeWhileHandlingException(Closeable... objects) { public static void closeWhileHandlingException(Closeable... objects) {
if (objects.length == 0) {
throw new IllegalArgumentException("pass at least one Closeable");
}
closeWhileHandlingException(Arrays.asList(objects)); closeWhileHandlingException(Arrays.asList(objects));
} }

View File

@ -679,6 +679,7 @@ class SimplePrimaryNode extends PrimaryNode {
int replicaTCPPort = in.readVInt(); int replicaTCPPort = in.readVInt();
message("new replica: " + warmingSegments.size() + " current warming merges"); message("new replica: " + warmingSegments.size() + " current warming merges");
// Step through all currently warming segments and try to add this replica if it isn't there already: // Step through all currently warming segments and try to add this replica if it isn't there already:
synchronized(warmingSegments) {
for(MergePreCopy preCopy : warmingSegments) { for(MergePreCopy preCopy : warmingSegments) {
message("warming segment " + preCopy.files.keySet()); message("warming segment " + preCopy.files.keySet());
boolean found = false; boolean found = false;
@ -715,6 +716,7 @@ class SimplePrimaryNode extends PrimaryNode {
c.s.shutdownOutput(); c.s.shutdownOutput();
message("successfully started warming"); message("successfully started warming");
} }
}
break; break;
default: default: