Deleted entry in database, but not exposed via API. Why?

Hey all,

I am trying to clean up a local, very old, Kaltura CE 5 installation before preparing to migrate to a modern version. Part of the clean up is getting rid of “deleted” content. I’ve queried the database for entries that have a DELETED status and used the API to perform a similar query to get the ID’s of deleted entries.

This is more of a sanity check to make sure things seem correct.

The problem is that the API doesn’t return data about some entries that exist in the database. That is, there are rows in the entry table that you can’t query for, by ID, using the API. The API simply returns no results.

Is there some way to hide entries that I’m not finding? Any tips appreciated.

Hello,

By default, the API will not return entries that are deleted [status 3 in the kaltura.entry table].
If you do want to get a list of deleted entries, see When do Deleted entries actually get Deleted?

When you say “there are rows in the entry table that you can’t query for, by ID, using the API. The API simply returns no results” do you mean entries where the status is different than 2? if so, that is expected. If you mean entries that are in status 2 in the DB and still do not show when making the API call, that is probably because they are incorrectly indexed in Sphinx. This can be fixed by running:
# php /opt/kaltura/app/deployment/base/scripts/populateSphinxEntries.php

Thanks for the reply.

So, yes, the API seems to not return some items where status = 3 and the filter object I use with the list method of the baseEntry object has the status property set to DELETED.

I should have been clearer. I am setting the Filter for the API calls to return deleted entries specifically. You’re right in that they API won’t return deleted entries without setting the filter for Deleted entries.

I might try running the Sphinx script to see if that solves the issue. Are there any potential issues with running this script on an otherwise functioning system?

I noticed there is a column in the entry table display_in_search. I can’t find what this might correspond to. Do you know? I can’t find much documentation on it.

Hello,

I recommend you start by making a call to media->get(), passing along one such sample entry ID.
Then, look at the SQL queries logged in /opt/kaltura/log/kaltura_api_v3.log and find the one triggered by this API call. You can then run it manually to understand what condition prevents it from finding your entry and we can take it from there.

Thanks Jess. I’ll give your suggestion a go. I’ll post what I find.

Have a great day.

You too, David. Do let me know.

Here is the query that seems to drive the request. I had to use baseEntry->list as media->get won’t get deleted entries.

SELECT entry.ID, entry.KSHOW_ID, entry.KUSER_ID, entry.NAME, entry.TYPE, entry.MEDIA_TYPE, entry.DATA, entry.THUMBNAIL, entry.VIEWS, entry.VOTES, entry.COMMENTS, entry.FAVORITES, entry.TOTAL_RANK, entry.RANK, entry.TAGS, entry.ANONYMOUS, entry.STATUS, entry.SOURCE, entry.SOURCE_ID, entry.SOURCE_LINK, entry.LICENSE_TYPE, entry.CREDIT, entry.LENGTH_IN_MSECS, entry.CREATED_AT, entry.UPDATED_AT, entry.PARTNER_ID, entry.DISPLAY_IN_SEARCH, entry.SUBP_ID, entry.CUSTOM_DATA, entry.SEARCH_TEXT, entry.SCREEN_NAME, entry.SITE_URL, entry.PERMISSIONS, entry.GROUP_ID, entry.PLAYS, entry.PARTNER_DATA, entry.INT_ID, entry.INDEXED_CUSTOM_DATA_1, entry.DESCRIPTION, entry.MEDIA_DATE, entry.ADMIN_TAGS, entry.MODERATION_STATUS, entry.MODERATION_COUNT, entry.MODIFIED_AT, entry.PUSER_ID, entry.ACCESS_CONTROL_ID, entry.CONVERSION_PROFILE_ID, entry.CATEGORIES, entry.CATEGORIES_IDS, entry.START_DATE, entry.END_DATE, entry.SEARCH_TEXT_DISCRETE, entry.FLAVOR_PARAMS_IDS, entry.AVAILABLE_FROM FROM entry WHERE entry.DISPLAY_IN_SEARCH<>’-1’ AND entry.ID=‘0_20p50oqg’ AND entry.STATUS=‘3’ AND entry.MODERATION_STATUS NOT IN (‘1’,‘3’) AND entry.PARTNER_ID=‘100’ LIMIT 30

In the entry in question, I see that display_in_search = -1. The other constraints in the where clause are satisfied.

That may be why these aren’t returned.

What does this db field mean? Do I have an issue with my sphinx installation?

I think this may have something to do with entries that were replaced by another entry… The test entry I have does have a value in replacedEntryId member of the baseEntry object. I was able to determine this by “undeleting” the asset, then setting display_in_search to 2. This made the entry returnable by baseEntry->List.

Perhaps setting status=3 and display_in_search=-1 is how Kaltura hides replaced entries?

Hi @david.hahn1,

display_in_search will be set to -1 in under these conditions:
0. In case of a temporary entry that was used for entry replacement.

  1. In the event a parent entry ID is defined and this entry shouldn’t return in lists as a stand alone entry.

Last week we also added code that exposes this property in the API but it will be a while until that makes it into the stable version and CE 5 certainly did not have that.

At any rate, for your purposes, you can safely ignore all entries with status <> 2 when migrating.

Thanks for the explanation Jess. It makes sense.

Speaking of migration; is there any write ups or general guidance on migrating from older versions of Kaltura CE to the latest and greatest? I’d rather not invent the wheel if I don’t have to. Or maybe there are some hints out there :slight_smile:

Hi David,

We have a migration guide here:

This was used to successfully upgrade from CE 5 to CE 9, which was the first version of the RPM based install.
Should work well enough for upgrading all the way to 12 too but if you have issues, let me know.
I highly recommend you clone your production ENV, perform the migration on the clone and only switch to Prod. after testing.