×

Discussion Board

Results 1 to 5 of 5

Thread: RMS corruption

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    4

    RMS corruption

    Hi,

    I have few queries regarding RMS.

    1. When RMS will corrupt?
    2. How can i retrieve back the corrupt data?


    Regards,
    Kanagaraj

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: RMS corruption

    Quote Originally Posted by maniraj83 View Post
    1. When RMS will corrupt?
    This depends on the device. RMS should never corrupt. However, no software is perfect, and it does happen on some devices.

    Data loss or corruption tends to occur in two situations.

    1. When replacing a record (setRecord()) with a record of a different size, such that subsequent records in the recordstore need to be moved. Also, with large volumes of addRecord()/deleteRecord() calls. This is device dependent, and is particularly seen on MIDP1 Series 40s.

    2. If the appliction terminates while record stores are open. "Terminates" can include: calling notifyDestroyed(), an uncaught exception, the user terminating the app by pressing end or using the application menu, device/VM crash or a power failure.

    Quote Originally Posted by maniraj83 View Post
    2. How can i retrieve back the corrupt data?
    Essentially, you cannot.

    Avoidance strategies:

    1. Prefer a small number of large records, not a large number of small records.

    2. Either:
    1. Never use setRecord() or deleteRecord(). If you need to update the record store, read all the data, use deleteRecordStore() to delete the entire record store, then re-write all the data.
    2. Store all your information in one record, call addRecord(...) only once, and use setRecord(1, ...) from then on.


    3. Keep record stores open for the shortest possible time, and ensure that they are closed after use. Never use a non-local variable to refer to a RecordStore object, and use a finally{} clause to close the record store.

    PHP Code:
    // sample code for the "single-record" approach

    public static void writeData(byte[] datathrows RecordStoreException {
        
    RecordStore rs RecordStore.openRecordStore(RECORD_STORE_NAMEtrue);
        try {
            if (
    rs.getNumRecords() == 0) {
                
    rs.addRecord(data0data.length);
            } else {
                
    rs.setRecord(1data0data.length);
            }
        } 
    finally {
            
    rs.closeRecordStore();
        }
    }

    public static 
    byte[] readData() throws RecordStoreException {
        
    byte[] data;
        
    RecordStore rs RecordStore.openRecordStore(RECORD_STORE_NAMEtrue);
        try {
            if (
    rs.getNumRecords() == 0) {
                
    data null;
            } else {
                
    data rs.getRecord(1);
            }
        } 
    finally {
            
    rs.closeRecordStore();
        }
        return 
    data;

    Cheers,
    Graham.

  3. #3
    Nokia Developer Champion
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: RMS corruption

    Hi,
    yes mani, at the time of updation of records, dont make any updation in the existing recordstore else copy the whole records in a vector delete old recodstore, delete or update the record in vector and then copy the records of vector to new Recordstore.

    once the deletion occurs at some record, the whole row or space for that record will get corrupts. So u never retreive or nor set any other new record to that row.

    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: RMS corruption

    Quote Originally Posted by jitu_goldie View Post
    once the deletion occurs at some record, the whole row or space for that record will get corrupts.
    The record is deleted, it does not become corrupt. The space for that record is recovered (except on the 7650, which has a bug). The record ID for the deleted record is never re-used; record IDs are not "row numbers". It is not an index number like an array index. It is a separate piece of information that is stored with each record. A record's ID never changes, this is intentional. It is like a "primary key", allocated automatically by the runtime environment.

    Cheers,
    Graham.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    RMS corruption on a 6131NFC

    Hi all, I know this topic has covered, but I would like to have some specific info about
    RMS corruption on 2 specific Nokia models.

    Basically I'm doing load tests on a 6131NFC. I load sequentially several records (could be 1000 or more) in a RS. The insert is very simple, in a for loop I open the record store, insert the record and close the RS, and it seems I don't have any Exception.

    I saw that with small amount of data (say 50 records) I have no problems. With more (300 or more, which corresponds to about 30k ore more) I start to have random RMS corruptions.

    6131NFC has Serires 40 3rd edition (and MIDP 2.0), and size limit *should* be 262063.

    I was wondering if anyone has experience on data loading on a 6212 classic, which uses S40 5th edition (6131NFC has Serires 40 3th edition) and implements MIDP 2.1 (or other phone which implements MIDP 2.1) instead of MIDP 2.0. Maybe on that platform these bugs are solved.

    For us it's crucial to be sure there aren't RMS bugs of these kind (and solutions like some I saw, for example use a different Record Store for each record or to put all records on the same row, doesn't make any sense at all).

    Thanks in advance
    Piero

Similar Threads

  1. RMS corruption
    By maniraj83 in forum General Development Questions
    Replies: 3
    Last Post: 2009-03-24, 09:01
  2. Replies: 8
    Last Post: 2008-07-27, 03:30
  3. RMS record sizes.
    By earamsey in forum Mobile Java General
    Replies: 1
    Last Post: 2007-10-18, 13:51
  4. RMS Corruption - on removing phone battery
    By goyal_sunil in forum Mobile Java General
    Replies: 1
    Last Post: 2005-05-28, 15:08
  5. 7210 & 7250 RMS resetting problem
    By keithmcneill in forum Mobile Java General
    Replies: 1
    Last Post: 2003-11-13, 21:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •