mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
[SEARCH-1994]
some fixes to make contentstore replication working on windows
This commit is contained in:
+5
-6
@@ -1703,9 +1703,7 @@ class AlfrescoIndexFetcher
|
||||
try
|
||||
{
|
||||
Files.createDirectories(Paths.get(csFile.getParent()));
|
||||
if (!tmpFile.renameTo(csFile)){
|
||||
throw new RuntimeException("Failed while moving content store file to " + csFile.getAbsolutePath());
|
||||
}
|
||||
Files.copy(tmpFile.toPath(), csFile.toPath());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@@ -1735,7 +1733,7 @@ class AlfrescoIndexFetcher
|
||||
* Deletes from contentstore all the files that has not been updated.
|
||||
* @param contentStorePath
|
||||
*/
|
||||
private void cleanUpContentStore(String contentStorePath)
|
||||
private void cleanUpContentStore(String contentStorePath) throws Exception
|
||||
{
|
||||
AtomicInteger fileDeleted = new AtomicInteger();
|
||||
Set<String> fileNames = contentStoreFilesToDownload.stream().map(e -> (String) e.get(NAME))
|
||||
@@ -1744,7 +1742,7 @@ class AlfrescoIndexFetcher
|
||||
{
|
||||
Files.walk(Paths.get(contentStorePath)).forEach(p -> {
|
||||
File f = new File(p.toUri());
|
||||
if (!f.isDirectory() && !fileNames.contains(p.toString().replaceFirst(contentStorePath, "")))
|
||||
if (!f.isDirectory() && !fileNames.contains(p.toString().replace(contentStorePath, "")))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1758,9 +1756,10 @@ class AlfrescoIndexFetcher
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.error("Impossible to delete unnecessary files. Content store may contains unused contents");
|
||||
throw(e);
|
||||
}
|
||||
|
||||
LOG.info("deleted {} unnecessary files from content store", fileDeleted);
|
||||
|
||||
+2
-2
@@ -141,8 +141,8 @@ public class ContentStoreReplicationIT extends AbstractAlfrescoDistributedIT
|
||||
{
|
||||
master.stop();
|
||||
slave.stop();
|
||||
FileUtils.forceDelete(new File(masterSolrHome.getParent().toUri()));
|
||||
FileUtils.forceDelete(new File(slaveSolrHome.getParent().toUri()));
|
||||
FileUtils.deleteQuietly(new File(masterSolrHome.getParent().toUri()));
|
||||
FileUtils.deleteQuietly(new File(slaveSolrHome.getParent().toUri()));
|
||||
|
||||
SOLRAPIQueueClient.nodeMetaDataMap.clear();
|
||||
SOLRAPIQueueClient.transactionQueue.clear();
|
||||
|
||||
Reference in New Issue
Block a user