Merged V3.1 to HEAD

13265: Fix incorrect wiring of guest user name
   13266: Merged V2.1A to V3.1
      13252: Fix ADB-159: Generation of content model xml throws exception
   13267: Remove accidental addition of folders
   13280: IndexTransactionTracker logging changes
   13281: Added bean to push properties from repository properties into the VM properties
   13283: Added forgotten Hibernate diff file after JAWS-223 fix
   13291: Fix ETHREEOH-1340: Alfresco Repository Draft CMIS Implementation" link refers to localhost
   13297: Fix ETHREEOH-885: workflow mapAuthorityToName tests don't handle sub-classed objects correctly.
   13308: First part of JAWS-215 - permission migration from V2.1-A to V3.1
   13313: Build fix for 2.1-A to 3.1 ACL patch
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V2.1-A:r13252
      Merged /alfresco/BRANCHES/V3.1:r13265-13267,13277-13283,13286,13289,13291,13295,13297,13308-13313


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13615 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-12 22:23:39 +00:00
parent 198ebe371e
commit c27b80dd53
13 changed files with 2051 additions and 1703 deletions

View File

@@ -1,26 +1,26 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.node.index;
@@ -36,7 +36,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.domain.Transaction;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.util.ISO8601DateFormat;
import org.alfresco.util.ISO8601DateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -65,10 +65,10 @@ public class IndexTransactionTracker extends AbstractReindexComponent
private Map<Long, TxnRecord> voids;
private boolean forceReindex;
private long fromTxnId;
private String statusMsg;
private static final String NO_REINDEX = "No reindex in progress";
private long fromTxnId;
private String statusMsg;
private static final String NO_REINDEX = "No reindex in progress";
/**
* Set the defaults.
* <ul>
@@ -86,16 +86,16 @@ public class IndexTransactionTracker extends AbstractReindexComponent
maxRecordSetSize = 1000;
maxTransactionsPerLuceneCommit = 100;
disableInTransactionIndexing = false;
started = false;
started = false;
previousTxnIds = Collections.<Long>emptyList();
lastMaxTxnId = Long.MAX_VALUE;
fromTimeInclusive = -1L;
voids = new TreeMap<Long, TxnRecord>();
forceReindex = false;
fromTxnId = 0L;
statusMsg = NO_REINDEX;
fromTxnId = 0L;
statusMsg = NO_REINDEX;
}
public synchronized void setListener(IndexTransactionTrackerListener listener)
@@ -195,26 +195,29 @@ public class IndexTransactionTracker extends AbstractReindexComponent
return reindexInTransaction();
}
};
public void resetFromTxn(long txnId)
{
logger.info("resetFromTxn: "+txnId);
this.fromTxnId = txnId;
this.started = false; // this will cause index tracker to break out (so that it can be re-started)
}
public void resetFromTxn(long txnId)
{
if (logger.isInfoEnabled())
{
logger.info("resetFromTxn: " + txnId);
}
this.fromTxnId = txnId;
this.started = false; // this will cause index tracker to break out (so that it can be re-started)
}
@Override
protected void reindexImpl()
{
if (logger.isDebugEnabled())
{
logger.debug("reindexImpl started: " + this);
}
if (logger.isInfoEnabled())
{
logger.info("reindexImpl started: " + this);
}
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
if (!started)
if (!started)
{
// Disable in-transaction indexing
if (disableInTransactionIndexing && nodeIndexer != null)
@@ -226,29 +229,37 @@ public class IndexTransactionTracker extends AbstractReindexComponent
voids.clear();
previousTxnIds = new ArrayList<Long>(maxRecordSetSize);
lastMaxTxnId = null; // So that it is ignored at first
if (this.fromTxnId != 0L)
{
logger.info("reindexImpl: start fromTxnId: "+fromTxnId+" "+this);
Long fromTxnCommitTime = getTxnCommitTime(this.fromTxnId);
if (fromTxnCommitTime == null)
{
return;
}
fromTimeInclusive = fromTxnCommitTime;
}
else
{
fromTimeInclusive = retryingTransactionHelper.doInTransaction(getStartingCommitTimeWork, true, true);
}
fromTxnId = 0L;
if (this.fromTxnId != 0L)
{
if (logger.isInfoEnabled())
{
logger.info("reindexImpl: start fromTxnId: " + fromTxnId);
}
Long fromTxnCommitTime = getTxnCommitTime(this.fromTxnId);
if (fromTxnCommitTime == null)
{
return;
}
fromTimeInclusive = fromTxnCommitTime;
}
else
{
fromTimeInclusive = retryingTransactionHelper.doInTransaction(getStartingCommitTimeWork, true, true);
}
fromTxnId = 0L;
started = true;
logger.info("reindexImpl: start fromTimeInclusive: "+ISO8601DateFormat.format(new Date(fromTimeInclusive))+" "+this);
if (logger.isInfoEnabled())
{
logger.info(
"reindexImpl: start fromTimeInclusive: " +
ISO8601DateFormat.format(new Date(fromTimeInclusive)));
}
}
while (true)
@@ -262,36 +273,36 @@ public class IndexTransactionTracker extends AbstractReindexComponent
}
// Wait for the asynchronous reindexing to complete
waitForAsynchronousReindexing();
if (logger.isTraceEnabled())
{
logger.trace("reindexImpl: completed: "+this);
}
statusMsg = NO_REINDEX;
if (logger.isTraceEnabled())
{
logger.trace("reindexImpl: completed: "+this);
}
statusMsg = NO_REINDEX;
}
private Long getTxnCommitTime(final long txnId)
{
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
RetryingTransactionCallback<Long> getTxnCommitTimeWork = new RetryingTransactionCallback<Long>()
{
public Long execute() throws Exception
{
Transaction txn = nodeDaoService.getTxnById(txnId);
if (txn != null)
{
return txn.getCommitTimeMs();
}
logger.warn("Txn not found: "+txnId);
return null;
}
};
return retryingTransactionHelper.doInTransaction(getTxnCommitTimeWork, true, true);
}
private Long getTxnCommitTime(final long txnId)
{
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
RetryingTransactionCallback<Long> getTxnCommitTimeWork = new RetryingTransactionCallback<Long>()
{
public Long execute() throws Exception
{
Transaction txn = nodeDaoService.getTxnById(txnId);
if (txn != null)
{
return txn.getCommitTimeMs();
}
logger.warn("Txn not found: "+txnId);
return null;
}
};
return retryingTransactionHelper.doInTransaction(getTxnCommitTimeWork, true, true);
}
/**
* @return Returns <tt>true</tt> if the reindex process can exit otherwise <tt>false</tt> if
@@ -299,8 +310,8 @@ public class IndexTransactionTracker extends AbstractReindexComponent
*/
private boolean reindexInTransaction()
{
List<Transaction> txns = null;
List<Transaction> txns = null;
long toTimeExclusive = System.currentTimeMillis() - reindexLagMs;
// Check that the voids haven't been filled
@@ -316,7 +327,7 @@ public class IndexTransactionTracker extends AbstractReindexComponent
}
// get next transactions to index
txns = getNextTransactions(fromTimeInclusive, toTimeExclusive, previousTxnIds);
txns = getNextTransactions(fromTimeInclusive, toTimeExclusive, previousTxnIds);
// If there are no transactions, then all the work is done
if (txns.size() == 0)
@@ -327,15 +338,15 @@ public class IndexTransactionTracker extends AbstractReindexComponent
return false;
}
statusMsg = String.format(
"Reindexing batch of %d transactions from %s (txnId=%s)",
txns.size(),
(new Date(fromTimeInclusive)).toString(),
txns.isEmpty() ? "---" : txns.get(0).getId().toString());
statusMsg = String.format(
"Reindexing batch of %d transactions from %s (txnId=%s)",
txns.size(),
(new Date(fromTimeInclusive)).toString(),
txns.isEmpty() ? "---" : txns.get(0).getId().toString());
if (logger.isDebugEnabled())
{
logger.debug(statusMsg);
logger.debug(statusMsg);
}
// Reindex the transactions. Voids between the last set of transactions and this
@@ -372,9 +383,9 @@ public class IndexTransactionTracker extends AbstractReindexComponent
previousTxnIds.add(txn.getId());
}
if (isShuttingDown() || (! started))
if (isShuttingDown() || (! started))
{
// break out if the VM is shutting down or tracker has been reset (ie. !started)
// break out if the VM is shutting down or tracker has been reset (ie. !started)
return false;
}
else
@@ -384,11 +395,11 @@ public class IndexTransactionTracker extends AbstractReindexComponent
}
}
public String getReindexStatus()
{
return statusMsg;
}
public String getReindexStatus()
{
return statusMsg;
}
private static final long ONE_HOUR_MS = 3600*1000;
/**
* Find a transaction time to start indexing from (inclusive). The last recorded transaction by ID
@@ -633,9 +644,9 @@ found:
}
}
if (isShuttingDown() || (! started))
if (isShuttingDown() || (! started))
{
// break out if the VM is shutting down or tracker has been reset (ie. !started)
// break out if the VM is shutting down or tracker has been reset (ie. !started)
break;
}
// Flush the reindex buffer, if it is full or if we are on the last transaction and there are no more