You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2012/01/26 23:09:08 UTC

svn commit: r1236410 - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/update/TransactionLog.java core/src/java/org/apache/solr/update/UpdateLog.java testlogging.properties

Author: yonik
Date: Thu Jan 26 22:09:08 2012
New Revision: 1236410

URL: http://svn.apache.org/viewvc?rev=1236410&view=rev
Log:
tests: try to track down the tlog-already-exists issue

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java
    lucene/dev/trunk/solr/testlogging.properties

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java?rev=1236410&r1=1236409&r2=1236410&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java Thu Jan 26 22:09:08 2012
@@ -55,6 +55,8 @@ import java.util.concurrent.atomic.Atomi
  */
 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()) {

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1236410&r1=1236409&r2=1236410&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java Thu Jan 26 22:09:08 2012
@@ -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 Plugin
     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 Plugin
     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 Plugin
         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 Plugin
         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 Plugin
 
       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 Plugin
 
   public void preSoftCommit(CommitUpdateCommand cmd) {
     debug = log.isDebugEnabled(); // refresh our view of debugging occasionally
+    trace = log.isTraceEnabled();
 
     synchronized (this) {
 

Modified: lucene/dev/trunk/solr/testlogging.properties
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/testlogging.properties?rev=1236410&r1=1236409&r2=1236410&view=diff
==============================================================================
--- lucene/dev/trunk/solr/testlogging.properties (original)
+++ lucene/dev/trunk/solr/testlogging.properties Thu Jan 26 22:09:08 2012
@@ -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
 



Re: svn commit: r1236410 - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/update/TransactionLog.java core/src/java/org/apache/solr/update/UpdateLog.java testlogging.properties

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Thu, Jan 26, 2012 at 7:25 PM, Robert Muir <rc...@gmail.com> wrote:
> I noticed on test output seeing some thai numerals that the
> transaction log filename is using the default locale String.format,
> but then parsed with Long.parseLong
>
> I can't think of any bugs/problems in this, except possible confusion
> of localized filenames, but I think it would be safer to pass
> Locale.ENGLISH to String.format...

Thanks! I'll give it a shot and cross my fingers...
could be a localization bug with that JVM or something.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: svn commit: r1236410 - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/update/TransactionLog.java core/src/java/org/apache/solr/update/UpdateLog.java testlogging.properties

Posted by Robert Muir <rc...@gmail.com>.
I noticed on test output seeing some thai numerals that the
transaction log filename is using the default locale String.format,
but then parsed with Long.parseLong

I can't think of any bugs/problems in this, except possible confusion
of localized filenames, but I think it would be safer to pass
Locale.ENGLISH to String.format...

On Thu, Jan 26, 2012 at 5:09 PM,  <yo...@apache.org> wrote:
> Author: yonik
> Date: Thu Jan 26 22:09:08 2012
> New Revision: 1236410
>
> URL: http://svn.apache.org/viewvc?rev=1236410&view=rev
> Log:
> tests: try to track down the tlog-already-exists issue
>
> Modified:
>    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java
>    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java
>    lucene/dev/trunk/solr/testlogging.properties
>
> Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java
> URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java?rev=1236410&r1=1236409&r2=1236410&view=diff
> ==============================================================================
> --- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java (original)
> +++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/TransactionLog.java Thu Jan 26 22:09:08 2012
> @@ -55,6 +55,8 @@ import java.util.concurrent.atomic.Atomi
>  */
>  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()) {
>
> Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java
> URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1236410&r1=1236409&r2=1236410&view=diff
> ==============================================================================
> --- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
> +++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/UpdateLog.java Thu Jan 26 22:09:08 2012
> @@ -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 Plugin
>     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 Plugin
>     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 Plugin
>         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 Plugin
>         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 Plugin
>
>       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 Plugin
>
>   public void preSoftCommit(CommitUpdateCommand cmd) {
>     debug = log.isDebugEnabled(); // refresh our view of debugging occasionally
> +    trace = log.isTraceEnabled();
>
>     synchronized (this) {
>
>
> Modified: lucene/dev/trunk/solr/testlogging.properties
> URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/testlogging.properties?rev=1236410&r1=1236409&r2=1236410&view=diff
> ==============================================================================
> --- lucene/dev/trunk/solr/testlogging.properties (original)
> +++ lucene/dev/trunk/solr/testlogging.properties Thu Jan 26 22:09:08 2012
> @@ -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
>
>
>



-- 
lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org