B2022-026 RO Memory reduction coding
This commit is contained in:
@@ -48,10 +48,13 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) return false;
|
||||
|
||||
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
|
||||
|
||||
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
|
||||
string rofstPath = rdi.FolderPath + @"\ro.fst";
|
||||
if (!File.Exists(rofstPath)) return false;
|
||||
|
||||
FileInfo fiRofst = new FileInfo(rofstPath);
|
||||
|
||||
// if the database Ro.Fst is newer or if the files have identical DTS,
|
||||
@@ -60,7 +63,11 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// next see if the data is the same size, i.e. byte count of record and byte count
|
||||
// of file. If different sizes, the date/time stamp check will hold.
|
||||
if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
|
||||
// B2022-026 RO Memory reduction - new logic
|
||||
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
|
||||
|
||||
if (bytes != null && fiRofst.Length != bytes.Length)
|
||||
return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
|
||||
|
||||
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
|
||||
// rofsts of the size of the file & compare bytes.
|
||||
@@ -249,15 +256,18 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
if (DocVersionAssociations == null || DocVersionAssociationCount==0) return false;
|
||||
|
||||
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
|
||||
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
|
||||
string rofstPath = rdi.FolderPath + @"\ro.fst";
|
||||
|
||||
//if (!File.Exists(rofstPath)) return false;
|
||||
if (!pathExists(rofstPath))
|
||||
{
|
||||
_MyLog.WarnFormat("RO Path '{0}' could not be found", rofstPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo fiRofst = new FileInfo(rofstPath);
|
||||
|
||||
// if the database Ro.Fst is newer or if the files have identical DTS,
|
||||
@@ -265,14 +275,21 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// put this in a dictionary so we don't have to keep testing to see if the file version of ro.fst is newer than database version
|
||||
string key = string.Format("{0}-{1}", DocVersionAssociations[0].ROFstID, fiRofst.LastWriteTimeUtc);
|
||||
|
||||
if (NewerRoFstLookup.ContainsKey(key)) return NewerRoFstLookup[key];
|
||||
if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return AddToRoFstLookup(key, false);
|
||||
|
||||
TimeSpan ts = roFstInfo.DTS - fiRofst.LastWriteTimeUtc;
|
||||
|
||||
if (ts.TotalSeconds > -1F) return AddToRoFstLookup(key, false);
|
||||
|
||||
// next see if the data is the same size, i.e. byte count of record and byte count
|
||||
// of file. If different sizes, the date/time stamp check will hold.
|
||||
if (fiRofst.Length != roFstInfo.ROLookup.Length) return AddToRoFstLookup(key,fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
|
||||
// B2022-026 RO Memory reduction - new logic
|
||||
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
|
||||
|
||||
if (bytes != null && fiRofst.Length != bytes.Length)
|
||||
return AddToRoFstLookup(key, fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
|
||||
|
||||
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
|
||||
// rofsts of the size of the file & compare bytes.
|
||||
|
Reference in New Issue
Block a user