pingcap / pingcap/tidb

Unified interface for obtaining information schema

Open
#45,458 0 comments 0 reactions 0 assignees View on GitHub
sig/sql-infra type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
https://github.com/pingcap/tidb/blob/31bca92b7e15ff843187e5f33813e2fabc9b5147/sessionctx/context.go#L96C1-L104

```go
// Deprecated: the semantics of session.GetInfoSchema() is ambiguous
// If you want to get the infoschema of the current transaction in SQL layer, use sessiontxn.GetTxnManager(ctx).GetTxnInfoSchema()
// If you want to get the latest infoschema use `GetDomainInfoSchema`
GetInfoSchema() InfoschemaMetaVersion

// GetDomainInfoSchema returns the latest information schema in domain
// Different with `domain.InfoSchema()`, the information schema returned by this method
// includes the temporary table definitions stored in session
GetDomainInfoSchema() InfoschemaMetaVersion
```

The `GetInfoSchema` function is intended to be deprecated, but because the correctness of the entire process cannot be controlled after replacement. So many places do not directly replace `sessiontxn.GetTxnManager(ctx).GettxNInfoSchema ()` and `GetDomainInfoSchema()`.

Consider cleaning up the way you get `InfoSchema`, replacing the correct interface with other calls later, and either cleaning `GetInfoSchema` directly or adjusting the interface name

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.