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:
Jan Vonka
2010-09-08 09:32:02 +00:00
parent 8c10779861
commit 8c74b0eacf
5 changed files with 82 additions and 53 deletions

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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);