Modify

Opened 5 years ago

Closed 4 years ago

#1660 closed Discussion (invalid)

Unbounded data loss if Jajuk crashes?

Reported by: mats.ahlgren@… Owned by: bflorat
Priority: 1, lowest Milestone:
Component: Core Version:
Keywords: Cc:
Regression ?:

Description

I think it is possible that, if Jajuk crashes, all song preferences/ratings and statistics since the last program-open (e.g all pref changes in the last week) will be lost?

If this is true, suggested priority=major, and suggested solution is to edit the database after every operation. (This may not work well if the database is >30MB and there is no way to edit it in-place without resaving it all; also editing in-place is dangerous due to possible bugs that might creep up, unless the java-based XML library you guys are using has support for it.)

Perhaps provide an option "autosave database every N minutes"?

Or if you can make all changes be idempotent, you could just make a log of changes that can be replayed?

e.g. say you want to change a Smiley from =\ to =)

Instead of doing something like inMemoryXmlDatabase.change(...), you would do log.append("[logobject; time=[datetime object of now], action=[inMemoryXmlDatabase.change(...)]"). If you crash, then load all the logs since the last "Successfully synced to database" log entry and replay all those items in *sorted* order on the in-memory database, then resave the database (after making a backup), then make a "Successfully synced to database" log entry.

(Example of an operation that would not be idempotence: "increase hits by +1" (because if you replayed it twice, it would give a different result (+2) than if you replayed it once). Example of making it idempotent: "set hits to "+(getHits()+1))

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by bflorat

  • Component changed from (Jajuk Members) Any (Default Component) to (Java Developer) Core
  • Owner set to bflorat

The collection is currently auto-saved every hour. To make sure it works, please check collection_exit.xml file date.

The autosave works for me.

comment:2 Changed 5 years ago by mats.ahlgren@…

Works just fine, thanks. Sorry, I was not aware of the feature.

Bug is closeable.

comment:3 Changed 4 years ago by bflorat

  • Milestone To Be Qualified by Jajuk Team deleted
  • Resolution set to invalid
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.