Handle the DB dirty flag correctly. Now a broken DB should stay disabled. Also don't remove broken files automatically. Should improve (or even fix) the duplicate entry issue seen in FS#8414 when the problem is caused by the player shutting down in the middle of a DB commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20710 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bf37ecb6b8
commit
a161450822
1 changed files with 6 additions and 5 deletions
|
@ -1491,6 +1491,7 @@ static bool update_master_header(void)
|
|||
|
||||
myhdr.serial = current_tcmh.serial;
|
||||
myhdr.commitid = current_tcmh.commitid;
|
||||
myhdr.dirty = current_tcmh.dirty;
|
||||
|
||||
/* Write it back */
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
@ -1502,6 +1503,7 @@ static bool update_master_header(void)
|
|||
{
|
||||
hdr->h.serial = current_tcmh.serial;
|
||||
hdr->h.commitid = current_tcmh.commitid;
|
||||
hdr->h.dirty = current_tcmh.dirty;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2902,10 +2904,9 @@ static bool commit(void)
|
|||
{
|
||||
close(tmpfd);
|
||||
logf("tagcache failed init");
|
||||
if (ret < 0)
|
||||
remove_files();
|
||||
else
|
||||
if (ret == 0)
|
||||
tc_stat.commit_delayed = true;
|
||||
|
||||
tc_stat.commit_step = 0;
|
||||
read_lock--;
|
||||
return false;
|
||||
|
@ -2916,13 +2917,14 @@ static bool commit(void)
|
|||
{
|
||||
logf("Failure to commit numeric indices");
|
||||
close(tmpfd);
|
||||
remove_files();
|
||||
tc_stat.commit_step = 0;
|
||||
read_lock--;
|
||||
return false;
|
||||
}
|
||||
|
||||
close(tmpfd);
|
||||
remove(TAGCACHE_FILE_TEMP);
|
||||
|
||||
tc_stat.commit_step = 0;
|
||||
|
||||
/* Update the master index headers. */
|
||||
|
@ -2944,7 +2946,6 @@ static bool commit(void)
|
|||
close(masterfd);
|
||||
|
||||
logf("tagcache committed");
|
||||
remove(TAGCACHE_FILE_TEMP);
|
||||
tc_stat.ready = check_all_headers();
|
||||
tc_stat.readyvalid = true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue