MySQL 5.6 Innodb running out single-table tablespace id's - mysql

I am looking for general information regarding this message:
InnoDB: Warning: you are running out of new single-table tablespace id's.
InnoDB: Current counter is 2152000000 and it must not exceed 4294967280!
InnoDB: To reset the counter to zero you have to dump all your tables and
InnoDB: recreate the whole InnoDB installation.
Which counter? How do you query it? Does an entire restore fix this problem?

From Percona Support:
When you create one table in innodb, that counter will be increased by 1.
This table id seems to be a 32bit value.
In my case, we created lots of temporary tables. On MySQL 5.6 default engine for temporary tables is innodb hence the problem. Once I changed it to MYISAM the warnings disappeared.

Related

Why undo log entries in MySQL innodb buffer pool (MySQL 5.7)

Long transactions generate several old versions of the rows in the undo log which are stored in ibdata file.Is there any possibility that undo log entries are also stored in the innodb buffer pool.
They cannot be stored "permanently" in the buffer_pool because it is lost in a power failure. Undo is needed then, too.

Effect of Alter Table Import TableSpace on InnoDB Buffer Pool in MySql?

I am trying to understand the impact of Import TableSpace for the alter command on innodb's buffer pool.
Since the table space is being imported and rows are being inserted, would all pages be bought into the Buffer Pool during the import? or does the Import TableSpace actually skip the buffer pool completely ?
The only information i could find is in the storage/innobase/row/row0import.cc in a comment under Phase III - Flush changes to disk which says
Ensure that all pages dirtied during the IMPORT make it to disk. The
only dirty pages generated should be from the pessimistic purge of
delete marked records that couldn't be purged in Phase I
The Mysql Version is 5.7

How to Sync mySQL Logs

I recently experienced a DDoS attack. It overwhelmed and crashed my server. Upon restart all of the innodb tables were corrupted in every database on the server.
I have since rebuilt the databases and all of the tables. I had to recreate innodb_table_stats, innodb_index_stats.
Everything now seems to be running fine, the website is up but I have one persistent error that keeps coming up. The general log is filling with these quite rapidly.
2014-07-13 15:28:37 7fd70b374700 InnoDB: Error: page 193 log sequence number 526819726
InnoDB: is in the future! Current system log sequence number 156433332.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: for more information.
I tried Changing the Number and Size of mySQL logs. It all went fine with no errors. But I am still seeing these errors mount up in the new log.
What else can I try to sync up these log sequence numbers? I am pretty new to this backend database work. Being forced to learn since my hosts tech support sucks.
I am currently on: CENTOS 6.5 x86_64 virtuozzo – vps- WHM 11.44.0 (build 22)
mySQL: 5.6.17
"page ... log sequence number" is when the page was last modified. The LSN in the header is larger than one in the redo log.
The easiest way to fix it is to rebuild the table with noop ALTER TABLE.
ALTER TABLE mytable ENGINE InnoDB;
It will rebuild PRIMARY index as well as its secondary indexes. After that the error should go away.
The ALTER is going to block the table, so if it's large and if the site is in production the best option is to rebuild it with pt-online-schema-change. It will do the same, but won't block the table but for brief moment.
pt-online-schema-change --alter "ENGINE=InnoDB" D=sakila,t=actor

Can't create a table in MySQL because "it already exists"

I am having an issue with MySQL, relating to my previous question.
I recently needed to remove a table from MySQL, and now need to create a new one in its place. I am having a hard time with this because, as MySQL Workbench says, "The table already exists." Since the error from MySQL Workbench is not particularly helpful, here's some stuff that I pulled out of my error log. What's the problem?
I am running MySQL 5.7 on Windows 8.1 Pro x64.
2014-03-06T01:38:55.459658Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_messagedata in the InnoDB data dictionary has tablespace id 25, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.464671Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_onlineusers in the InnoDB data dictionary has tablespace id 26, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.468672Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2pchat_betaaccesskeys in the InnoDB data dictionary has tablespace id 24, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
As the table exists then just remove it with drop table (http://dev.mysql.com/doc/refman/5.6/en/drop-table.html)
i.e.
drop table <table name>
You must have done something wrong as the table still exists.
Can check this with select
i.e.
select * from <table name>
It looks your innodb tablespace has been corrupted.
Checkout this post from percona
http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/
And these tools
http://www.percona.com/software/percona-toolkit
They will save you!
Well I don't know how well they run on windows but what the tools do should be about the same.
Go to where your mysql folder is installed:
C:\Apps\mysql-5.6.25-win64\data\databasename
Under databasename you will find your tablename. Delete this table manually and create it again using SQL Create Table command.

table is in the system tablespace 0 which cannot be discarded

I am trying to run this query:
alter table about_member discard tablespace;
But when I do, my error logs are outputting this:
InnoDB: Error: table `diskise`.`about_member`
InnoDB: is in the system tablespace 0 which cannot be discarded
What can I do so I can discard this tablespace so I can import a backup that I have?
See this manual page:
By default, all InnoDB tables and indexes are stored in the system tablespace. As an alternative, you can store each InnoDB table and its indexes in its own file. This feature is called “multiple tablespaces” because each table that is created when this setting is in effect has its own tablespace.
Advantages of Per-Table Tablespaces
You can reclaim disk space when truncating or dropping a table. For tables created when file-per-table mode is turned off, truncating or dropping them creates free space internally in the ibdata files. That free space can only be used for new InnoDB data.
It sounds like you created your table in the default tablespace, so you cannot discard the tablespace. That said, you should be able to import data without discarding a tablespace first, unless you're just out of disk space.
I just ran into same problem while I was trying to restore one table from .ibd file. I know it's been a long time so I wrote this here for people who still running into the same problem.
Continuing with #Ed Cottrell's answer, you will need to change the mysql global variable innodb_file_per_table to let mysql to store .ibd in your own file instead of using system tablespace.
To achieve this you can do (also see official docs):
change your my.cnf file, adding following line and restart mysql server
[mysqld]
innodb_file_per_table=1
set global variable in mysql command (sometimes not working due to security issue)
SET GLOBAL innodb_file_per_table=1;
You may need to DROP your table before this take effects.
After doing this, you will be able to see .ibd files inside PATH/TO/MYSQL/DB_NAME directory (e.g. /var/lib/mysql/DB_NAME).