Changeset 3136


Ignore:
Timestamp:
07/12/13 14:27:22 (11 years ago)
Author:
keeloo
Message:

Added parameters for list en queue control. Changed log4j according to Willem's specifications. Added code to retry adding documents to the solr server. Raised the version to 2.15.

Location:
vlo/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/pom.xml

    r2976 r3136  
    1616         in each module's pom.xml
    1717    -->
    18     <version>2.14</version>
     18    <version>2.15</version>
    1919   
    2020    <description>Virtual Language Observatory (VLO) parent project</description>
  • vlo/trunk/vlo_importer/pom.xml

    r2977 r3136  
    1212    <packaging>jar</packaging>
    1313
    14     <version>2.14</version>
     14    <version>2.15</version>
    1515    <name>vlo_importer</name>
    1616    <description></description>
  • vlo/trunk/vlo_importer/src/main/bin/vlo_solr_importer.sh

    r2992 r3136  
    2424# take preference over a specification as a property.
    2525
    26 $JAVA -Xmx1024M -cp .:vlo_importer-2.14-importer.jar eu.clarin.cmdi.vlo.importer.MetadataImporter
     26$JAVA -Xmx1024M -cp .:vlo_importer-2.15-importer.jar eu.clarin.cmdi.vlo.importer.MetadataImporter
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r2826 r3136  
    162162   
    163163    @Element
    164     private static int maxOnHeap = 0;
     164    private static int maxDocsInList = 0;
     165   
     166    @Element
     167    private static int maxDocsInSolrQueue = 0;
     168   
     169    @Element
     170    private static int solrTimeOut = 0;
    165171   
    166172    @Element
     
    260266   
    261267    /**
    262      * Get the value of the maxOnHeap parameter<br><br>
    263      *
    264      * For a description of the parameter, refer to the general VLO
    265      * documentation.
    266      *
    267      * @return the value
    268      */
    269     public static int getMaxOnHeap (){
    270         return maxOnHeap;
    271     }
    272    
    273     /**
    274      * Set the value of the maxOnHeap parameter<br><br>
    275      *
    276      * For a description of the parameter, refer to the general VLO
    277      * documentation.
    278      *
    279      * @param param the value
    280      */
    281     public static void setMaxOnHeap (int param){
    282         maxOnHeap = param;
     268     * Get the value of the maxDocsInList parameter<br><br>
     269     *
     270     * The value of the parameter indicates the number of documents the importer
     271     * stores in a list before sending them to the queue associated with the
     272     * SOLR server.
     273     *
     274     * @return the value
     275     */
     276    public static int getMaxDocsInList (){
     277        return maxDocsInList;
     278    }
     279   
     280    /**
     281     * Set the value of the maxDocsInList parameter<br><br>
     282     *
     283     * The value of the parameter indicates the number of documents the importer
     284     * stores in a list before sending them to the queue associated with the
     285     * SOLR server.
     286     *
     287     * @param param the value
     288     */
     289    public static void setMaxDocsInList (int param){
     290        maxDocsInList = param;
     291    }
     292   
     293    /**
     294     * Get the value of the maxDocsSolrQueue parameter<br><br>
     295     *
     296     * The value of the parameter indicates the number of documents in the
     297     * SOLR server queue before the threads associated with the server start
     298     * emptying the queue.
     299     *
     300     * @return the value
     301     */
     302    public static int getDocsSolrQueue (){
     303        return maxDocsInSolrQueue;
     304    }
     305   
     306    /**
     307     * Set the value of the maxDocsSolrQueue parameter<br><br>
     308     *
     309     * The value of the parameter indicates the number of documents in the
     310     * SOLR server queue before the threads associated with the server start
     311     * emptying the queue.
     312     *
     313     * @param param the value
     314     */
     315    public static void setDocsSolrQueue (int param){
     316        maxDocsInSolrQueue = param;
     317    }
     318   
     319    /**
     320     * Get the value of the solrTimeOut parameter<br><br>
     321     *
     322     * The value of the parameter indicates the interval during which the
     323     * importer will try to reach the SOLR server. Values are incremented
     324     * 1, 2, 4, 8, ...
     325     *
     326     * @return the value
     327     */
     328    public static int getSolrTimeOut (){
     329        return solrTimeOut;
     330    }
     331   
     332    /**
     333     * Set the value of the solrTimeOut parameter<br><br>
     334     *
     335     * The value of the parameter indicates the interval during which the
     336     * importer will try to reach the SOLR server. Values are incremented
     337     * 1, 2, 4, 8, ...
     338     *
     339     * @param param the value
     340     */
     341    public static void setSolrTimeOut (int param){
     342        solrTimeOut = param;
    283343    }
    284344   
     
    298358     * Set the value of the useMaxFileSize parameter<br><br>
    299359     *
    300      * For a description of the parameter, refer to the general VLO
    301      * documentation.
     360     * If true, the importer will reject meta data files whose size exceeds
     361     * the value indicated by the maxFileSize parameter. If false, none of
     362     * the files encountered will be rejected because of their size.
    302363     *
    303364     * @param param the value
     
    310371     * Get the value of the maxFileSize parameter<br><br>
    311372     *
    312      * For a description of the parameter, refer to the general VLO
    313      * documentation.
     373     * If the useMaxFileSize parameter equals true, maxFileSize is the upper
     374     * limit to the size of meta data files that the importer will consider.
    314375     *
    315376     * @return the value
     
    322383     * Set the value of the maxFileSize parameter<br><br>
    323384     *
    324      * For a description of the parameter, refer to the general VLO
    325      * documentation.
     385     * If the useMaxFileSize parameter equals true, maxFileSize is the upper
     386     * limit to the size of meta data files that the importer will consider.
    326387     *
    327388     * @param param the value
     
    334395     * Get the value of the useHandleResolver parameter<br><br>
    335396     *
    336      * For a description of the parameter, refer to the general VLO
    337      * documentation.
     397     * The parameter can be used to reject meta data files that exceed some
     398     * maximum size.
    338399     *
    339400     * @return the value
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r3025 r3136  
    213213        String solrUrl = VloConfig.getSolrUrl();
    214214        LOG.info("Initializing Solr Server on " + solrUrl);
    215         solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {
     215        solrServer = new StreamingUpdateSolrServer(solrUrl, VloConfig.getMaxDocsInList(), 2) {
    216216            @Override
    217217            public void handleError(Throwable ex) {
     
    322322        addResourceData(solrDocument, cmdiData);
    323323        docs.add(solrDocument);
    324         if (docs.size() == VloConfig.getMaxOnHeap()) {
     324        if (docs.size() == VloConfig.getMaxDocsInList()) {
    325325            sendDocs();
    326326        }
     
    358358        }
    359359    }
    360 
    361     /**
    362      * Send current list of SolrImputDocuments to SolrServer and clears list
    363      * afterwards
     360   
     361    /**
     362     * Send the list of documents prepared to the solr server
    364363     *
    365364     * @throws SolrServerException
     
    367366     */
    368367    protected void sendDocs() throws SolrServerException, IOException {
    369         LOG.info("Sending " + docs.size() + " docs to solr server. Total number of docs updated till now: " + nrOFDocumentsUpdated);
     368        int wait = 0;
     369        boolean done = false;
     370       
     371        LOG.info("Sending " + docs.size() +
     372                " docs to solr server queue. Total number of docs updated till now: "
     373                + nrOFDocumentsUpdated);
     374
    370375        nrOFDocumentsUpdated += docs.size();
    371         solrServer.add(docs);
    372         if (serverError != null) {
     376        // add the documents in the list to the solr queue
     377        while (! done){
     378            solrServer.add(docs);
     379            done = (serverError == null) && (wait <= 120);
     380        }
     381       
     382        // turn wait into vlo parameter
     383       
     384        if (done) {
     385            // the documents are in the queue now, create a new empty list
     386            docs = new ArrayList<SolrInputDocument>();
     387        } else {
     388            if (wait > 120) {
     389                // timeout
     390                LOG.error("Timeout sending list of documents to solr queue");
     391            }
    373392            throw new SolrServerException(serverError);
    374393        }
    375         docs = new ArrayList<SolrInputDocument>();
    376394    }
    377395   
  • vlo/trunk/vlo_importer/src/main/resources/VloConfig.xml

    r2841 r3136  
    33    <deleteAllFirst>true</deleteAllFirst>
    44   
    5     <maxOnHeap>128</maxOnHeap>
     5    <maxDocsInList>128</maxDocsInList>
     6   
     7    <maxDocsInSolrQueue>128</maxDocsInSolrQueue>
     8   
     9    <solrTimeOut>300</solrTimeOut>
    610   
    711    <useMaxFileSize>true</useMaxFileSize>
  • vlo/trunk/vlo_importer/src/main/resources/log4j.properties

    r2768 r3136  
    11log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
    22log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
    3 log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
    4 
    5 log4j.rootLogger=INFO,Stdout
    6 
    7 log4j.logger.org.apache.wicket=INFO
    8 log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
    9 log4j.logger.org.apache.wicket.version=INFO
    10 log4j.logger.org.apache.wicket.RequestCycle=INFO
     3log4j.appender.Stdout.layout.conversionPattern=%d %p [%c{1}#%M:%L] - %m%n\n
    114
    125
     6log4j.appender.Stdout.encoding=UTF-8
     7log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
     8log4j.appender.ROOT=org.apache.log4j.DailyRollingFileAppender
     9log4j.appender.ROOT.File=vlo-importer.log
     10log4j.rootLogger=INFO, ROOT
     11log4j.logger.org.springframework=ERROR
     12log4j.logger.org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer=ERROR
  • vlo/trunk/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/config/VloConfigTest.java

    r2841 r3136  
    8888
    8989    /**
    90      * Test the getMaxOnHeap method
    91      */
    92     @Test
    93     public void testGetMaxOnHeap() {
    94        
    95         System.out.println("getMaxOnHeap");
     90     * Test the getMaxDocsInList method
     91     */
     92    @Test
     93    public void testGetMaxDocsInList() {
     94       
     95        System.out.println("getMaxDocsInList");
    9696       
    9797        int expResult = 128;
    98         int result = VloConfig.getMaxOnHeap();
    99        
    100         assertEquals(expResult, result);
    101     }
    102 
    103     /**
    104      * Test the setMaxOnHeap method
    105      */
    106     @Test
    107     public void testSetMaxOnHeap() {
    108        
    109         System.out.println("setMaxOnHeap");
     98        int result = VloConfig.getMaxDocsInList();
     99       
     100        assertEquals(expResult, result);
     101    }
     102
     103    /**
     104     * Test the setMaxDocsInList method
     105     */
     106    @Test
     107    public void testSetMaxDocsInList() {
     108       
     109        System.out.println("setMaxDocsInList");
    110110       
    111111        int param = 1000;
    112112       
    113         VloConfig.setMaxOnHeap(param);
    114 
    115         int result = VloConfig.getMaxOnHeap();
     113        VloConfig.setMaxDocsInList(param);
     114
     115        int result = VloConfig.getMaxDocsInList();
     116       
     117        assertEquals(param, result);
     118    }
     119   
     120    /**
     121     * Test the getMaxDocsInSolrQueue method
     122     */
     123    @Test
     124    public void testGetMaxDocsInSolrQueue() {
     125       
     126        System.out.println("getMaxDocsInSolrQueue");
     127       
     128        int expResult = 128;
     129        int result = VloConfig.getMaxDocsInList();
     130       
     131        assertEquals(expResult, result);
     132    }
     133
     134    /**
     135     * Test the setMaxDocsInSolrQueue method
     136     */
     137    @Test
     138    public void testSetMaxDocsInSolrQueue() {
     139       
     140        System.out.println("setMaxDocsInSolrQueue");
     141       
     142        int param = 1000;
     143       
     144        VloConfig.setMaxDocsInList(param);
     145
     146        int result = VloConfig.getMaxDocsInList();
    116147       
    117148        assertEquals(param, result);
  • vlo/trunk/vlo_web_app/pom.xml

    r3023 r3136  
    1212    <artifactId>vlo_web_app</artifactId>
    1313   
    14     <version>2.14</version>
     14    <version>2.15</version>
    1515   
    1616    <packaging>war</packaging>
     
    3434            <groupId>eu.clarin.cmdi</groupId>
    3535            <artifactId>vlo_importer</artifactId>
    36             <version>2.14</version>
     36            <version>2.15</version>
    3737            <type>jar</type>
    3838        </dependency>
     
    6060                    <exclude>**/*.java</exclude> <!-- java not needed in the package -->
    6161                </excludes>
     62            </resource>
     63            <resource>
     64                <directory>../vlo_importer/src/main/resources</directory>
    6265            </resource>
    6366        </resources>
Note: See TracChangeset for help on using the changeset viewer.