mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Minor tweaks to the crawler test. Added a flush needed under still obscure
high stress situations to prevent a duplicate key violation, in PlainDirectoryNodeImpl. This only makes sense if somehow the second level cache is getting out of whack. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,8 +35,8 @@ public class AVMCrawlTest extends AVMServiceTestBase
|
|||||||
*/
|
*/
|
||||||
public void testCrawl()
|
public void testCrawl()
|
||||||
{
|
{
|
||||||
int n = 2; // Number of Threads.
|
int n = 8; // Number of Threads.
|
||||||
int m = 4; // How many multiples of content to start with.
|
int m = 16; // How many multiples of content to start with.
|
||||||
long runTime = 1200000; // Ten minutes
|
long runTime = 1200000; // Ten minutes
|
||||||
fService.purgeRepository("main");
|
fService.purgeRepository("main");
|
||||||
fReaper.setInactiveBaseSleep(60000);
|
fReaper.setInactiveBaseSleep(60000);
|
||||||
|
@@ -127,6 +127,7 @@ class AVMCrawler implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AVMNodeDescriptor dir = dirs.get(fRandom.nextInt(dirs.size()));
|
AVMNodeDescriptor dir = dirs.get(fRandom.nextInt(dirs.size()));
|
||||||
|
int depth = 1;
|
||||||
while (dir != null)
|
while (dir != null)
|
||||||
{
|
{
|
||||||
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, dir.getPath());
|
Map<String, AVMNodeDescriptor> listing = fService.getDirectoryListing(-1, dir.getPath());
|
||||||
@@ -168,17 +169,16 @@ class AVMCrawler implements Runnable
|
|||||||
fOpCount++;
|
fOpCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create some files.
|
if (fRandom.nextInt(depth) < depth - 1)
|
||||||
for (int i = 0; i < 1; i++)
|
|
||||||
{
|
{
|
||||||
String name = randomName();
|
// Create some files.
|
||||||
fService.createFile(dir.getPath(), name,
|
for (int i = 0; i < 1; i++)
|
||||||
|
{
|
||||||
|
String name = randomName();
|
||||||
|
fService.createFile(dir.getPath(), name,
|
||||||
new ByteArrayInputStream(("I am " + name).getBytes()));
|
new ByteArrayInputStream(("I am " + name).getBytes()));
|
||||||
fOpCount++;
|
fOpCount++;
|
||||||
// PrintStream out = new PrintStream(fService.createFile(dir.getPath(), name));
|
}
|
||||||
// fOpCount++;
|
|
||||||
// out.println("I am " + name);
|
|
||||||
// out.close();
|
|
||||||
}
|
}
|
||||||
// 1 in 100 times create a directory.
|
// 1 in 100 times create a directory.
|
||||||
if (fRandom.nextInt(100) == 0)
|
if (fRandom.nextInt(100) == 0)
|
||||||
@@ -206,6 +206,7 @@ class AVMCrawler implements Runnable
|
|||||||
{
|
{
|
||||||
dir = null;
|
dir = null;
|
||||||
}
|
}
|
||||||
|
depth++;
|
||||||
}
|
}
|
||||||
if (fRandom.nextInt(16) == 0)
|
if (fRandom.nextInt(16) == 0)
|
||||||
{
|
{
|
||||||
@@ -221,7 +222,8 @@ class AVMCrawler implements Runnable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
throw new AVMException("Failure", e);
|
return;
|
||||||
|
// throw new AVMException("Failure", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -190,6 +190,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
existing.setChild(node);
|
existing.setChild(node);
|
||||||
|
sess.flush(); // TODO Should we or shouldn't we?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -721,10 +721,10 @@ class SuperRepository
|
|||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Repository not found: " + name);
|
throw new AVMNotFoundException("Repository not found: " + name);
|
||||||
}
|
}
|
||||||
if (write && !rep.getRoot().getIsNew())
|
// if (write && !rep.getRoot().getIsNew())
|
||||||
{
|
// {
|
||||||
fSession.get().lock(rep, LockMode.UPGRADE);
|
// fSession.get().lock(rep, LockMode.UPGRADE);
|
||||||
}
|
// }
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ public class HibernateTxn extends HibernateTemplate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a set of operations under a single Hibernate transaction.
|
* Perform a set of operations under a single transaction.
|
||||||
* Keep trying if the operation fails because of a concurrency issue.
|
* Keep trying if the operation fails because of a concurrency issue.
|
||||||
* @param callback The worker.
|
* @param callback The worker.
|
||||||
* @param write Whether this is a write operation.
|
* @param write Whether this is a write operation.
|
||||||
|
Reference in New Issue
Block a user