lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1469074 - in /lucene/dev/branches/branch_4x: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/ lucene/benchmark/ lucene/classification/ lucene/classification/src/ lucene/code...
Date Wed, 17 Apr 2013 21:16:39 GMT
Author: hossman
Date: Wed Apr 17 21:16:37 2013
New Revision: 1469074

URL: http://svn.apache.org/r1469074
Log:
SOLR-4661: Admin UI Replication details now correctly displays the current replicable generation/version
of the master (merge r1469073)

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/BUILD.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/MIGRATE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/README.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_4x/lucene/benchmark/   (props changed)
    lucene/dev/branches/branch_4x/lucene/build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/classification/   (props changed)
    lucene/dev/branches/branch_4x/lucene/classification/build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/classification/ivy.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/classification/src/   (props changed)
    lucene/dev/branches/branch_4x/lucene/codecs/   (props changed)
    lucene/dev/branches/branch_4x/lucene/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortDocValues.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortRandom.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTotalHitCountCollector.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/demo/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/grouping/   (props changed)
    lucene/dev/branches/branch_4x/lucene/highlighter/   (props changed)
    lucene/dev/branches/branch_4x/lucene/ivy-settings.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/join/   (props changed)
    lucene/dev/branches/branch_4x/lucene/licenses/   (props changed)
    lucene/dev/branches/branch_4x/lucene/memory/   (props changed)
    lucene/dev/branches/branch_4x/lucene/misc/   (props changed)
    lucene/dev/branches/branch_4x/lucene/module-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/queryparser/   (props changed)
    lucene/dev/branches/branch_4x/lucene/sandbox/   (props changed)
    lucene/dev/branches/branch_4x/lucene/site/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/suggest/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/README.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/cloud-dev/   (props changed)
    lucene/dev/branches/branch_4x/solr/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/contrib/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfig.java
  (props changed)
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/scripts/   (props changed)
    lucene/dev/branches/branch_4x/solr/site/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/webapp/   (props changed)
    lucene/dev/branches/branch_4x/solr/webapp/web/css/styles/replication.css
    lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/dashboard.js
    lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/replication.js
    lucene/dev/branches/branch_4x/solr/webapp/web/tpl/dashboard.html
    lucene/dev/branches/branch_4x/solr/webapp/web/tpl/replication.html

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Wed Apr 17 21:16:37 2013
@@ -206,6 +206,9 @@ Bug Fixes
   code is not something Solr itself returned -- eg: from the Servlet Container, 
   or an intermediate HTTP Proxy (hossman)
 
+* SOLR-4661: Admin UI Replication details now correctly displays the current
+  replicable generation/version of the master. (hossman)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
Wed Apr 17 21:16:37 2013
@@ -78,7 +78,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * <p> A Handler which provides a REST API for replication and serves replication requests
from Slaves. <p/> </p>
- * <p>When running on the master, it provides the following commands <ol> <li>Get
the current replicatable index version
+ * <p>When running on the master, it provides the following commands <ol> <li>Get
the current replicable index version
  * (command=indexversion)</li> <li>Get the list of files for a given index version
  * (command=filelist&amp;indexversion=&lt;VERSION&gt;)</li> <li>Get
full or a part (chunk) of a given index or a config
  * file (command=filecontent&amp;file=&lt;FILE_NAME&gt;) You can optionally specify
an offset and length to get that
@@ -96,6 +96,38 @@ public class ReplicationHandler extends 
   private static final Logger LOG = LoggerFactory.getLogger(ReplicationHandler.class.getName());
   SolrCore core;
 
+  private static final class CommitVersionInfo {
+    public final long version;
+    public final long generation;
+    private CommitVersionInfo(long g, long v) {
+      generation = g;
+      version = v;
+    }
+    /**
+     * builds a CommitVersionInfo data for the specified IndexCommit.  
+     * Will never be null, ut version and generation may be zero if 
+     * there are problems extracting them from the commit data
+     */
+    public static CommitVersionInfo build(IndexCommit commit) {
+      long generation = commit.getGeneration();
+      long version = 0;
+      try {
+        final Map<String,String> commitData = commit.getUserData();
+        String commitTime = commitData.get(SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
+        if (commitTime != null) {
+          try {
+            version = Long.parseLong(commitTime);
+          } catch (NumberFormatException e) {
+            LOG.warn("Version in commitData was not formated correctly: " + commitTime, e);
+          }
+        }
+      } catch (IOException e) {
+        LOG.warn("Unable to get version from commitData, commit: " + commit, e);
+      }
+      return new CommitVersionInfo(generation, version);
+    }
+  }
+
   private SnapPuller snapPuller;
 
   private ReentrantLock snapPullLock = new ReentrantLock();
@@ -501,23 +533,20 @@ public class ReplicationHandler extends 
     return "$URL$";
   }
 
-  private long[] getIndexVersion() {
-    long version[] = new long[2];
+  /** 
+   * returns the CommitVersionInfo for the current searcher, or null on error.
+   */
+  private CommitVersionInfo getIndexVersion() {
+    CommitVersionInfo v = null;
     RefCounted<SolrIndexSearcher> searcher = core.getSearcher();
     try {
-      final IndexCommit commit = searcher.get().getIndexReader().getIndexCommit();
-      final Map<String,String> commitData = commit.getUserData();
-      String commitTime = commitData.get(SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
-      if (commitTime != null) {
-        version[0] = Long.parseLong(commitTime);
-      }
-      version[1] = commit.getGeneration();
+      v = CommitVersionInfo.build(searcher.get().getIndexReader().getIndexCommit());
     } catch (IOException e) {
-      LOG.warn("Unable to get index version : ", e);
+      LOG.warn("Unable to get index commit: ", e);
     } finally {
       searcher.decref();
     }
-    return version;
+    return v;
   }
 
   @Override
@@ -526,9 +555,9 @@ public class ReplicationHandler extends 
     NamedList list = super.getStatistics();
     if (core != null) {
       list.add("indexSize", NumberUtils.readableSize(getIndexSize()));
-      long[] versionGen = getIndexVersion();
-      list.add("indexVersion", versionGen[0]);
-      list.add(GENERATION, versionGen[1]);
+      CommitVersionInfo vInfo = getIndexVersion();
+      list.add("indexVersion", null == vInfo ? 0 : vInfo.version);
+      list.add(GENERATION, null == vInfo ? 0 : vInfo.generation);
 
       list.add("indexPath", core.getIndexDir());
       list.add("isMaster", String.valueOf(isMaster));
@@ -582,10 +611,10 @@ public class ReplicationHandler extends 
     details.add(CMD_SHOW_COMMITS, getCommits());
     details.add("isMaster", String.valueOf(isMaster));
     details.add("isSlave", String.valueOf(isSlave));
-    long[] versionAndGeneration = getIndexVersion();
-    details.add("indexVersion", versionAndGeneration[0]);
-    details.add(GENERATION, versionAndGeneration[1]);
-
+    CommitVersionInfo vInfo = getIndexVersion();
+    details.add("indexVersion", null == vInfo ? 0 : vInfo.version);
+    details.add(GENERATION, null == vInfo ? 0 : vInfo.generation);
+    
     IndexCommit commit = indexCommitPoint;  // make a copy so it won't change
 
     if (isMaster) {
@@ -595,7 +624,9 @@ public class ReplicationHandler extends 
     }
 
     if (isMaster && commit != null) {
-      master.add("replicatableGeneration", commit.getGeneration());
+      CommitVersionInfo repCommitInfo = CommitVersionInfo.build(commit);
+      master.add("replicableVersion", repCommitInfo.version);
+      master.add("replicableGeneration", repCommitInfo.generation);
     }
 
     SnapPuller snapPuller = tempSnapPuller;

Modified: lucene/dev/branches/branch_4x/solr/webapp/web/css/styles/replication.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/webapp/web/css/styles/replication.css?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/webapp/web/css/styles/replication.css (original)
+++ lucene/dev/branches/branch_4x/solr/webapp/web/css/styles/replication.css Wed Apr 17 21:16:37
2013
@@ -283,6 +283,7 @@
 
 #content #replication #details table
 {
+  margin-left: 20px;
   border-collapse: collapse;
 }
 
@@ -339,6 +340,7 @@
 {
   padding-right: 10px;
   text-align: right;
+  white-space: nowrap;
 }
 
 #content #replication #details table tbody .size

Modified: lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/dashboard.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/dashboard.js?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/dashboard.js (original)
+++ lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/dashboard.js Wed Apr 17 21:16:37
2013
@@ -256,7 +256,8 @@ sammy.get
               var is_slave = 'undefined' !== typeof( data.slave );
               var headline = $( 'h2 span', this );
               var details_element = $( '#details', this );
-              var current_type_element = $( ( is_slave ? '.slave' : '.master' ), this );
+              var current_type_element = $( ( is_slave ? '.slave' : '.masterSearch' ), this
);
+              var master_data = is_slave ? data.slave.masterDetails : data;
 
               if( is_slave )
               {
@@ -275,6 +276,7 @@ sammy.get
                   .html( headline.html() + ' (Master)' );
               }
 
+              // the currently searchable commit regardless of type
               $( '.version div', current_type_element )
                 .html( data.indexVersion );
               $( '.generation div', current_type_element )
@@ -282,9 +284,18 @@ sammy.get
               $( '.size div', current_type_element )
                 .html( data.indexSize );
                             
+              // what's replicable on the master
+              var master_element = $( '.master', details_element );
+              $( '.version div', master_element )
+                .html( master_data.master.replicableVersion || '-' );
+              $( '.generation div', master_element )
+                .html( master_data.master.replicableGeneration || '-' );
+              $( '.size div', master_element )
+                .html( "-" );
+
               if( is_slave )
               {
-                var master_element = $( '.master', details_element );
+                var master_element = $( '.masterSearch', details_element );
                 $( '.version div', master_element )
                   .html( data.slave.masterDetails.indexVersion );
                 $( '.generation div', master_element )
@@ -292,7 +303,8 @@ sammy.get
                 $( '.size div', master_element )
                   .html( data.slave.masterDetails.indexSize );
                                 
-                if( data.indexVersion !== data.slave.masterDetails.indexVersion )
+                // warnings if slave version|gen doesn't match what's replicable
+                if( data.indexVersion !== master_data.master.replicableVersion )
                 {
                   $( '.version', details_element )
                     .addClass( 'diff' );
@@ -303,7 +315,7 @@ sammy.get
                     .removeClass( 'diff' );
                 }
                                 
-                if( data.generation !== data.slave.masterDetails.generation )
+                if( data.generation !== master_data.master.replicableGeneration )
                 {
                   $( '.generation', details_element )
                     .addClass( 'diff' );

Modified: lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/replication.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/replication.js?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/replication.js (original)
+++ lucene/dev/branches/branch_4x/solr/webapp/web/js/scripts/replication.js Wed Apr 17 21:16:37
2013
@@ -246,26 +246,39 @@ var replication_fetch_status = function(
         }
 
         var details_element = $( '#details', replication_element );
-        var current_type_element = $( ( is_slave ? '.slave' : '.master' ), details_element
);
+        var current_type_element = $( ( is_slave ? '.slave' : '.masterSearch' ), details_element
);
+        var master_data = is_slave ? data.slave.masterDetails : data;
 
+        // the currently searchable commit regardless of type
         $( '.version div', current_type_element )
           .html( data.indexVersion );
         $( '.generation div', current_type_element )
           .html( data.generation );
         $( '.size div', current_type_element )
           .html( data.indexSize );
+
+        // what's replicable on the master
+        var master_element = $( '.master', details_element );
+        $( '.version div', master_element )
+          .html( master_data.master.replicableVersion || '-' );
+        $( '.generation div', master_element )
+          .html( master_data.master.replicableGeneration || '-' );
+        $( '.size div', master_element )
+          .html( "-" );
                 
         if( is_slave )
         {
-          var master_element = $( '.master', details_element );
-          $( '.version div', master_element )
-            .html( data.slave.masterDetails.indexVersion );
-          $( '.generation div', master_element )
-            .html( data.slave.masterDetails.generation );
-          $( '.size div', master_element )
-            .html( data.slave.masterDetails.indexSize );
-                    
-          if( data.indexVersion !== data.slave.masterDetails.indexVersion )
+          // what's searchable on the master
+          var master_searchable = $( '.masterSearch', details_element );
+          $( '.version div', master_searchable )
+            .html( master_data.indexVersion );
+          $( '.generation div', master_searchable )
+            .html( master_data.generation );
+          $( '.size div', master_searchable )
+            .html( master_data.indexSize );
+ 
+          // warnings if slave version|gen doesn't match what's replicable
+          if( data.indexVersion !== master_data.master.replicableVersion )
           {
             $( '.version', details_element )
               .addClass( 'diff' );
@@ -276,7 +289,7 @@ var replication_fetch_status = function(
               .removeClass( 'diff' );
           }
                     
-          if( data.generation !== data.slave.masterDetails.generation )
+          if( data.generation !== master_data.master.replicableGeneration )
           {
             $( '.generation', details_element )
               .addClass( 'diff' );
@@ -511,4 +524,4 @@ sammy.get
       }
     );
   }
-);
\ No newline at end of file
+);

Modified: lucene/dev/branches/branch_4x/solr/webapp/web/tpl/dashboard.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/webapp/web/tpl/dashboard.html?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/webapp/web/tpl/dashboard.html (original)
+++ lucene/dev/branches/branch_4x/solr/webapp/web/tpl/dashboard.html Wed Apr 17 21:16:37 2013
@@ -103,9 +103,18 @@ limitations under the License.
           </thead>
           <tbody>
 
+            <tr class="masterSearch">
+
+              <th>Master (Searching)</th>
+              <td class="version"><div>x</div></td>
+              <td class="generation"><div>y</div></td>
+              <td class="size"><div>z</div></td>
+
+            </tr>
+
             <tr class="master">
 
-              <th>Master:</th>
+              <th>Master (Replicable)</th>
               <td class="version"><div>x</div></td>
               <td class="generation"><div>y</div></td>
               <td class="size"><div>z</div></td>
@@ -114,7 +123,7 @@ limitations under the License.
 
             <tr class="slave slaveOnly">
 
-              <th>Slave:</th>
+              <th>Slave (Searching)</th>
               <td class="version"><div>a</div></td>
               <td class="generation"><div>c</div></td>
               <td class="size"><div>c</div></td>

Modified: lucene/dev/branches/branch_4x/solr/webapp/web/tpl/replication.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/webapp/web/tpl/replication.html?rev=1469074&r1=1469073&r2=1469074&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/webapp/web/tpl/replication.html (original)
+++ lucene/dev/branches/branch_4x/solr/webapp/web/tpl/replication.html Wed Apr 17 21:16:37
2013
@@ -116,9 +116,18 @@ limitations under the License.
         </thead>
         <tbody>
 
+          <tr class="masterSearch">
+
+            <th>Master (Searching)</th>
+            <td class="version"><div></div></td>
+            <td class="generation"><div></div></td>
+            <td class="size"><div></div></td>
+
+          </tr>
+
           <tr class="master">
 
-            <th>Master:</th>
+            <th>Master (Replicable)</th>
             <td class="version"><div></div></td>
             <td class="generation"><div></div></td>
             <td class="size"><div></div></td>
@@ -127,7 +136,7 @@ limitations under the License.
 
           <tr class="slave slaveOnly">
 
-            <th>Slave:</th>
+            <th>Slave (Searching)</th>
             <td class="version"><div></div></td>
             <td class="generation"><div></div></td>
             <td class="size"><div></div></td>
@@ -204,4 +213,4 @@ limitations under the License.
     
   </div>
 
-</div>
\ No newline at end of file
+</div>



Mime
View raw message