Created a custom metadata schema, and started using it on my content. After wanting to go back and edit the custom data, I’m receiving an error when I go to save saying “Metadata profile is currently transforming”
I see a batch job for this, but it never seems to complete. I can cancel the batch job, but it looks like the database is still marked as being locked/active (Metadata_profile table, row with my custom metadata has a status of “3”) Using kaltlog on my batch servers, I’m seeing a lot of PHP warnings regarding the metadata transform process:
PHP Warning: Invalid argument supplied for foreach() in /opt/kaltura/app/plugins/metadata/batch/Transform/KAsyncTransformMetadata.class.php on line 61
So, the exception happens here:
/opt/kaltura/app/plugins/metadata/services/MetadataProfileService.php
function updateAction($id, KalturaMetadataProfile $metadataProfile, $xsdData = null, $viewsData = null)
{
$dbMetadataProfile = MetadataProfilePeer::retrieveByPK($id);
if(!$dbMetadataProfile)
throw new KalturaAPIException(MetadataErrors::METADATA_PROFILE_NOT_FOUND, $id);
if($dbMetadataProfile->getStatus() != MetadataProfile::STATUS_ACTIVE)
throw new KalturaAPIException(MetadataErrors::METADATA_TRANSFORMING);
What was the API call you made to update the custom data?
The foreach warning comes from invalidateFailedMetadatas() and is definitely related.
Do you see any other errors in /opt/kaltura/log/kaltura_api_v3.log prior to the exception? we need to trace the flow and see what led to the data being invalid…
Just trying to update the metadata fields via the KMC at this point, so this is happening from the web interface. This error is thrown when I hit “save changes” directly from the Webserver:
2015-10-27 07:53:20 [0.000875] [] [1612074029] [27] [API] [KalturaStatement->execute] DEBUG: Sql took - 0.00063490867614746 seconds 2015-10-27 07:53:20 [0.002469] [] [1612074029] [28] [API] [KalturaFrontController->getExceptionObject] ERR: exception ‘KalturaAPIException’ with message ‘Metadata profile is currently transforming’ in /opt/kaltura/app/plugins/metadata/services/MetadataProfileService.php:158 Stack trace: #0 [internal function]: MetadataProfileService->updateAction(2, Object(KalturaMetadataProfile), ‘<xsd:schema xml…’, ‘’)
One recurring thing I am seeing in older api_v3 logs is the following:
[API] [KalturaFrontController->errorHandler] NOTICE: /opt/kaltura/app/api_v3/lib/KalturaFrontController.php line 221 - Undefined offset: 1
Does this reproduce with any other data schemas you have? can you try to manually set the status of the relevant schema to to 1 in the metadata_profile table and try to edit it again, while looking closely at the logs?
It may have been a one time issue and it just got stuck in that state or else, something in the values you are inputting is cause it to behave that way… would help if you can provide your schema’s XSD which you can download from the KMC and also the data you’re trying to input in your update call. That way, I can try to reproduce it.
After setting the row to a status of 1 I was able to update the metadata via the web interface (Removed a System Name) and save it successfully. After updating it, I checked the database row for that metadata profile and it is stuck back in a status of 3, and I can’t update it it unless I set it back to 1. Changing the position of the System names, and saving it also gets the status stuck at 3 in the DB.
One batch server is still throwing the foreach() errors. Do you want me to dump the full output of the XML file here, or would you rather I send it to a dropoff somewhere?
You can paste the XML here, thanks.
Can you explain what you mean by “Changing the position of the System names”? just trying to understand the exact action you’re taking.
So, I was unable to reproduce it using version 11.0.0 which is the current stable.
What I did is:
use /opt/kaltura/bin/create_metadata.php passing the XSD you provided as argument, which created the profile.
click on the position up and down buttons randomly
hit “Save Changes”
I got this alert box:
"Note: If you use XMLs for bulk upload,Reordering schema fields affects the validation of custom data elements in existing XMLs. If you reorder schema fields, you also need to update your bulk upload XML structure to reflect the new field order. Do you want to save your schema change"
and hit “Yes”
All went well enough.
What version are you using? also, can you check whether creating the schema the way I did makes any difference? it should not, I just used my script because I hate manual labour but maybe for some reason it causes a different behaviour…
/opt/kaltura/bin/create_metadata.php is part of the kaltura-postinst package and is used during the sanity check so you should have it available.
Quick update. Ran the script this morning to populate the metadata via the XSD file, and changes to the schema don’t seem to be causing status locks in the database. I’ll keep an eye on it, thanks for letting me know about that script. Saved me a lot of time
I am glad to hear it works well this way but it is still a bug:) if it reproduces for you with 11.0.0, can you kindly post an issue at github.com/kaltura/server? you can ref this post there.
Also, as far as learning how to work with our API, there are a lot of useful scripts under /opt/kaltura/bin for you to look at, they are all called as part of the kaltura-sanity.sh.
And of course, there is also developer.kaltura.org which is another good resource. To use, you need to open a free account with our SaaS, it a simple enough form to fill:)