mirror of https://github.com/apache/lucene.git
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:
parent
b0ea2de37d
commit
9db16cd23b
|
@ -55,6 +55,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
*/
|
*/
|
||||||
public class TransactionLog {
|
public class TransactionLog {
|
||||||
public static Logger log = LoggerFactory.getLogger(TransactionLog.class);
|
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";
|
public final static String END_MESSAGE="SOLR_TLOG_END";
|
||||||
|
|
||||||
|
@ -71,7 +73,6 @@ public class TransactionLog {
|
||||||
AtomicInteger refcount = new AtomicInteger(1);
|
AtomicInteger refcount = new AtomicInteger(1);
|
||||||
Map<String,Integer> globalStringMap = new HashMap<String, Integer>();
|
Map<String,Integer> globalStringMap = new HashMap<String, Integer>();
|
||||||
List<String> globalStringList = new ArrayList<String>();
|
List<String> globalStringList = new ArrayList<String>();
|
||||||
final boolean debug = log.isDebugEnabled();
|
|
||||||
|
|
||||||
long snapshot_size;
|
long snapshot_size;
|
||||||
int snapshot_numRecords;
|
int snapshot_numRecords;
|
||||||
|
@ -156,6 +157,9 @@ public class TransactionLog {
|
||||||
addGlobalStrings(globalStrings);
|
addGlobalStrings(globalStrings);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (start > 0) {
|
||||||
|
log.error("New transaction log already exists:" + tlogFile + " size=" + raf.length());
|
||||||
|
}
|
||||||
assert start==0;
|
assert start==0;
|
||||||
if (start > 0) {
|
if (start > 0) {
|
||||||
raf.setLength(0);
|
raf.setLength(0);
|
||||||
|
@ -543,8 +547,8 @@ public class TransactionLog {
|
||||||
|
|
||||||
|
|
||||||
synchronized (TransactionLog.this) {
|
synchronized (TransactionLog.this) {
|
||||||
if (debug) {
|
if (trace) {
|
||||||
log.debug("Reading log record. pos="+pos+" currentSize="+fos.size());
|
log.trace("Reading log record. pos="+pos+" currentSize="+fos.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos >= fos.size()) {
|
if (pos >= fos.size()) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ import java.util.concurrent.*;
|
||||||
public class UpdateLog implements PluginInfoInitialized {
|
public class UpdateLog implements PluginInfoInitialized {
|
||||||
public static Logger log = LoggerFactory.getLogger(UpdateLog.class);
|
public static Logger log = LoggerFactory.getLogger(UpdateLog.class);
|
||||||
public boolean debug = log.isDebugEnabled();
|
public boolean debug = log.isDebugEnabled();
|
||||||
|
public boolean trace = log.isTraceEnabled();
|
||||||
|
|
||||||
|
|
||||||
public enum SyncLevel { NONE, FLUSH, FSYNC }
|
public enum SyncLevel { NONE, FLUSH, FSYNC }
|
||||||
|
@ -141,6 +142,9 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
this.uhandler = uhandler;
|
this.uhandler = uhandler;
|
||||||
|
|
||||||
if (dataDir.equals(lastDataDir)) {
|
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
|
// on a normal reopen, we currently shouldn't have to do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -150,6 +154,10 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
tlogFiles = getLogList(tlogDir);
|
tlogFiles = getLogList(tlogDir);
|
||||||
id = getLastLogId() + 1; // add 1 since we will create a new log for the next update
|
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;
|
TransactionLog oldLog = null;
|
||||||
for (String oldLogName : tlogFiles) {
|
for (String oldLogName : tlogFiles) {
|
||||||
File f = new File(tlogDir, oldLogName);
|
File f = new File(tlogDir, oldLogName);
|
||||||
|
@ -247,8 +255,8 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
map.put(cmd.getIndexedId(), ptr);
|
map.put(cmd.getIndexedId(), ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (trace) {
|
||||||
log.debug("TLOG: added id " + cmd.getPrintableId() + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
|
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);
|
oldDeletes.put(br, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (trace) {
|
||||||
log.debug("TLOG: added delete for id " + cmd.id + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
|
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());
|
LogPtr ptr = new LogPtr(pos, cmd.getVersion());
|
||||||
|
|
||||||
if (debug) {
|
if (trace) {
|
||||||
log.debug("TLOG: added deleteByQuery " + cmd.query + " to " + tlog + " " + ptr + " map=" + System.identityHashCode(map));
|
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) {
|
public void preSoftCommit(CommitUpdateCommand cmd) {
|
||||||
debug = log.isDebugEnabled(); // refresh our view of debugging occasionally
|
debug = log.isDebugEnabled(); // refresh our view of debugging occasionally
|
||||||
|
trace = log.isTraceEnabled();
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
handlers=java.util.logging.ConsoleHandler
|
handlers=java.util.logging.ConsoleHandler
|
||||||
|
java.util.logging.ConsoleHandler.level=FINEST
|
||||||
.level=SEVERE
|
.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
|
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue