tests: try to track down the tlog-already-exists issue

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1236410 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-01-26 22:09:08 +00:00
parent b0ea2de37d
commit 9db16cd23b
3 changed files with 25 additions and 9 deletions

View File

@ -55,6 +55,8 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class TransactionLog {
public static Logger log = LoggerFactory.getLogger(TransactionLog.class);
final boolean debug = log.isDebugEnabled();
final boolean trace = log.isTraceEnabled();
public final static String END_MESSAGE="SOLR_TLOG_END";
@ -71,7 +73,6 @@ public class TransactionLog {
AtomicInteger refcount = new AtomicInteger(1);
Map<String,Integer> globalStringMap = new HashMap<String, Integer>();
List<String> globalStringList = new ArrayList<String>();
final boolean debug = log.isDebugEnabled();
long snapshot_size;
int snapshot_numRecords;
@ -156,6 +157,9 @@ public class TransactionLog {
addGlobalStrings(globalStrings);
}
} else {
if (start > 0) {
log.error("New transaction log already exists:" + tlogFile + " size=" + raf.length());
}
assert start==0;
if (start > 0) {
raf.setLength(0);
@ -543,8 +547,8 @@ public class TransactionLog {
synchronized (TransactionLog.this) {
if (debug) {
log.debug("Reading log record. pos="+pos+" currentSize="+fos.size());
if (trace) {
log.trace("Reading log record. pos="+pos+" currentSize="+fos.size());
}
if (pos >= fos.size()) {

View File

@ -48,6 +48,7 @@ import java.util.concurrent.*;
public class UpdateLog implements PluginInfoInitialized {
public static Logger log = LoggerFactory.getLogger(UpdateLog.class);
public boolean debug = log.isDebugEnabled();
public boolean trace = log.isTraceEnabled();
public enum SyncLevel { NONE, FLUSH, FSYNC }
@ -141,6 +142,9 @@ public class UpdateLog implements PluginInfoInitialized {
this.uhandler = uhandler;
if (dataDir.equals(lastDataDir)) {
if (debug) {
log.debug("UpdateHandler init: tlogDir=" + tlogDir + ", next id=" + id, " this is a reopen... nothing else to do.");
}
// on a normal reopen, we currently shouldn't have to do anything
return;
}
@ -150,6 +154,10 @@ public class UpdateLog implements PluginInfoInitialized {
tlogFiles = getLogList(tlogDir);
id = getLastLogId() + 1; // add 1 since we will create a new log for the next update
if (debug) {
log.debug("UpdateHandler init: tlogDir=" + tlogDir + ", existing tlogs=" + Arrays.asList(tlogFiles) + ", next id=" + id);
}
TransactionLog oldLog = null;
for (String oldLogName : tlogFiles) {
File f = new File(tlogDir, oldLogName);
@ -247,8 +255,8 @@ public class UpdateLog implements PluginInfoInitialized {
map.put(cmd.getIndexedId(), ptr);
}
if (debug) {
log.debug("TLOG: added id " + cmd.getPrintableId() + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
if (trace) {
log.trace("TLOG: added id " + cmd.getPrintableId() + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
}
}
}
@ -274,8 +282,8 @@ public class UpdateLog implements PluginInfoInitialized {
oldDeletes.put(br, ptr);
}
if (debug) {
log.debug("TLOG: added delete for id " + cmd.id + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
if (trace) {
log.trace("TLOG: added delete for id " + cmd.id + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
}
}
}
@ -312,8 +320,8 @@ public class UpdateLog implements PluginInfoInitialized {
LogPtr ptr = new LogPtr(pos, cmd.getVersion());
if (debug) {
log.debug("TLOG: added deleteByQuery " + cmd.query + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
if (trace) {
log.trace("TLOG: added deleteByQuery " + cmd.query + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
}
}
}
@ -385,6 +393,7 @@ public class UpdateLog implements PluginInfoInitialized {
public void preSoftCommit(CommitUpdateCommand cmd) {
debug = log.isDebugEnabled(); // refresh our view of debugging occasionally
trace = log.isTraceEnabled();
synchronized (this) {

View File

@ -1,4 +1,7 @@
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=FINEST
.level=SEVERE
org.apache.solr.update.UpdateLog.level=FINEST
org.apache.solr.update.TransactionLog.level=FINEST
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter