Cartodb: Submodule for cartodb-postgresql out of sync with versions in code

Created on 12 Aug 2019  路  6Comments  路  Source: CartoDB/cartodb

As of now (at commit a7366989811321929858c4fbbf9a4cd4c96e7df7), the master branch includes two places where the cartodb postgres extension version is hardcoded:

https://github.com/CartoDB/cartodb/blob/a7366989811321929858c4fbbf9a4cd4c96e7df7/app/models/user/db_service.rb#L658-L660

and

https://github.com/CartoDB/cartodb/blob/a7366989811321929858c4fbbf9a4cd4c96e7df7/app/controllers/home_controller.rb#L13-L14

However, the submodule reference at lib/sql is pointing at

https://github.com/CartoDB/cartodb-postgresql/tree/32db4fd81efcba0be0686a0bf67f8cdb62f1133c

Which is the hash for the extension's 0.29.0 release.

It's causing this error on user creation:

#<Sequel::DatabaseError: PG::InvalidParameterValue: ERROR:  extension "cartodb" has no update path from version "unpackaged" to version "0.30.0"
CONTEXT:  SQL statement "CREATE EXTENSION cartodb VERSION '0.30.0' FROM unpackaged"
PL/pgSQL function inline_code_block line 10 at SQL statement

@rafatower - Looks like this is from your commit 580b16befba999d24723daa5e2ed2a0c547faa43 -- Can you update the submodule version target for lib/sql to match the hard-coded version strings?

Backend bug

Most helpful comment

Finally fixed in parallel here: https://github.com/CartoDB/cartodb/pull/15052

Closing this.

Thanks, Nick for reporting.

All 6 comments

Hi Nick,

Thanks a lot for reporting this.

If you look at the commit https://github.com/CartoDB/cartodb/commit/580b16befba999d24723daa5e2ed2a0c547faa43 you'll see that the submodule is updated as well to commit afa52aa92b1c27f6aaf12565fcbe5f79faae9917, which corresponds to the tagged version https://github.com/CartoDB/cartodb-postgresql/releases/tag/0.30.0

$ git show  580b16b -- lib/sql
commit 580b16befba999d24723daa5e2ed2a0c547faa43 (origin/upgrade-cartodb-extension-0.30.0, upgrade-cartodb-extension-0.30.0)
Author: Rafa de la Torre <[email protected]>
Date:   Wed Jul 17 10:09:33 2019 +0200

    Upgrade cartodb postgresql extension to 0.30.0

diff --git a/lib/sql b/lib/sql
index 32db4fd81e..afa52aa92b 160000
--- a/lib/sql
+++ b/lib/sql
@@ -1 +1 @@
-Subproject commit 32db4fd81efcba0be0686a0bf67f8cdb62f1133c
+Subproject commit afa52aa92b1c27f6aaf12565fcbe5f79faae9917

The lib/sql submodule was indeed updated a couple times after that commit.

Anyway, we acknowledge the issue and will fix it as soon as possible. Thanks again for reporting.

All the best
--Rafa

By looking at the history:

$ git log master...580b16b -- lib/sql
commit 525288d12bcd684269a12fc34dfa1a3acd964253
Merge: abbe6d28cc 2bdaf23d54
Author: Alberto Romeu <[email protected]>
Date:   Wed Jul 17 10:55:36 2019 +0200

    merge master

There's just one commit modifying lib/sql in the commit graph.

If we check the parent commits:

$ git ls-tree abbe6d28cc -- lib/sql
160000 commit 4c93258cd2d93e530d474d7f7b124027cd973400  lib/sql
$ git ls-tree 2bdaf23d54 -- lib/sql
160000 commit 32db4fd81efcba0be0686a0bf67f8cdb62f1133c  lib/sql

we see that none of them corresponds to the intended, but to earlier versions of the extension.

By exploring in the opposite direction up the commit history, we find out that when that commit gets finally merged into master:

$ git show 5341d1a125
commit 5341d1a125d05d976ee46b0e99049923583c8618
Merge: 885a181711 0ab4615d2d
Author: Gonzalo Riestra <[email protected]>
Date:   Wed Jul 31 17:07:35 2019 +0200

    Merge pull request #15023 from CartoDB/15015_new_columns

    04 - add new columns to oauth_apps

one parent corresponds to the master with the right version of the extension:

$ git ls-tree 885a181711 lib/sql
160000 commit afa52aa92b1c27f6aaf12565fcbe5f79faae9917  lib/sql

but the other corresponds to an old version, present in master:

$ git ls-tree 0ab4615d2d lib/sql
160000 commit 32db4fd81efcba0be0686a0bf67f8cdb62f1133c  lib/sql

and finally that's the one that sticks in master.

I'm pretty confident this is just a "bad merge" and therefore can be solved by just committing the updated submodule. cc'ing @gonzaloriestra for awareness or in case I missed something.

Handing it over to RT, cc/ @CartoDB/rt-managers @jgoizueta

Finally fixed in parallel here: https://github.com/CartoDB/cartodb/pull/15052

Closing this.

Thanks, Nick for reporting.

Thanks for the fix, @rafatower!

Was this page helpful?
0 / 5 - 0 ratings