mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
16187: Merged V3.1 to V3.2 16185: AbstractLuceneIndexerAndSearcherFactory.getTransactionId() must return null when there is no transaction 16171: Merged V3.1 to V3.2 16168: ETHREEOH-2797: Force patch.db-V2.2-Person to apply one more time to fix up corrupt users created by LDAP Import - Problem due to ETHREEOH-2023, fixed in 3.1.1 - Also corrects ldap.synchronisation.defaultHomeFolderProvider to be userHomesHomeFolderProvider - Also requires fix to ETHREEOH-2475 to fix up duplicate users 16167: ETHREEOH-2475: Fixed nested transaction handling in AbstractLuceneIndexerAndSearcherFactory to allow duplicate user processing in PersonServiceImpl to actually work git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16363 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -97,7 +97,7 @@
|
|||||||
<ref bean="patch.db-V2.2-0-CreateMissingTables" />
|
<ref bean="patch.db-V2.2-0-CreateMissingTables" />
|
||||||
<ref bean="patch.db-V2.2-Upgrade-From-2.1" />
|
<ref bean="patch.db-V2.2-Upgrade-From-2.1" />
|
||||||
<ref bean="patch.db-V2.2-Upgrade-From-2.2SP1" />
|
<ref bean="patch.db-V2.2-Upgrade-From-2.2SP1" />
|
||||||
<ref bean="patch.db-V2.2-Person-2" />
|
<ref bean="patch.db-V2.2-Person-3" />
|
||||||
<ref bean="patch.db-V3.2-LockTables" />
|
<ref bean="patch.db-V3.2-LockTables" />
|
||||||
<ref bean="patch.db-V3.2-ContentTables" />
|
<ref bean="patch.db-V3.2-ContentTables" />
|
||||||
<ref bean="patch.db-V3.2-PropertyValueTables" />
|
<ref bean="patch.db-V3.2-PropertyValueTables" />
|
||||||
|
@@ -57,11 +57,11 @@ UPDATE
|
|||||||
--
|
--
|
||||||
-- Record script finish
|
-- Record script finish
|
||||||
--
|
--
|
||||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person-2';
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person-3';
|
||||||
INSERT INTO alf_applied_patch
|
INSERT INTO alf_applied_patch
|
||||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
'patch.db-V2.2-Person-2', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
|
'patch.db-V2.2-Person-3', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
|
||||||
0, 2005, -1, 2006, null, 'UNKOWN', 1, 1, 'Script completed'
|
0, 3002, -1, 3003, null, 'UNKOWN', 1, 1, 'Script completed'
|
||||||
);
|
);
|
||||||
|
@@ -1633,12 +1633,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="patch.db-V2.2-Person-2" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V2.2-Person-3" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V2.2-Person-2</value></property>
|
<property name="id"><value>patch.db-V2.2-Person-3</value></property>
|
||||||
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>2005</value></property>
|
<property name="fixesToSchema"><value>3002</value></property>
|
||||||
<property name="targetSchema"><value>2006</value></property>
|
<property name="targetSchema"><value>3003</value></property>
|
||||||
<property name="scriptUrl">
|
<property name="scriptUrl">
|
||||||
<value>classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/AlfrescoSchemaUpdate-Person.sql</value>
|
<value>classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/AlfrescoSchemaUpdate-Person.sql</value>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -19,4 +19,4 @@ version.build=@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=3002
|
version.schema=3003
|
||||||
|
@@ -77,6 +77,7 @@ import org.springframework.beans.factory.InitializingBean;
|
|||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is resource manager LuceneIndexers and LuceneSearchers. It supports two phase commit inside XA
|
* This class is resource manager LuceneIndexers and LuceneSearchers. It supports two phase commit inside XA
|
||||||
@@ -110,13 +111,12 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
private Map<Xid, Map<StoreRef, LuceneIndexer>> suspendedIndexersInGlobalTx = new HashMap<Xid, Map<StoreRef, LuceneIndexer>>();
|
private Map<Xid, Map<StoreRef, LuceneIndexer>> suspendedIndexersInGlobalTx = new HashMap<Xid, Map<StoreRef, LuceneIndexer>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread local indexers - used outside a global transaction
|
* The key under which this instance's map of indexers is stored in a (non-global) transaction
|
||||||
*/
|
*/
|
||||||
|
private final String indexersKey = "AbstractLuceneIndexerAndSearcherFactory." + GUID.generate();
|
||||||
private ThreadLocal<Map<StoreRef, LuceneIndexer>> threadLocalIndexers = new ThreadLocal<Map<StoreRef, LuceneIndexer>>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dafault timeout for transactions TODO: Respect this
|
* The default timeout for transactions TODO: Respect this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private int timeout = DEFAULT_TIMEOUT;
|
private int timeout = DEFAULT_TIMEOUT;
|
||||||
@@ -393,13 +393,14 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private LuceneIndexer getThreadLocalIndexer(StoreRef storeRef)
|
private LuceneIndexer getThreadLocalIndexer(StoreRef storeRef)
|
||||||
{
|
{
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
|
||||||
if (indexers == null)
|
if (indexers == null)
|
||||||
{
|
{
|
||||||
indexers = new HashMap<StoreRef, LuceneIndexer>();
|
indexers = new HashMap<StoreRef, LuceneIndexer>();
|
||||||
threadLocalIndexers.set(indexers);
|
AlfrescoTransactionSupport.bindResource(indexersKey, indexers);
|
||||||
}
|
}
|
||||||
LuceneIndexer indexer = indexers.get(storeRef);
|
LuceneIndexer indexer = indexers.get(storeRef);
|
||||||
if (indexer == null)
|
if (indexer == null)
|
||||||
@@ -411,11 +412,12 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the transaction identifier uised to store it in the transaction map.
|
* Get the transaction identifier used to store it in the transaction map.
|
||||||
*
|
*
|
||||||
* @param tx
|
* @param tx
|
||||||
* @return - the transaction id
|
* @return - the transaction id
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private String getTransactionId(Transaction tx, StoreRef storeRef)
|
private String getTransactionId(Transaction tx, StoreRef storeRef)
|
||||||
{
|
{
|
||||||
if (tx instanceof SimpleTransaction)
|
if (tx instanceof SimpleTransaction)
|
||||||
@@ -423,9 +425,10 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
SimpleTransaction simpleTx = (SimpleTransaction) tx;
|
SimpleTransaction simpleTx = (SimpleTransaction) tx;
|
||||||
return simpleTx.getGUID();
|
return simpleTx.getGUID();
|
||||||
}
|
}
|
||||||
else
|
else if (TransactionSynchronizationManager.isSynchronizationActive())
|
||||||
{
|
{
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport
|
||||||
|
.getResource(indexersKey);
|
||||||
if (indexers != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
LuceneIndexer indexer = indexers.get(storeRef);
|
LuceneIndexer indexer = indexers.get(storeRef);
|
||||||
@@ -434,8 +437,8 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
return indexer.getDeltaId();
|
return indexer.getDeltaId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -741,11 +744,13 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
* Commit the transaction
|
* Commit the transaction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void commit() throws IndexerException
|
public void commit() throws IndexerException
|
||||||
{
|
{
|
||||||
|
Map<StoreRef, LuceneIndexer> indexers = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
|
||||||
if (indexers != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
for (LuceneIndexer indexer : indexers.values())
|
for (LuceneIndexer indexer : indexers.values())
|
||||||
@@ -764,10 +769,10 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (threadLocalIndexers.get() != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
threadLocalIndexers.get().clear();
|
indexers.clear();
|
||||||
threadLocalIndexers.set(null);
|
AlfrescoTransactionSupport.unbindResource(indexersKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,11 +782,12 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
*
|
*
|
||||||
* @return - the tx code
|
* @return - the tx code
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public int prepare() throws IndexerException
|
public int prepare() throws IndexerException
|
||||||
{
|
{
|
||||||
boolean isPrepared = true;
|
boolean isPrepared = true;
|
||||||
boolean isModified = false;
|
boolean isModified = false;
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
|
||||||
if (indexers != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
for (LuceneIndexer indexer : indexers.values())
|
for (LuceneIndexer indexer : indexers.values())
|
||||||
@@ -818,9 +824,10 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
/**
|
/**
|
||||||
* Roll back the transaction
|
* Roll back the transaction
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void rollback()
|
public void rollback()
|
||||||
{
|
{
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
|
||||||
|
|
||||||
if (indexers != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
@@ -835,20 +842,16 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
indexers.clear();
|
||||||
|
AlfrescoTransactionSupport.unbindResource(indexersKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadLocalIndexers.get() != null)
|
@SuppressWarnings("unchecked")
|
||||||
{
|
|
||||||
threadLocalIndexers.get().clear();
|
|
||||||
threadLocalIndexers.set(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void flush()
|
public void flush()
|
||||||
{
|
{
|
||||||
// TODO: Needs fixing if we expose the indexer in JTA
|
// TODO: Needs fixing if we expose the indexer in JTA
|
||||||
Map<StoreRef, LuceneIndexer> indexers = threadLocalIndexers.get();
|
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
|
||||||
|
|
||||||
if (indexers != null)
|
if (indexers != null)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user