greptimedb icon indicating copy to clipboard operation
greptimedb copied to clipboard

Unify all usage of table full name to a canonical struct.

Open MichaelScofield opened this issue 2 years ago • 9 comments

What type of enhancement is this?

Refactor, Tech debt reduction

What does the enhancement do?

Currently we are using different methods to refer to a table's full name. For example, TableName, (catalog_name, schema_name, table_name) or TableReference. It would be better if we could eliminate the difference, unify them to a canonical struct used everywhere. I prefer TableReference.

Implementation challenges

Replace all references to a table's full name with TableReference.

MichaelScofield avatar Nov 17 '22 11:11 MichaelScofield

Agree. But TableReference might be confused with TableRef. How about TableDescriptor (out of fd file descriptor).

Actually I prefer TableIdentifier but it's occupied by table id 🫠

pub struct TableIdent {
    /// Unique id of this table.
    pub table_id: TableId,
    /// Version of the table, bumped when metadata (such as schema) of the table
    /// being changed.
    pub version: TableVersion,
}

waynexia avatar Nov 17 '22 11:11 waynexia

How about TableFullName, simple, straightforward, can't be more understandable.

MichaelScofield avatar Nov 18 '22 03:11 MichaelScofield

What about TablePath

iwinux avatar Nov 18 '22 08:11 iwinux

This topic is so interesting and I open a vote discussion for it: Combine catalog name, schema name and table name together!

waynexia avatar Nov 18 '22 14:11 waynexia

From the time I comment, TableFullName is the most preferred naming 🥳

@iwinux are you willing to make this change?

waynexia avatar Nov 22 '22 03:11 waynexia

Yes I can take this task.

iwinux avatar Nov 22 '22 09:11 iwinux

Yes I can take this task.

Thanks :heart:!

waynexia avatar Nov 22 '22 11:11 waynexia

TODOs:

  • [ ] rename table::engine::TableReference (introduced in #491) to TableFullName
  • [ ] replace all occurrences of tuple (catalog_name, schema_name, table_name) with TableFullName (could be found by rg '\(catalog\S+, schema\S+,')
  • [ ] deal with meta_client::rpc::TableName

Not sure how to handle meta_client::rpc::TableName yet - table and meta-client should not import each other, right?

iwinux avatar Nov 23 '22 09:11 iwinux

Right, but I think you should be able to dependent on table in meta-client. table does not dependent on meta-client

2022年11月23日 17:00,Limbo Peng @.***> 写道:

TODOs:

rename table::engine::TableReference (introduced in #491 https://github.com/GreptimeTeam/greptimedb/pull/491) to TableFullName replace all occurrences of tuple (catalog_name, schema_name, table_name) with TableFullName (could be found by rg '(catalog\S+, schema\S+,') deal with meta_client::rpc::TableName Not sure how to handle meta_client::rpc::TableName yet - table and meta-client should not import each other, right?

— Reply to this email directly, view it on GitHub https://github.com/GreptimeTeam/greptimedb/issues/559#issuecomment-1324732433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHR2D67PJGBRQUGX6ZBMGTWJXML7ANCNFSM6AAAAAASDH4DBI. You are receiving this because you authored the thread.

MichaelScofield avatar Nov 24 '22 02:11 MichaelScofield

ping @iwinux , any updates?

MichaelScofield avatar Feb 15 '23 10:02 MichaelScofield

Sorry but no progress has been made. Please reassign this issue as you see fit.

Apologize for the delay of updates :(

iwinux avatar Feb 16 '23 03:02 iwinux

It's ok, I'll handle it.

MichaelScofield avatar Feb 16 '23 03:02 MichaelScofield

Hi, Just wondering if this issue has been handled? If not, I can probably take a look at it(I'm currently looking for good first issue to get started with contributing to greptime db).

qstommyshu avatar Apr 30 '23 19:04 qstommyshu

@qstommyshu feel free to submit PRs to this issue. You can do it progressively, modify part of the codes at a time.

MichaelScofield avatar May 01 '23 06:05 MichaelScofield

Thanks for replying!

I was looking at the previous discussion and reading the code related to this issue. From the todos given by @iwinux , I think the first two checkpoints can be done by renaming, but I don't think I understand "Not sure how to handle meta_client::rpc::TableName yet - table and meta-client should not import each other, right?"(Question: why they should not import each other?) and I'm trying to understand the response from @MichaelScofield : "but I think you should be able to dependent on table in meta-client. table does not dependent on meta-client" what does it mean by table does not dependent on meta-client? (Question: 1. what is the table you are referring to here? And do you mean "table should be able to depends on meta-client, but meta-client doesn't need to depends on table? meaning meta-client is imported by table")

qstommyshu avatar May 09 '23 01:05 qstommyshu

@qstommyshu table crate should be logically lower level than meta-client. Let's reuse the TableReference struct we already have, and forget about TableFullName. All in all, we just want to unify the table naming usages -- TableName, (catalog, schema, table) or TableReference -- to a standardized, canonical way.

MichaelScofield avatar May 09 '23 03:05 MichaelScofield