0 Replies Latest reply on Jul 7, 2009 6:32 PM by Clebert Suconic

    JBMESSAGING-1678 - OME on Journal Load

    Clebert Suconic Master

      As stated on the jira (https://jira.jboss.org/jira/browse/JBMESSAGING-1678), when you have too many files on the journal, the load will fail with OME.

      I didn't find a way to use a Map, as we need the order of Adds and updates preserved.


      An easy solution so far, was to cleanup the lists every time the list is too big.

      Any time the list gets too big (to an arbitrary constant number of elements) I simply cleanup the list.


      Changes:

      public synchronized long load(final List<RecordInfo> committedRecords,
       final List<PreparedTransactionInfo> preparedTransactions) throws Exception
       {
      ...
      
       final int DELETE_FLUSH = 20000;
      
      ...
       public void deleteRecord(final long id)
       {
       recordsToDelete.add(id);
      
       if (recordsToDelete.size() == DELETE_FLUSH)
       {
       Iterator<RecordInfo> iter = records.iterator();
       while (iter.hasNext())
       {
       RecordInfo record = iter.next();
      
       if (recordsToDelete.contains(record.id))
       {
       iter.remove();
       }
       }
      
       recordsToDelete.clear();
       System.out.println("after cleanup " + records.size());
      
       }
       }
       });
      




      I don't want to add another configuration property for this. (I would just keep the constant instead of bothering the user with another descision at runtime).