Validate the content off the database and the content of the folder /opt/kaltura/web/content/

Hi all,

I am trying to validate the content of the database (entry, flavor_asset, media_info, etc) and the content of the folder /opt/kaltura/web/content/, so that i can do some cleanup of orphaned information or files.

I think there are some inconsistency in the relation from the database to the existence of files in the folder and vice verse.

Does anyone know of a process/program to do this validation?

Thank you,

Hi @amanadas,

The entry records [or objects, depending on your perspective] are abstract. They do not point to an actual file on disk but rather, contain general metadata about the entry [name, description, creation date, modification date, tags, etc]. Each such entry record has flavour assets. The metadata for these is kept in the flavor_asset table.
So, let’s assume the entry ID in question is ‘0_oqiwn3qk’. To get the flavours attached to this entry in the DB:

mysql> select * from flavor_asset where entry_id = '0_oqiwn3qk'\G

The same query can be done via the API using the flavorasset->list() action, while passing a KalturaAssetFilter with entryIdEqual=$ENTRY_ID.

Each entry and flavor_asset record has a ‘status’ column. For the flavour assets, the statuses are:

class KalturaFlavorAssetStatus extends KalturaEnumBase
        const ERROR = -1;
        const QUEUED = 0; 
        const CONVERTING = 1; 
        const READY = 2; 
        const DELETED = 3; 
        const NOT_APPLICABLE = 4; 
        const TEMP = 5; 
        const WAIT_FOR_CONVERT = 6; 
        const IMPORTING = 7; 
        const VALIDATING = 8; 
        const EXPORTING = 9; 

For entries:

class KalturaEntryStatus extends KalturaEnumBase
        const ERROR_IMPORTING = "-2";
        const ERROR_CONVERTING = "-1";
        const IMPORT = "0";
        const INFECTED = "virusScan.Infected";
        const SCAN_FAILURE = "virusScan.ScanFailure";
        const PRECONVERT = "1";
        const READY = "2";
        const DELETED = "3";
        const PENDING = "4";
        const MODERATE = "5";
        const BLOCKED = "6";
        const NO_CONTENT = "7";

The actual path to the media asset [the MP4] can be found with this query:

mysql> select concat (file_root,file_path) as path  from file_sync where object_id =$flavour_asset_id;

Hope this helps.

By default, the actual media files are NOT deleted from disk when an entry is deleted using the delete() action. Its status in the DB is simply changed to 3. If you wish to purge the files from disk, you can go to Admin Console->Publishers->YOUR PARTNER->Actions->Configure and check the Purge files on deletion checkbox. This will not affect existing deleted entries, only going forward.

This is very useful.

Can we delete all records from the DB that have the status DELETED? Is it safe?

Thanks for all the help.

Hi @amanadas,

Yes, assuming you have no intention to ever revive these entries and that their status is indeed 3 [DELETED], it should be perfectly safe to delete the files from the disk.