mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
improved debug
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4870 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -105,11 +105,17 @@ public class ConcurrentNodeServiceTest extends TestCase
|
|||||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
// create a first store directly
|
// create a first store directly
|
||||||
UserTransaction tx = transactionService.getUserTransaction();
|
TransactionUtil.executeInUserTransaction(transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||||
tx.begin();
|
{
|
||||||
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
|
||||||
rootNodeRef = nodeService.getRootNode(storeRef);
|
public Object doWork() throws Exception
|
||||||
tx.commit();
|
{
|
||||||
|
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_"
|
||||||
|
+ System.currentTimeMillis());
|
||||||
|
rootNodeRef = nodeService.getRootNode(storeRef);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -126,56 +132,69 @@ public class ConcurrentNodeServiceTest extends TestCase
|
|||||||
|
|
||||||
protected Map<QName, ChildAssociationRef> commitNodeGraph() throws Exception
|
protected Map<QName, ChildAssociationRef> commitNodeGraph() throws Exception
|
||||||
{
|
{
|
||||||
UserTransaction tx = transactionService.getUserTransaction();
|
return TransactionUtil.executeInUserTransaction(transactionService,
|
||||||
tx.begin();
|
new TransactionUtil.TransactionWork<Map<QName, ChildAssociationRef>>()
|
||||||
Map<QName, ChildAssociationRef> answer = buildNodeGraph();
|
{
|
||||||
tx.commit();
|
|
||||||
|
|
||||||
return null;// answer;
|
public Map<QName, ChildAssociationRef> doWork() throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
Map<QName, ChildAssociationRef> answer = buildNodeGraph();
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test1() throws Exception
|
public void test1() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test2() throws Exception
|
public void test2() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test3() throws Exception
|
public void test3() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test4() throws Exception
|
public void test4() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test5() throws Exception
|
public void test5() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test6() throws Exception
|
public void test6() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test7() throws Exception
|
public void test7() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test8() throws Exception
|
public void test8() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test9() throws Exception
|
public void test9() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test10() throws Exception
|
public void test10() throws Exception
|
||||||
{
|
{
|
||||||
testConcurrent();
|
testConcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConcurrent() throws Exception
|
public void testConcurrent() throws Exception
|
||||||
{
|
{
|
||||||
luceneFTS.pause();
|
luceneFTS.pause();
|
||||||
@@ -211,7 +230,7 @@ public class ConcurrentNodeServiceTest extends TestCase
|
|||||||
{
|
{
|
||||||
// There are two nodes at the base level in each test
|
// There are two nodes at the base level in each test
|
||||||
assertEquals(2 * ((COUNT * REPEATS) + 1), nodeService.getChildAssocs(rootNodeRef).size());
|
assertEquals(2 * ((COUNT * REPEATS) + 1), nodeService.getChildAssocs(rootNodeRef).size());
|
||||||
|
|
||||||
SearchService searcher = (SearchService) ctx.getBean(ServiceRegistry.SEARCH_SERVICE.getLocalName());
|
SearchService searcher = (SearchService) ctx.getBean(ServiceRegistry.SEARCH_SERVICE.getLocalName());
|
||||||
assertEquals(2 * ((COUNT * REPEATS) + 1), searcher.selectNodes(rootNodeRef, "/*", null,
|
assertEquals(2 * ((COUNT * REPEATS) + 1), searcher.selectNodes(rootNodeRef, "/*", null,
|
||||||
getNamespacePrefixReolsver(""), false).size());
|
getNamespacePrefixReolsver(""), false).size());
|
||||||
@@ -223,25 +242,25 @@ public class ConcurrentNodeServiceTest extends TestCase
|
|||||||
// index
|
// index
|
||||||
assertEquals(3 * ((COUNT * REPEATS) + 1), results.length());
|
assertEquals(3 * ((COUNT * REPEATS) + 1), results.length());
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*\"");
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*\"");
|
||||||
// n6 has root aspect - there are three things at the root level in the
|
// n6 has root aspect - there are three things at the root level in the
|
||||||
// index
|
// index
|
||||||
assertEquals(3 * ((COUNT * REPEATS) + 1), results.length());
|
assertEquals(3 * ((COUNT * REPEATS) + 1), results.length());
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*\"");
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*\"");
|
||||||
// n6 has root aspect - there are three things at the root level in the
|
// n6 has root aspect - there are three things at the root level in the
|
||||||
// index
|
// index
|
||||||
assertEquals(2 * ((COUNT * REPEATS) + 1), results.length());
|
assertEquals(2 * ((COUNT * REPEATS) + 1), results.length());
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*/*\"");
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*/*\"");
|
||||||
// n6 has root aspect - there are three things at the root level in the
|
// n6 has root aspect - there are three things at the root level in the
|
||||||
// index
|
// index
|
||||||
assertEquals(1 * ((COUNT * REPEATS) + 1), results.length());
|
assertEquals(1 * ((COUNT * REPEATS) + 1), results.length());
|
||||||
results.close();
|
results.close();
|
||||||
|
|
||||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*/*/*\"");
|
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/*/*/*/*/*\"");
|
||||||
// n6 has root aspect - there are three things at the root level in the
|
// n6 has root aspect - there are three things at the root level in the
|
||||||
// index
|
// index
|
||||||
|
@@ -321,6 +321,7 @@ public class IndexInfo
|
|||||||
indexInfo = new IndexInfo(canonicalFile);
|
indexInfo = new IndexInfo(canonicalFile);
|
||||||
indexInfos.put(canonicalFile, indexInfo);
|
indexInfos.put(canonicalFile, indexInfo);
|
||||||
}
|
}
|
||||||
|
s_logger.error("Got "+indexInfo +" for "+file.getAbsolutePath());
|
||||||
return indexInfo;
|
return indexInfo;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
@@ -493,8 +494,8 @@ public class IndexInfo
|
|||||||
for (String id : deletable)
|
for (String id : deletable)
|
||||||
{
|
{
|
||||||
indexEntries.remove(id);
|
indexEntries.remove(id);
|
||||||
deleteQueue.add(id);
|
|
||||||
}
|
}
|
||||||
|
clearOldReaders();
|
||||||
synchronized (cleaner)
|
synchronized (cleaner)
|
||||||
{
|
{
|
||||||
cleaner.notify();
|
cleaner.notify();
|
||||||
@@ -1445,12 +1446,12 @@ public class IndexInfo
|
|||||||
if (TransactionStatus.DELETABLE.follows(entry.getStatus()))
|
if (TransactionStatus.DELETABLE.follows(entry.getStatus()))
|
||||||
{
|
{
|
||||||
indexEntries.remove(id);
|
indexEntries.remove(id);
|
||||||
deleteQueue.add(id);
|
|
||||||
synchronized (cleaner)
|
synchronized (cleaner)
|
||||||
{
|
{
|
||||||
cleaner.notify();
|
cleaner.notify();
|
||||||
}
|
}
|
||||||
writeStatus();
|
writeStatus();
|
||||||
|
clearOldReaders();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2293,7 +2294,7 @@ public class IndexInfo
|
|||||||
|
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
s_logger.error(e);
|
s_logger.error("Error reading index file", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -2502,7 +2503,7 @@ public class IndexInfo
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
s_logger.error(e);
|
s_logger.error("Failed to merge deletions", e);
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2770,7 +2771,7 @@ public class IndexInfo
|
|||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
s_logger.error(e);
|
s_logger.error("Failed to merge indexes", e);
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2827,15 +2828,6 @@ public class IndexInfo
|
|||||||
for (String id : toDelete)
|
for (String id : toDelete)
|
||||||
{
|
{
|
||||||
indexEntries.remove(id);
|
indexEntries.remove(id);
|
||||||
// Only delete if there is no existing ref counting reader
|
|
||||||
if (!referenceCountingReadOnlyIndexReaders.containsKey(id))
|
|
||||||
{
|
|
||||||
if (s_logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
s_logger.debug("... queued delete for " + id);
|
|
||||||
}
|
|
||||||
deleteQueue.add(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dumpInfo();
|
dumpInfo();
|
||||||
@@ -2972,7 +2964,11 @@ public class IndexInfo
|
|||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return indexDirectory.toString();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(indexDirectory.toString());
|
||||||
|
builder.append(" ");
|
||||||
|
builder.append(super.toString());
|
||||||
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnableCleanerThread()
|
public boolean isEnableCleanerThread()
|
||||||
|
Reference in New Issue
Block a user