SOLR-3206: fixed the test, will follow up with a root problem fix too.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1297927 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2012-03-07 10:53:23 +00:00
parent 786d3bcf14
commit ad453aeeda
2 changed files with 9 additions and 6 deletions

View File

@ -49,6 +49,9 @@ import java.util.concurrent.*;
/** @lucene.experimental */
public class UpdateLog implements PluginInfoInitialized {
public static String LOG_FILENAME_PATTERN = "%s.%019d";
public static String TLOG_NAME="tlog";
public static Logger log = LoggerFactory.getLogger(UpdateLog.class);
public boolean debug = log.isDebugEnabled();
public boolean trace = log.isTraceEnabled();
@ -76,10 +79,6 @@ public class UpdateLog implements PluginInfoInitialized {
}
}
public static String TLOG_NAME="tlog";
long id = -1;
private State state = State.ACTIVE;
@ -615,7 +614,7 @@ public class UpdateLog implements PluginInfoInitialized {
private void ensureLog() {
if (tlog == null) {
String newLogName = String.format(Locale.ENGLISH, "%s.%019d", TLOG_NAME, id);
String newLogName = String.format(Locale.ENGLISH, LOG_FILENAME_PATTERN, TLOG_NAME, id);
try {
tlog = new TransactionLog(new File(tlogDir, newLogName), globalStrings);
} catch (IOException e) {

View File

@ -785,7 +785,11 @@ public class TestRecovery extends SolrTestCaseJ4 {
findReplace("CCCCCC".getBytes("UTF-8"), "cccccc".getBytes("UTF-8"), content);
// WARNING... assumes format of .00000n where n is less than 9
String fname2 = fname.substring(0, fname.length()-1) + (char)(fname.charAt(fname.length()-1)+1);
long logNumber = Long.parseLong(fname.substring(fname.lastIndexOf(".") + 1));
String fname2 = String.format(Locale.ENGLISH,
UpdateLog.LOG_FILENAME_PATTERN,
UpdateLog.TLOG_NAME,
logNumber + 1);
raf = new RandomAccessFile(new File(logDir, fname2), "rw");
raf.write(content);
raf.close();