Jump to content

Recommended Posts

I'm working on an android app that will sync with the a MySQL server.  The data will be stored locally in SQLite for offline use.  I'm trying to figure out what engine would work best for this (isam etc).  It's my understanding that "Transaction safe" engine is good for preventing data loss.  Is that because of the way the data doesn't actually committed until the app sends the commit instruction?  In the following scenario, what kind of data loss would I be open to?  Does "transaction safe" prevent this kind of loss?

 

My plan has been:

  1. If creating a new record while offline, do so but assign a field called "localID" (which would be an auto increment column) with a unique id number.  This localID will not be stored on the server and will ONLY be used on that device.
  2. When creating a new record while online (or sending a new record that was previously created while offline), the data will be sent and as confirmation of receipt of the new data, the server will return an array (via json) of the id numbers of the newly created rows.
  3. I will be using Google Cloud Messaging so that the server data is updated, all subscribed devices will be told the id numbers for all the rows they need to process (along with info telling whether this is a NEW record, an UPDATE to an existing record or delete the record.  When devices receive the GCM message, they'll will know what records to get and how to deal with them.
  4. Each row on the server will have a "version" id and every time one row is updated, the version number will be incremented.  This way if the server sees an update to a record and the version number is lower than what's on the server, the sending device will be instructed to inform the user of this.

The one thing I haven't figured out in that is how to deal with an edit from two different devices of the same row.  There shouldn't be more than a few devices that could possibly change any record.  So I'm thinking that one way might be that when the server sees the row being updated from two diff devices at the same time, it could send back a GCM message which would prompt the user to decide which is valid.  But I'm not sure if I like that.  This is all given as background in hopes of getting some informed advice but I'm open to suggestions for dealing with the duplicate data issue.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.