INNODB_SYS_TABLES shows wrong number of columns

Bug #622406 reported by Baron Schwartz on 2010-08-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to
Status tracked in 5.7
Won't Fix

Bug Description

At a customer's site we selected from INNODB_SYS_TABLES and it showed that the tables had <MAX_32_BIT_INT>-<N> columns, instead of showing <N> columns. These were individual partitions of a partioned table. They had 6 columns.

INNODB_SYS_TABLES is raw dump of the intrenal table "SYS_TABLES".
If it is as it is in the table, it is not bug.

I think SYS_TABLES doesn't have information of "number of columns" at all.
("N_COLS" seems to be used only for row format flag)
Because keeping it is bad for performance, it is transactional database.
What is the "number of columns" at the time?
Should it be updated for each INSERT/DELETE and conflict all INSERT and DELETE for the table?

Changed in percona-server:
status: New → Won't Fix

Sorry, I missed a little.
But it is not bug.


 mach_write_to_4(ptr, table->n_def
   | ((table->flags & DICT_TF_COMPACT) << 31));

I don't fix it. It should be raw dump.
(Do you want each column for each flags? How many columns do you want for INNODB_SYS_TABLES?)

Baron Schwartz (baron-xaprb) wrote :

Yasufumi, your comment #1 is about the number of ROWS in the table -- this bug report is about a table that says N_COLS.

If this is not-a-bug then we should change it to a documentation bug. Otherwise people like me will look at the table, find the same problem, and re-file the bug.

Changed in percona-server:
status: Won't Fix → New

It looks to me like the column should be renamed from N_COLS to
TABLE_FLAGS or something like that.

It is "raw dump". not for ordinal users.
The names of columns should be same to internal.

If you don't understand innodb internal, you should not use the internal information...

Baron Schwartz (baron-xaprb) wrote :

You are one of the very few people who knows it by heart. I know more
than 99% of people and I did not know that N_COLS means "table flags."
 People who use this will think that Percona makes stupid mistakes
when writing code that subtracts numbers; it will be an embarrassment
to us. We either need to document this feature, or rename it. I
would strongly prefer to rename it, and then the documentation can say
"internally this has a different name, but we renamed it so it would
be more obvious what it means." I think we have to put users first,
not InnoDB developers.

The i_s was introduced against my intention. (So, I didn't document about the i_s)
I think this should be removed from XtraDB, even it is very useful for debugging / developing,
if it blame about internal information cheaply.

The internal information may change for each versions and I cannot explain the meanings for not-well-known users.
And I cannot keep exact explanation about it in the future.

I suggest .....

1. remove the i_s
2. document "don't use if you don't read source code because it is raw dump of the internal table. it is for InnoDB, not for users"

* I can imagine the users next complain... the N_COL is wrong when don't use PK.
  I should say again "don't use it, if you don't know innodb internal".... It may present the internal columns...

I think newer InnoDB-Plugin has similar table. Please wait official i_s.
I am tired about blaming about not to understand internal information.

Vadim Tkachenko (vadim-tk) wrote :

Assigned to Fred to document this table

Changed in percona-server:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → Fred Linhoss (fred-linhoss)
Stewart Smith (stewart) on 2011-05-25
Changed in percona-server:
assignee: Fred Linhoss (fred-linhoss) → nobody
status: Confirmed → Triaged
tags: added: xtradb

Percona now uses JIRA for bug reports so this bug report is migrated to:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers