Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-20.1: sql: populate Oid on type upgrade #47240

Merged
merged 1 commit into from Apr 9, 2020

Conversation

pbardea
Copy link
Contributor

@pbardea pbardea commented Apr 9, 2020

Backport 1/1 commits from #47234.

/cc @cockroachdb/release


When types are unmarshalled, the types are upgraded and the Oid of the
internal type should be set. In 19.1, timestamps received an Oid and
they were populated by the default case in upgradeTypes. However,
a case to handle timestamps was added, but the Oids were no longer
set (as they didn't need to be anymore). However, this meant that
default case was not triggered anymore, so the Oid was no longer
set. This commit also sets the Oid in the timestamp case.

Fixes #44453.

Release note (bug fix): Restoring a backup from 2.1 to 20.1 with a
timestamp column would result in incomplete type data. This would
crash commands such as SHOW COLUMNS FROM <new_table>. This is now
fixed.

@pbardea pbardea requested review from jordanlewis and otan April 9, 2020 01:30
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@pbardea pbardea changed the title release-20.1: sql: populate timestamp Oid on unmarshall release-20.1: sql: populate Oid on type upgrade Apr 9, 2020
@jordanlewis
Copy link
Member

LGTM!

@blathers-crl
Copy link

blathers-crl bot commented Apr 9, 2020

❌ The GitHub CI (Cockroach) build has failed on 16cc2598.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

@blathers-crl
Copy link

blathers-crl bot commented Apr 9, 2020

❌ The GitHub CI (Cockroach) build has failed on 16cc2598.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

@blathers-crl
Copy link

blathers-crl bot commented Apr 9, 2020

❌ The GitHub CI (Cockroach) build has failed on 16cc2598.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

When types are unmarshalled, the types are upgraded and the Oid of the
internal type should be set. In 19.1, timestamps received an Oid and
they were populated by the default case in upgradeTypes. However,
a case to handle timestamps was added, but the Oids were no longer
set (as they didn't need to be anymore). However, this meant that
default case was not triggered anymore, so the Oid was no longer
set.

This commit moves the setting of the Oid from the default case to after
the switch statement and sets the Oid based on the type family if none
has been set yet.

Release note (bug fix): Restoring a backup from 2.1 to 20.1 with a
timestamp column would result in incomplete type data. This would
crash commands such as SHOW COLUMNS FROM <new_table>. This is now
fixed.
@pbardea pbardea merged commit fe16fd5 into cockroachdb:release-20.1 Apr 9, 2020
@pbardea pbardea deleted the backport20.1-47234 branch April 27, 2020 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants