mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix ALF-4291: PostgreSQL - AVM index/search
- don't need re-index snapshots backwards - increase aync test delay git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22318 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -47,16 +47,18 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
public void test_CreateDelete() throws Exception
|
||||
{
|
||||
int threads= 4;
|
||||
|
||||
int loops = 10;
|
||||
|
||||
//int snapshotsPerLoop = 4;
|
||||
int snapshotsPerLoop = 1;
|
||||
int snapshotsPerLoop = 4;
|
||||
|
||||
assertEquals(1, fService.getStoreVersions("main").size());
|
||||
|
||||
fService.createDirectory("main:/", "test");
|
||||
|
||||
int startVersion = fService.createSnapshot("main", null, null).get("main");
|
||||
|
||||
assertEquals(2, fService.getStoreVersions("main").size());
|
||||
|
||||
assertEquals(0, fService.getDirectoryListing(-1, "main:/test").size());
|
||||
|
||||
UserTransaction testTX = fTransactionService.getUserTransaction();
|
||||
@@ -90,6 +92,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Snapshot count: "+fService.getStoreVersions("main").size());
|
||||
|
||||
SortedMap<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/test");
|
||||
assertEquals(loops, listing.size());
|
||||
|
||||
@@ -119,7 +123,6 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
|
||||
testTX.commit();
|
||||
|
||||
|
||||
// delete
|
||||
|
||||
runner = null;
|
||||
@@ -143,6 +146,15 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
|
||||
assertEquals(0, fService.getDirectoryListing(-1, "main:/test").size());
|
||||
|
||||
System.out.println("Snapshot count: "+fService.getStoreVersions("main").size());
|
||||
|
||||
/*
|
||||
for(org.alfresco.service.cmr.avm.VersionDescriptor v : fService.getStoreVersions("main"))
|
||||
{
|
||||
System.out.println(v);
|
||||
}
|
||||
*/
|
||||
|
||||
testTX = fTransactionService.getUserTransaction();
|
||||
testTX.begin();
|
||||
|
||||
@@ -160,13 +172,10 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
|
||||
public void test_ALF_786() throws Exception
|
||||
{
|
||||
//int threads= 4;
|
||||
int threads= 2;
|
||||
|
||||
int threads= 4;
|
||||
int loops = 10;
|
||||
|
||||
//int snapshotsPerLoop = 4;
|
||||
int snapshotsPerLoop = 1;
|
||||
int snapshotsPerLoop = 4;
|
||||
|
||||
fService.createDirectory("main:/", "test");
|
||||
|
||||
@@ -185,6 +194,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
|
||||
testTX.commit();
|
||||
|
||||
// create
|
||||
|
||||
Thread runner = null;
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
@@ -270,7 +281,7 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
results.close();
|
||||
testTX.commit();
|
||||
|
||||
// delete
|
||||
// delete
|
||||
|
||||
runner = null;
|
||||
for (int i = 0; i < threads; i++)
|
||||
@@ -342,7 +353,7 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
|
||||
testTX.commit();
|
||||
|
||||
//move
|
||||
// move
|
||||
|
||||
runner = null;
|
||||
for (int i = 0; i < threads; i++)
|
||||
@@ -389,7 +400,6 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
testTX.commit();
|
||||
testTX = fTransactionService.getUserTransaction();
|
||||
testTX.begin();
|
||||
|
||||
|
||||
StoreRef storeRef = AVMNodeConverter.ToStoreRef("main");
|
||||
SearchService searchService = fIndexerAndSearcher.getSearcher(AVMNodeConverter.ToStoreRef("main"), true);
|
||||
@@ -397,9 +407,9 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
testTX.commit();
|
||||
|
||||
|
||||
Thread runner = null;
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
runner = new Nester("Concurrent-" + i, runner, true, 10, Nester.Mode.CREATE, 10 );
|
||||
@@ -407,7 +417,7 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
if (runner != null)
|
||||
{
|
||||
runner.start();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
runner.join();
|
||||
@@ -417,11 +427,12 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
testTX = fTransactionService.getUserTransaction();
|
||||
testTX.begin();
|
||||
// snap
|
||||
testTX.commit();
|
||||
|
||||
testTX = fTransactionService.getUserTransaction();
|
||||
testTX.begin();;
|
||||
SortedMap<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, "main:/test");
|
||||
@@ -456,7 +467,7 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
enum Mode {CREATE, UPDATE, DELETE, MOVE};
|
||||
|
||||
Thread waiter;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
boolean multiThread;
|
||||
@@ -477,7 +488,7 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
this.mode = mode;
|
||||
this.loopCount = loopCount;
|
||||
}
|
||||
|
||||
|
||||
public void run()
|
||||
{
|
||||
fAuthenticationComponent.setSystemUserAsCurrentUser();
|
||||
@@ -487,13 +498,16 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
}
|
||||
try
|
||||
{
|
||||
System.out.println("Start " + this.getName());
|
||||
//System.out.println("Start " + this.getName());
|
||||
|
||||
for(i = 0; i < loopCount; i++)
|
||||
{
|
||||
RetryingTransactionCallback<Void> create = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
System.out.println("Create file: " + "main:/test/" + getName()+"-"+i);
|
||||
|
||||
fService.createFile("main:/test", getName()+"-"+i).close();
|
||||
|
||||
return null;
|
||||
@@ -503,6 +517,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
System.out.println("Update file mime type: " + "main:/test/" + getName()+"-"+i);
|
||||
|
||||
fService.setMimeType("main:/test/"+getName()+"-"+i, "text/plain");
|
||||
|
||||
return null;
|
||||
@@ -512,6 +528,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
System.out.println("Remove file: " + "main:/test/" + getName()+"-"+i);
|
||||
|
||||
fService.removeNode("main:/test/"+getName()+"-"+i);
|
||||
|
||||
return null;
|
||||
@@ -521,6 +539,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
System.out.println("Rename file: " + "main:/test/" + getName()+"-"+i);
|
||||
|
||||
fService.rename("main:/test/", getName()+"-"+i, "main:/test/", "MOVED-"+getName()+"-"+i);
|
||||
|
||||
return null;
|
||||
@@ -533,7 +553,6 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
{
|
||||
case CREATE:
|
||||
fRetryingTransactionHelper.doInTransaction(create);
|
||||
System.out.println(getName()+i);
|
||||
break;
|
||||
case UPDATE:
|
||||
fRetryingTransactionHelper.doInTransaction(update);
|
||||
@@ -553,6 +572,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
//System.out.println("Snap: main:/");
|
||||
|
||||
fService.createSnapshot("main", null, null);
|
||||
|
||||
return null;
|
||||
@@ -563,7 +584,8 @@ public class AVMServiceConcurrentTest extends AVMServiceTestBase
|
||||
fRetryingTransactionHelper.doInTransaction(snap);
|
||||
}
|
||||
}
|
||||
System.out.println("End " + this.getName());
|
||||
|
||||
//System.out.println("End " + this.getName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
package org.alfresco.repo.avm;
|
||||
@@ -39,7 +39,7 @@ public class AVMServiceIndexTest extends AVMServiceTestBase
|
||||
private final static long REPEAT_INTERVAL_MSECS = 1000 * 60;
|
||||
*/
|
||||
|
||||
private final static long SLEEP = 10000;
|
||||
private final static long SLEEP = 20000;
|
||||
private final static long START_DELAY_MSECS = 2000;
|
||||
private final static long REPEAT_INTERVAL_MSECS = 2000;
|
||||
|
||||
|
@@ -78,14 +78,6 @@ public class AVMTestSuite extends TestSuite
|
||||
suite.addTestSuite(AVMServiceIndexTest.class);
|
||||
suite.addTestSuite(AVMServicePerfTest.class);
|
||||
|
||||
//suite.addTestSuite(AVMCrawlTestP.class);
|
||||
//suite.addTestSuite(AVMScaleTestP.class);
|
||||
//suite.addTestSuite(AVMStressTestP.class);
|
||||
|
||||
//suite.addTestSuite(PurgeTestP.class); // see above
|
||||
|
||||
//suite.addTestSuite(SimultaneousLoadTest.class);
|
||||
|
||||
suite.addTestSuite(AVMDiffPerformanceTest.class);
|
||||
suite.addTestSuite(AVMChildNamePatternMatchPerformanceTest.class);
|
||||
|
||||
@@ -94,6 +86,11 @@ public class AVMTestSuite extends TestSuite
|
||||
|
||||
suite.addTestSuite(AVMServiceConcurrentTest.class);
|
||||
|
||||
//suite.addTestSuite(AVMCrawlTestP.class);
|
||||
//suite.addTestSuite(AVMScaleTestP.class);
|
||||
//suite.addTestSuite(AVMStressTestP.class);
|
||||
//suite.addTestSuite(SimultaneousLoadTest.class);
|
||||
|
||||
/*
|
||||
// note:to test remotely need running repo (otherwise effectively repeats AVMServiceLocalTest)
|
||||
suite.addTestSuite(AVMServiceRemoteSystemTest.class);
|
||||
|
@@ -156,7 +156,7 @@ public class AVMSnapShotTriggeredIndexingMethodInterceptor implements MethodInte
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("renameStore createIndex " + to, new Exception("Stack Trace"));
|
||||
logger.debug("renameStore createIndex " + to + "(0, " + after + ")", new Exception("Stack Trace"));
|
||||
}
|
||||
avmIndexer.createIndex(to, IndexMode.SYNCHRONOUS);
|
||||
avmIndexer.index(to, 0, after, getIndexMode(to));
|
||||
@@ -274,11 +274,22 @@ public class AVMSnapShotTriggeredIndexingMethodInterceptor implements MethodInte
|
||||
}
|
||||
|
||||
int from = before != -1 ? before : last;
|
||||
if (logger.isDebugEnabled())
|
||||
|
||||
if (from > after)
|
||||
{
|
||||
logger.debug("indexSnapshotImpl " + store, new Exception("Stack Trace"));
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("skip indexSnapshotImpl " + store + " (" + (before == -1 ? "-1, " : "") + from +", " + after +")", new Exception("Stack Trace"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("indexSnapshotImpl " + store + " (" + (before == -1 ? "-1, " : "") + from +", " + after +")", new Exception("Stack Trace"));
|
||||
}
|
||||
avmIndexer.index(store, from, after, getIndexMode(store));
|
||||
}
|
||||
avmIndexer.index(store, from, after, getIndexMode(store));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,6 @@ import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.service.cmr.avm.AVMException;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
@@ -286,7 +285,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
||||
{
|
||||
s_logger.debug("new: ("+srcVersion+", "+dstVersion+") "+difference.getDestinationPath());
|
||||
}
|
||||
// AR-786
|
||||
// ALF-786
|
||||
reindex(difference.getDestinationPath(), dstDesc.isDirectory());
|
||||
if (dstDesc.isDirectory())
|
||||
{
|
||||
@@ -310,7 +309,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
||||
{
|
||||
// We are back from the dead ...the node used to be deleted
|
||||
// Treat as new
|
||||
// AR-786
|
||||
// ALF-786
|
||||
if (s_logger.isDebugEnabled())
|
||||
{
|
||||
s_logger.debug("back: ("+srcVersion+", "+dstVersion+") "+difference.getDestinationPath());
|
||||
@@ -420,7 +419,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
||||
Map<String, AVMNodeDescriptor> children = avmService.getDirectoryListing(dir, false);
|
||||
for (AVMNodeDescriptor child : children.values())
|
||||
{
|
||||
// AR-786
|
||||
// ALF-786
|
||||
reindex(child.getPath(), child.isDirectory());
|
||||
reindexAllAncestors(child.getPath());
|
||||
if (child.isDirectory())
|
||||
|
Reference in New Issue
Block a user