Skip to content
Snippets Groups Projects
Commit fb1a978b authored by felmer's avatar felmer
Browse files

SP-539, BIS-339: Performance improvement: Store only maximum registration time...

SP-539, BIS-339: Performance improvement: Store only maximum registration time of all data sets of a chunk.

SVN: 28590
parent e5b2cdac
No related branches found
No related tags found
No related merge requests found
......@@ -178,13 +178,22 @@ public class PathInfoDatabaseFeedingTask implements IMaintenanceTask, IPostRegis
{
dataSets = getNextChunk();
operationLog.info("Feeding " + ++chunkCount + ". chunk.");
Date maxRegistrationTimestamp = null;
for (SimpleDataSetInformationDTO dataSet : dataSets)
{
feedPathInfoDatabase(dataSet);
Date registrationTimestamp = dataSet.getRegistrationTimestamp();
if (maxRegistrationTimestamp == null || maxRegistrationTimestamp.getTime() < registrationTimestamp.getTime())
{
maxRegistrationTimestamp = registrationTimestamp;
}
stopCondition.handle(dataSet);
}
if (maxRegistrationTimestamp != null)
{
dao.deleteLastFeedingEvent();
dao.createLastFeedingEvent(dataSet.getRegistrationTimestamp());
dao.createLastFeedingEvent(maxRegistrationTimestamp);
dao.commit();
stopCondition.handle(dataSet);
}
} while (dataSets.size() >= chunkSize && stopCondition.fulfilled() == false);
operationLog.info("Feeding finished.");
......
......@@ -133,7 +133,7 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase
});
prepareHappyCase(ds1);
prepareFailing(ds2);
prepareCreateLastFeedingEvent(ds1, ds2);
prepareCreateLastFeedingEvent(ds2.getRegistrationTimestamp());
createTask(12, 3, 0).execute();
}
......@@ -180,7 +180,9 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase
});
prepareHappyCase(ds1, ds4, ds5);
prepareFailing(ds2, ds3, ds6);
prepareCreateLastFeedingEvent(ds1, ds2, ds3, ds4, ds5, ds6);
prepareCreateLastFeedingEvent(ds2.getRegistrationTimestamp());
prepareCreateLastFeedingEvent(ds4.getRegistrationTimestamp());
prepareCreateLastFeedingEvent(ds6.getRegistrationTimestamp());
createTask(2, 3, 0).execute();
}
......@@ -217,7 +219,8 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase
});
prepareHappyCase(ds1, ds4);
prepareFailing(ds2, ds3);
prepareCreateLastFeedingEvent(ds1, ds2, ds3, ds4);
prepareCreateLastFeedingEvent(ds2.getRegistrationTimestamp());
prepareCreateLastFeedingEvent(ds4.getRegistrationTimestamp());
createTask(2, 0, 2000).execute();
}
......@@ -253,7 +256,8 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase
});
prepareHappyCase(ds1, ds3);
prepareFailing(ds2);
prepareCreateLastFeedingEvent(ds1, ds2, ds3);
prepareCreateLastFeedingEvent(ds2.getRegistrationTimestamp());
prepareCreateLastFeedingEvent(ds3.getRegistrationTimestamp());
createTask(2, 0, 0).execute();
}
......@@ -424,17 +428,14 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase
});
}
private void prepareCreateLastFeedingEvent(final SimpleDataSetInformationDTO... dataSets)
private void prepareCreateLastFeedingEvent(final Date timestamp)
{
context.checking(new Expectations()
{
{
for (SimpleDataSetInformationDTO dataSet : dataSets)
{
one(dao).deleteLastFeedingEvent();
one(dao).createLastFeedingEvent(dataSet.getRegistrationTimestamp());
one(dao).commit();
}
one(dao).deleteLastFeedingEvent();
one(dao).createLastFeedingEvent(timestamp);
one(dao).commit();
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment