cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to update the tag scopes 3.4.b

loftux
Star Contributor
Star Contributor
I have an installation where TagScopes is somehow out of sync.
Especially serious is " SQL update 'alfresco.lock.update_Lock' affected 0 rows, not 1 as expected"
09:17:11,341 ERROR [org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl] Failed to execute asynchronous action: Action[ id=f45b5cec-4a9e-4922-aa29-1c171a09237a, node=null ]
java.lang.RuntimeException: Unable to update the tag scopes.
   at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.executeImpl(UpdateTagScopesActionExecuter.java:271)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:133)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:749)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:675)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:443)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:452)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:455)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException: SQL update 'alfresco.lock.update_Lock' affected 0 rows, not 1 as expected
   at org.springframework.orm.ibatis.SqlMapClientTemplate.update(SqlMapClientTemplate.java:390)
   at org.alfresco.repo.domain.locks.ibatis.LockDAOImpl.updateLock(LockDAOImpl.java:144)
   at org.alfresco.repo.domain.locks.AbstractLockDAOImpl.getLock(AbstractLockDAOImpl.java:130)
   at org.alfresco.repo.lock.JobLockServiceImpl$4.execute(JobLockServiceImpl.java:423)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.lock.JobLockServiceImpl.doWithRetry(JobLockServiceImpl.java:475)
   at org.alfresco.repo.lock.JobLockServiceImpl.getLockImpl(JobLockServiceImpl.java:429)
   at org.alfresco.repo.lock.JobLockServiceImpl.getLock(JobLockServiceImpl.java:192)
   at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.lockTagScope(UpdateTagScopesActionExecuter.java:520)
   at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.executeImpl(UpdateTagScopesActionExecuter.java:188)
   … 12 more
If have tried to do a refresh on each of the the tagscopes using a script that loops through folders and
//         if(n.hasAspect("cm:tagscope")){         
//            refresh.execute(n);
//            logger.warn("LX TagScope update: " +n.displayPath + "/" + n.name);
//         }
         if(n.isTagScope){
            var ts = n.getTagScope();
            ts.refresh();
            logger.warn("LX TagScope update: " +n.displayPath + "/" + n.name);
         }
I have tried the two methods above, and still no luck. What else can I try?
Mysql is version: mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64), can this be something specific to this version?
Also tried with a build from latest HEAD that has even more changes to how transactions are managed.
2 REPLIES 2

loftux
Star Contributor
Star Contributor
This is what I did (in test so far)
curl -d aa=aa -u admin:alfresco http://localhost:8080/alfresco/service/api/audit/clear/Alfresco%20Tagging%20Service
(the aa=aa are just bogus parameters, didn't figure out how to do post with curl without parameters)
This clears the queued tag update jobs, there were more than 300.

Stopped Alfresco, and did some manual cleaning of alf_lock and alf_lock_resources
mysql> select * from alf_lock;
+—-+———-+——————–+——————+————+————+————-+
| id | version  | shared_resource_id | excl_resource_id | lock_token | start_time | expiry_time |
+—-+———-+——————–+——————+————+————+————-+
|  1 |      774 |                  1 |                1 | not-locked |          0 |           0 |
|  2 |       14 |                  2 |                2 | not-locked |          0 |           0 |
|  3 |   329281 |                  3 |                3 | not-locked |          0 |           0 |
|  4 |      331 |                  4 |                4 | not-locked |          0 |           0 |
|  5 |      812 |                  5 |                5 | not-locked |          0 |           0 |
|  6 |  5181334 |                  6 |                6 | not-locked |          0 |           0 |
|  7 | 10000000 |                  7 |                7 | not-locked |          0 |           0 |
|  8 |  8615796 |                  8 |                8 | not-locked |          0 |           0 |
|  9 |        1 |                  9 |                9 | not-locked |          0 |           0 |
+—-+———-+——————–+——————+————+————+————-+
9 rows in set (0.00 sec)

mysql> select * from alf_lock_resource;
+—-+———+————-+———————————————————————–+
| id | version | qname_ns_id | qname_localname                                                       |
+—-+———+————-+———————————————————————–+
|  1 |       0 |           1 | chaininguserregistrysynchronizer                                      |
|  2 |       0 |           1 | contenturlconverter                                                   |
|  3 |       0 |           1 | alfrescojbpmjobexecutor                                               |
|  4 |       0 |           1 | contentstorecleaner                                                   |
|  5 |       0 |           1 | nodecleanup                                                           |
|  6 |       0 |          11 | tagscope_workspace://spacesstore/21396d71-df16-4883-9477-469be423a214 |
|  7 |       0 |          11 | tagscope_workspace://spacesstore/56ee4139-d86a-400e-a650-71b09ebbb8dd |
|  8 |       0 |          11 | tagscope_workspace://spacesstore/328c6266-d29f-4490-ade2-076f195f1124 |
|  9 |       0 |          11 | tagscope_workspace://spacesstore/e7df1c75-a0a3-4d9e-836e-e417210f8093 |
+—-+———+————-+———————————————————————–+
9 rows in set (0.00 sec)

mysql> delete from alf_lock where id > 5;
Query OK, 4 rows affected (0.01 sec)

mysql> select * from alf_lock;
+—-+———+——————–+——————+————+————+————-+
| id | version | shared_resource_id | excl_resource_id | lock_token | start_time | expiry_time |
+—-+———+——————–+——————+————+————+————-+
|  1 |     774 |                  1 |                1 | not-locked |          0 |           0 |
|  2 |      14 |                  2 |                2 | not-locked |          0 |           0 |
|  3 |  329281 |                  3 |                3 | not-locked |          0 |           0 |
|  4 |     331 |                  4 |                4 | not-locked |          0 |           0 |
|  5 |     812 |                  5 |                5 | not-locked |          0 |           0 |
+—-+———+——————–+——————+————+————+————-+
5 rows in set (0.00 sec)

mysql> delete from alf_lock_resource where id > 5;
Query OK, 4 rows affected (0.00 sec)
After restart, ran my refresh tagscope script. And it all seem to be fine, new tags can be added, and tagscope is updated. No errors in the log

Have I done anything by doing stuff directly in the database that may wreck the repository?

iblanco
Confirmed Champ
Confirmed Champ
For some reason I ended having some tagScopeCache properties pointing to non existent content. It generated exceptions whenever someone accesed the implied tagScope'd directory.

The refresh script above did not solve the problem itself but I changed it so it would remove the tagScopable aspect and reapply it before refreshing the tag scope.

Then I applied the script on the folder that was having the problem and that solved the problem.