Skip to content

Temporary Table support in unsharded keyspace#7411

Merged
systay merged 13 commits intovitessio:masterfrom
planetscale:temp-tables
Feb 10, 2021
Merged

Temporary Table support in unsharded keyspace#7411
systay merged 13 commits intovitessio:masterfrom
planetscale:temp-tables

Conversation

@harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Jan 29, 2021

Description

This adds temp table support to unsharded keyspace.

Related Issue(s)

Checklist

  • Tests were added
  • Documentation was added or is not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…ection if the ReservedConn field is set

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay marked this pull request as ready for review February 9, 2021 11:13
@systay
Copy link
Collaborator

systay commented Feb 9, 2021

@harshit-gangal we need to document the caching behaviour

@harshit-gangal
Copy link
Member Author

We need to document temp table support. :)

@harshit-gangal we need to document the caching behaviour

@harshit-gangal
Copy link
Member Author

Documentation: vitessio/website#702

Signed-off-by: Andres Taylor <andres@planetscale.com>
Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏎️

buf.WriteString("temporary ")
}
buf.WriteString("table ")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// IsTemporary implements the DDLStatement interface
func (node *DropTable) IsTemporary() bool {
return node.Temp
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

CREATE temp_opt TABLE not_exists_opt table_name
{
$$ = &CreateTable{Table: $4, IfNotExists: $3}
$$ = &CreateTable{Table: $5, IfNotExists: $4, Temp: $2}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if ddl.CreateTempTable {
vcursor.Session().HasCreatedTempTable()
vcursor.Session().NeedsReservedConn()
return ddl.NormalDDL.Execute(vcursor, bindVars, wantfields)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if normalDDLPlan.Keyspace.Sharded {
return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "Temporary table not supported in sharded keyspace: %s", normalDDLPlan.Keyspace.Name)
}
onlineDDLPlan = nil // emptying this so it does not accidentally gets used somewhere
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

DDL: ddlStatement,
NormalDDL: normalDDLPlan,
OnlineDDL: onlineDDLPlan,
CreateTempTable: ddlStatement.IsTemporary(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like a bit of high level location to place this low level information, but I see why this is necessary.

@systay systay merged commit 38c5098 into vitessio:master Feb 10, 2021
@systay systay deleted the temp-tables branch February 10, 2021 14:55
@askdba askdba added this to the v10.0 milestone Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow temporary tables / session scoped items while in a trx

4 participants