CartoDB / cartodb-postgresql

PostgreSQL extension for CartoDB
BSD 3-Clause "New" or "Revised" License
111 stars 52 forks source link

What is the DBSCH command being passed to the invalidation service? #361

Closed nballenger closed 5 years ago

nballenger commented 5 years ago

I'm really confused by what is happening here:

https://github.com/CartoDB/cartodb-postgresql/blob/2e665a56b4a7dbc3bd8e3d91ac18b52bb932663c/scripts-available/CDB_GhostTables.sql#L41

In that line, client is a Redis client, but DBSCH is not a Redis command that I can find. Based on the file history all that line is doing is dropping a job onto the Resque queue to run ghost table linking. Is DBSCH a custom Redis command? Is it documented somewhere?

I pulled down the most recent Redis package in Carto's redis-next PPA and spun it up in a Docker container--it doesn't have the command. Is there another package that should accompany it? I also can't find any public repos in Carto's github that appear to cover this (though I could easily have missed it, there's a lot of them).

It also looks like there's similar code in the cartodb repo inside the invalidation trigger that's built on user create:

https://github.com/CartoDB/cartodb/blob/2eecab6a05a76d4e9253004ef7b0c86938e07daa/app/models/user/db_service.rb#L1542

client.execute_command('TCH', '#{@user.database_name}', table_name)

@gonzaloriestra - It looks from this diff like you might know?

https://github.com/CartoDB/cartodb-postgresql/commit/5f154a585910f4de5df08c1287d0fd5e02287f78#diff-e197cbbeb07315bf1df8566b72b43f59L32

gonzaloriestra commented 5 years ago

Hi! You are right. DBSCH is a custom command to enqueue the ghost table linking process. It's done in a private repository, but it can work without it.

nballenger commented 5 years ago

Hi, Gonzalo--thanks for the confirmation, that's helpful to know.