This fix will help users restore the remote tasks functionality and prevent the flooding of TCA-CP app logs.
TCA-CP app log error Snippet:
ERROR c.v.h.s.remote.task.RemoteTaskSync- Unable to send remote tasks for location ####-########-####-####-#####-############. Error Error at index 3 in: "643Z" java.lang.NumberFormatException: Error at index 3 in: "643Z" at java.base/java.lang.NumberFormatException.forCharSequence(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.sql/java.sql.Timestamp.valueOf(Unknown Source) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getInstantFromString(RemoteTaskSync.java:198) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getLastSyncTime(RemoteTaskSync.java:190) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getDataToSend(RemoteTaskSync.java:108) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.sendData(RemoteTaskSync.java:90) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.run(RemoteTaskSync.java:62) at com.vmware.vchs.hybridity.messaging.LoggingJobWrapper.run(LoggingJobWrapper.java:41) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
2.2
This is due to a change in the expected format of the lastSyncTime field in the RemoteTaskStatus table. The RemoteTaskSync job does not expect the format as it was in TCA 2.2.0.
Addressed in TCA 3.0
For the existing TCA 2.3.0 environment kindly patch the system using the steps as mentioned in workaround section.
This issue can be resolved by following the steps listed below:
1. Login to TCA-CP shell
2. Open the PostgreSQL console using the following command:
PGPASSWORD=$(cat /common/pgsql/passwords/tca_admin) psql -U tca_admin -d tca
3. Execute the following command on the PostgreSQL console:
DROP FUNCTION IF EXISTS
"remoteTask_getSyncStatus"
;
CREATE FUNCTION
"remoteTask_getSyncStatus"
(given jsonb) RETURNS json AS $$
DECLARE
res json;
BEGIN
SELECT COALESCE(json_agg(json_strip_nulls(to_json(t)->
'val'
)) FILTER (WHERE is_json_object_not_empty(to_json(t)->
'val'
)),
'[]'
::json) INTO res
FROM(
SELECT
CASE
WHEN (to_jsonb(level1)->
'val'
?
'lastSyncTime'
)
THEN jsonb_set(to_jsonb(level1),
'{val, lastSyncTime}'
, to_jsonb(RTRIM(to_jsonb(level1)->
'val'
->>
'lastSyncTime'
,
'Z'
)))->
'val'
ELSE to_jsonb(level1)->
'val'
END as val
FROM (
SELECT val
FROM
"RemoteTaskStatus"
WHERE ( ( NOT( given ?
'location'
) or val->>
'location'
= given->>
'location'
) and ( NOT( given ?
'status'
) or val->>
'status'
= given->>
'status'
) )
) as level1
) AS t;
RETURN res;
END;
$$
LANGUAGE plpgsql;