Changeset 2945


Ignore:
Timestamp:
Nov 23, 2006, 12:27:49 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

Possible fix for BASE 1 disconnection issues

Location:
branches/2.1/src/clients/migrate
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/src/clients/migrate/net/sf/basedb/clients/migrate/Migrater.java

    r2693 r2945  
    238238    String user = getProperty("db1.user");
    239239    String password = getProperty("db1.password");
    240     String url = getProperty("db1.url");
     240    String url = getProperty("db1.url") + "&autoReconnect=true";
    241241    String driver = getProperty("db1.driver");
    242242    try
  • branches/2.1/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java

    r2707 r2945  
    138138     */
    139139    cleanUpMemory();
    140     PreparedStatement ps = QUICK_TRANSFER ? prepareStatementFromFile("selectMinimumRawBioAssayData")
    141         : prepareStatementFromFile("selectRawBioAssayData");
    142     try
    143     {
    144       ps.setInt(1, rawBioAssayId);
     140
    145141      RawDataBatcher batcher = rawBioAssay.getRawDataBatcher();
    146142      batcher.setBatchSize(getBatchSize());
    147       runRawBioAssay(ps, 0, getBatchSize(), batcher, hasArrayDesign);
     143      runRawBioAssay(rawBioAssay, batcher, hasArrayDesign, rawBioAssayId);
    148144      batcher.flush();
    149145      batcher.close();
    150     }
    151     catch (SQLException e)
    152     {
    153       stop("transferRawBioAssayData", e);
    154     }
    155146  }
    156147
     
    159150  values from and size.
    160151 
    161   @param ps <code>PreparedStatement</code> which includes a "LIMIT ?,?"
    162          at the end.
    163   @param from <code>int</code> indicating start position of the
    164          ResultSet.
    165   @param size <code>int</code> indicating number of rows to include.
     152  @param ps <code>PreparedStatement</code>
    166153  @param batcher RawDataBatcher used in this transfer.
    167154  @param hasArrayDesign (Currently not used)
    168155  @see Transfer#prepareStatementFromFile(String)
    169156   */
    170   protected void runRawBioAssay(PreparedStatement ps, int from, int size,
    171       RawDataBatcher batcher, boolean hasArrayDesign)
     157  protected void runRawBioAssay(RawBioAssay rawBioAssay, 
     158      RawDataBatcher batcher, boolean hasArrayDesign, int base1RawBioAssayId)
    172159  {
    173160    try
    174161    {
    175162      int rowCount = 0;
    176       ps.setInt(2, from);
    177       ps.setInt(3, size);
    178       ResultSet rs = ps.executeQuery();
     163      ResultSet rs = null;
     164      Throwable t = null;
     165      int numTries = 0;
     166      // Fix for unstable BASE 1 server that is randomly losing the connection
     167      // For this to work the connection must be created with autoReconnect=true
     168      while (rs == null && numTries < 2)
     169      {
     170        numTries++;
     171        try
     172        {
     173          PreparedStatement ps = QUICK_TRANSFER ? prepareStatementFromFile("selectMinimumRawBioAssayData")
     174            : prepareStatementFromFile("selectRawBioAssayData");
     175          ps.setInt(1, base1RawBioAssayId);
     176          rs = ps.executeQuery();
     177          t = null;
     178        }
     179        catch (Throwable t2)
     180        {
     181          t = t2;
     182          log("Exception when loading BASE 1 data for raw bioassay: " + rawBioAssay, t2);
     183          try
     184          {
     185            Thread.sleep(2000);
     186          }
     187          catch (InterruptedException ex)
     188          {}
     189        }
     190      }
     191      if (rs == null || t != null) throw new BaseException(t);
    179192      DbControl dc = batcher.getDbControl();
    180193      while (rs.next())
     
    183196        RawData rd = batcher.newRawData();
    184197        rd.setReporter(reporterT.getReporterById(dc, rs.getInt(2)));
    185         // This is not verified, do block, row and col numbers start at
    186         // 0 or 1?
    187198        rd.setBlock(rs.getInt(3));
    188199        rd.setColumn(rs.getInt(4));
    189200        rd.setRow(rs.getInt(5));
     201        rd.setX(rs.getFloat(6));
     202        rd.setY(rs.getFloat(7));
    190203        if (!QUICK_TRANSFER)
    191204        {
     
    213226        progress.increase();
    214227      }
    215       if (rowCount == size)
    216       {
    217         // Fetch next batch
    218         runRawBioAssay(ps, from + size, size, batcher, hasArrayDesign);
    219       }
    220228    }
    221229    catch (SQLException e)
  • branches/2.1/src/clients/migrate/sql/mysql-migration-queries.sql

    r2693 r2945  
    971971  `flags`
    972972FROM  `RawBioAssayData`
    973 WHERE   `rawBioAssay` = ?
    974 ORDER BY `position`
    975 LIMIT   ?,?;
     973WHERE   `rawBioAssay` = ?;
    976974
    977975
     
    979977SELECT `element`, `reporter`, `block`, `numCol`, `numRow`, `x`, `y`
    980978FROM  `RawBioAssayData`
    981 WHERE   `rawBioAssay` = ?
    982 ORDER BY `position`
    983 LIMIT   ?,?;
     979WHERE   `rawBioAssay` = ?;
    984980
    985981
Note: See TracChangeset for help on using the changeset viewer.