mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Changed 'version' column from TINYINT to SMALLINT
- Tables are 'alf_prop_root' and 'alf_audit_app' - Added property test to update past the SMALLINT rollover to test reversion to 0 - To modify your tables (not absolutely necessary) alter table alf_audit_app modify version SMALLINT NOT NULL; alter table alf_prop_root modify version SMALLINT NOT NULL; git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16320 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,7 +20,7 @@ CREATE TABLE alf_audit_model
|
|||||||
CREATE TABLE alf_audit_app
|
CREATE TABLE alf_audit_app
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
version TINYINT NOT NULL,
|
version SMALLINT NOT NULL,
|
||||||
app_name_id BIGINT NOT NULL,
|
app_name_id BIGINT NOT NULL,
|
||||||
audit_model_id BIGINT NOT NULL,
|
audit_model_id BIGINT NOT NULL,
|
||||||
disabled_paths_id BIGINT NOT NULL,
|
disabled_paths_id BIGINT NOT NULL,
|
||||||
|
@@ -75,7 +75,7 @@ CREATE TABLE alf_prop_value
|
|||||||
CREATE TABLE alf_prop_root
|
CREATE TABLE alf_prop_root
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
version TINYINT NOT NULL,
|
version SMALLINT NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
@@ -132,8 +132,10 @@
|
|||||||
audit_model_id = #auditModelId#,
|
audit_model_id = #auditModelId#,
|
||||||
disabled_paths_id = #disabledPathsId#
|
disabled_paths_id = #disabledPathsId#
|
||||||
where
|
where
|
||||||
id = #id# and
|
id = #id#
|
||||||
version = (#version# -1)
|
<isGreaterThan property="version" compareValue="1">
|
||||||
|
and version = ((#version#-1))
|
||||||
|
</isGreaterThan>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- TODO: This has to be replaced with two deletes; one for the property links and another for the entries -->
|
<!-- TODO: This has to be replaced with two deletes; one for the property links and another for the entries -->
|
||||||
|
@@ -363,8 +363,10 @@
|
|||||||
set
|
set
|
||||||
version = #version#
|
version = #version#
|
||||||
where
|
where
|
||||||
id = #id# and
|
id = #id#
|
||||||
version = (#version# -1)
|
<isGreaterThan property="version" compareValue="1">
|
||||||
|
and version = ((#version#-1))
|
||||||
|
</isGreaterThan>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete_PropertyRootById" parameterClass="PropertyRoot">
|
<delete id="delete_PropertyRootById" parameterClass="PropertyRoot">
|
||||||
|
@@ -26,9 +26,11 @@ package org.alfresco.repo.domain.propval;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -587,6 +589,29 @@ public class PropertyValueDAOTest extends TestCase
|
|||||||
assertEquals(list, entityValueCheck);
|
assertEquals(list, entityValueCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testProperty_UpdateToVersionRollover() throws Exception
|
||||||
|
{
|
||||||
|
final List<String> list = Collections.emptyList();
|
||||||
|
final Long propId = runPropertyTest((Serializable)list);
|
||||||
|
|
||||||
|
// Do 1000 updates to a property
|
||||||
|
RetryingTransactionCallback<Void> updateThousandsCallback = new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{
|
||||||
|
propertyValueDAO.updateProperty(propId, (Serializable)list);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for (int i = 0; i < (Short.MAX_VALUE / 1000 + 1); i++)
|
||||||
|
{
|
||||||
|
txnHelper.doInTransaction(updateThousandsCallback, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testProperty_Delete() throws Exception
|
public void testProperty_Delete() throws Exception
|
||||||
{
|
{
|
||||||
final ArrayList<String> list = new ArrayList<String>(20);
|
final ArrayList<String> list = new ArrayList<String>(20);
|
||||||
|
Reference in New Issue
Block a user