--- a/persistentstorage/store/UFILE/UF_DICT.CPP Tue May 25 14:35:19 2010 +0300
+++ b/persistentstorage/store/UFILE/UF_DICT.CPP Wed Jun 09 11:36:09 2010 +0300
@@ -154,7 +154,11 @@
for (TInt wait=KLockoutLimit;;)
{
RFile file;
- TInt r=file.Open(aFs,aName,EFileShareExclusive|EFileWrite);
+ // When the file server write caching is enabled, the order of file write operations is not guaranteed.
+ // This could cause data inconsistency in some circumstances,for example, when the power is lost in the
+ // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity.
+
+ TInt r=file.Open(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO);
switch (r)
{
case KErrNone:
@@ -176,7 +180,11 @@
if (r==KErrCorrupt)
{
// silently replace the entire file if it is corrupt
- r=file.Replace(aFs,aName,EFileShareExclusive|EFileWrite);
+ // When the file server write caching is enabled, the order of file write operations is not guaranteed.
+ // This could cause data inconsistency in some circumstances,for example, when the power is lost in the
+ // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity.
+
+ r=file.Replace(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO);
if (r==KErrInUse)
break; // try again later...
if (r==KErrNone)
@@ -197,7 +205,11 @@
return;
}
case KErrNotFound:
- r=file.Create(aFs,aName,EFileShareExclusive|EFileWrite);
+ // When the file server write caching is enabled, the order of file write operations is not guaranteed.
+ // This could cause data inconsistency in some circumstances,for example, when the power is lost in the
+ // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity.
+
+ r=file.Create(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO);
if (r==KErrNone)
{
CreateStoreL(file,type);