Quantcast
Channel: MySQL Forums - InnoDB
Viewing all 1954 articles
Browse latest View live

InnoDB Record Locking (2 replies)

$
0
0
Hi there,

Does anybody know what the correct way would be in order to do the following. I'm using MYSQL since the last 4 months, and MYSQL does have a different way of processing locks than other engines I have used before.

Basically I need to read a record/s out of a table, and after getting the detail of these records, update them to a state to not allow re-use.

Now, my application is a multi-threaded environment, so concurrency is an issue. First I thought of handling mutex's in my application, but since MYSQL supports record locking, I thought I'd give it a bash.

I currently do the following on each different Thread connection:

1 - set autocommit=0;
2 - set session transaction isolation level READ COMMITTED;
3 - START TRANSACTION;
4 - SELECT * FROM Item WHERE Status = 0 AND BuyProduct = 7 LIMIT 5 FOR UPDATE;
5 - [Loop through above recordset and update] UPDATE Item SET Status = 1 WHERE id = ?
6 - COMMIT

Now imagine 1000 threads 'attacking' this table at the same time....

I get a lot of MySQLTransactionRollbackExceptions because numerous threads are attempting to update the same records, due from the select clause. Even though I specify FOR UPDATE?

Does anybody have some advice?

W

InnoDB can't allocate memory (1 reply)

$
0
0
Hello everybody

Last time I tried to restart mysql, I got this error

110203 12:23:26 InnoDB: Error: cannot allocate 10737434624 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 48401248 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.
InnoDB: We keep retrying the allocation for 60 seconds...

It seems that innodb_pool_size can't be any more 10G as it was.
I have 16 GB Ram and a 64 bit Gentoo Linux, so I can't understand what's the matter, and why it worked up to now

Database size on the readonly server (no replies)

$
0
0
Hi list.

I have a replication going from db1 to db2. I use db2 as readonly for internal queries. However, the ibtata1 keeps increasing on the readonly server(db2). Do you have any method to find out why it's increasing?

I expect that the ibdata1 shouldn't be much different(in size) from the master. Thanks for looking into this.

Can two single-keys be used instead of a multi-key? (2 replies)

$
0
0
Hi, I have a table storing user IDs and the times those users did a certain thing. Sometimes we want to know what a user did in a certain time period, so we add a multi-key to the table:
Quote:
KEY `uid` (`uid`,`start`)
So this can be done efficiently: SELECT * FROM t WHERE uid='...' AND start BETWEEN '...' AND '...';

From time to time we'd like to delete older entries irregardless of which user they belong to, so a second key comes along (because the second column of the multi-key above cannot be used alone):
Quote:
KEY `start` (`start`)
So this can be done efficiently: DELETE FROM t WHERE start<'...';

Can the same same two queries be index-optimized with two one-column keys? Something like:
Quote:
KEY `uid` (`uid`),
KEY `start` (`start`)

Thanks.

InnoDB (no replies)

$
0
0
i am not able to use MySql Server 5.0 getting

Sql Error: can't Connect to MySql Server on 'localhost'(10061)


InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
110202 9:59:53 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
110202 9:59:54 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 24 MB
InnoDB: Database physically writes the file full: wait...
110202 9:59:56 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 24 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110202 9:59:58 InnoDB: Started; log sequence number 0 0
110202 9:59:59 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: ready for connections.
Version: '5.0.41-community-nt' socket: '' port: 3306 MySQL Community Edition (GPL)
InnoDB: Error: log file .\ib_logfile0 is of different size 0 25165824 bytes
InnoDB: than specified in the .cnf file 0 63963136 bytes!
110208 15:18:58 [ERROR] Default storage engine (InnoDB) is not available
110208 15:18:58 [ERROR] Aborting

110208 15:18:58 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Shutdown complete

InnoDB: Error: log file .\ib_logfile0 is of different size 0 25165824 bytes
InnoDB: than specified in the .cnf file 0 63963136 bytes!
110208 15:33:06 [ERROR] Default storage engine (InnoDB) is not available
110208 15:33:06 [ERROR] Aborting

110208 15:33:06 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Shutdown complete

InnoDB: Error: log file .\ib_logfile0 is of different size 0 25165824 bytes
InnoDB: than specified in the .cnf file 0 63963136 bytes!
110208 15:46:43 [ERROR] Default storage engine (InnoDB) is not available
110208 15:46:43 [ERROR] Aborting

110208 15:46:43 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Shutdown complete

can any one help me out thanks in advance

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near (1 reply)

$
0
0
When trying to add the table I get this error


*************THIS IS THE CODE I AM ADDING****************

--
-- Table structure for table `user_board`
--

CREATE TABLE /*$wgDBprefix*/user_board (
`ub_id` int(11) PRIMARY KEY auto_increment,
`ub_user_id` int(11) NOT NULL default '0',
`ub_user_name` varchar(255) NOT NULL default '',
`ub_user_id_from` int(11) NOT NULL default '0',
`ub_user_name_from` varchar(255) NOT NULL default '',
`ub_message` text NOT NULL,
`ub_type` int(5) default '0',
`ub_date` datetime default NULL
) DEFAULT CHARSET=utf8;
CREATE INDEX /*i*/ub_user_id ON /*_*/user_board (ub_user_id),
CREATE INDEX /*i*/ub_user_id_from ON /*_*/user_board (ub_user_id_from),
CREATE INDEX /*i*/ub_type ON /*_*/user_board (ub_type)


*****************THIS IS THE ERROR I AM GETTING**********************

Error
SQL query:

CREATE INDEX /*i*/ub_user_id ON /*_*/user_board(

ub_user_id
),
CREATE INDEX /*i*/ub_user_id_from ON /*_*/user_board(
ub_user_id_from
),
CREATE INDEX /*i*/ub_type ON /*_*/user_board(
ub_type
)
MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
CREATE INDEX ub_user_id_from ON user_board (ub_user_id_from),
CREATE INDEX ub' at line 1

How can I 'attach' a MySQL database ? (13 replies)

$
0
0
hi all ,
i have a database folder which contain a collection of .obt, and .frm files.
How can I go about 'attaching' this db to my local MySQL server ???
i want to attach this database to my local server

any help please

how to move database folder "C:\mysql\data" to another hard disk drive ? (1 reply)

$
0
0
hi all
how to move database folder "C:\mysql\data" to another hard disk drive ? like "d:\mysql\data"

note my database engine is innodb
platform windows
thanks for help

innodb optimzation (1 reply)

$
0
0
i have pc with 64 bit os (window 7 )and my mysql version is mysql-5.1.48-winx64
i have table with four column id int, tagid varchar(45),timestamp datetime,values decimal(18,2)
and i use id as an iinto the table each day ,the records will increase.
so for my testing i take 15 days record in my table that go to 8 million records.
when i use select statement it gives the result in 5mins but i want it within 2 sec
so i 1st start with memory engine but i can't able to create index in memory and the in no improvement in the process.
so i switch to innodb engine.i change the buffer pool size ,log size etc but still
i have the that 5 mins and also i have another problem with the index,it shows a limit in index
when i use explain select * from table where id<=1 and id>=50000, the index are use
but when it goes above 50000 index is not used it fetch the hole table ..
so i through that because of the change in log file size that may happen, so i uninstall the mysql
and reinstall it and i tried again but the same problem is there.
when i use varchar the table_rows keep on change in information shcema
so i delete that cls but still the index use the limit of 50000.
pls helps me i can't understan whats go in my server.pls guide me to finish it

Innodb slower than Myisam (1 reply)

$
0
0
Hi

I have installed mysql5.5 on centos5.5 with ext3 partition. Created database with with 2 tables one with myisam and one with innodb. but innodb seems to be much slower than myisam. Normal select and delete query also giving much difference for innodb....can some one tell me where I am going wrong ??? do i need to do some fine tunning or configuration ???


Regards

Sachin

i need to convert this to phpmyadmin syntax (constraint check ) (1 reply)

$
0
0
hi guys ...
how i can convert this code to phpmyadmin with MySQL client version: 5.0.51a ??

DISC_TYPE VARCHAR2( 20 ) ,
constraint CKC_DISC_TYPE_DISCOUNT check ( DISC_TYPE is null or ( DISC_TYPE in ('High','Medium','Low')))

thank you...

Innodb engine causing Mysql to Refuse Connections (1 reply)

$
0
0
Today Mysql Innodb Data files maxed out. I was attempted to clear out files in order to reduce the size. This my be completely unrelated to the issue, but I thought it would be worth mentioning.

I restarted the computer and now Mysql is refusing all outside connections. Their are no errors in the error log. However, if I disable Innodb it works, but the Innodb is disabled. I need the Innodb working, and the server accepting connections.

"Can't connect to MySQL server on '' (111) [2003]" 111 meaning that its refusing the connections.

Updated mysql, lost my.cnf file (3 replies)

$
0
0
I have a phpbb forum and today i think mysql has updated and now i can't access some of the database tables. I've readed that is all becouse of innodb, i really donno what is that, and that i should replace my.cnf with a old one, but i don't have one.

Interpreting Mysql Innodb Tuning Info (1 reply)

$
0
0
Hi All,

I am currently trying to tweak the mysql config file

A tuning primer utility reported this :-

Hi All,


"TABLE LOCKING


In my schema 99% of the tables are InnoDB however the the remaining 1% is composed of two tables 1 with 300,000 recs and the other has 8 million recs both are increasing exponentially.

This is the result from a perltuning advisor utility.

Current Lock Wait ratio = 1 : 109

You may benefit from selective use of InnoDB.

If you have long running SELECT's against MyISAM tables and perform

frequent updates consider setting 'low_priority_updates=1'

If you have a high concurrency of inserts on Dynamic row-length tables

consider setting 'concurrent_insert=2'."

Please can anyone offer any advise/guidance as to the meaning of this statement.

Many thanks

All Innodb tables using seperate ibd, but ibdata1 still being modified? (3 replies)

$
0
0
I've inherited a large MySQL 5.1 installation with 1000+ InnoDB tables in use across multiple databases.

I pulled out a list of all InnoDB tables from information_schema, and checked to see if those tables had an .ibd file.

Every single one has one. Yet every time there is an update to any of the InnoDB tables the shared ibdata1 still has it's mtime advanced?

Also, md5sums take of ibdata1 over the course of the day show that the values inside the file *are* changing (not the size obviously).

I'd really like to delete the ibdata1 file, but the fact that it is still being touched by MySQL makes me nervous.

Is there a way to proceed that doesn't involve me re-importing all my InnoDB tables "just to be sure"?

Some logical explanation why MySQL is touching the file perhaps?

Thanks for reading!

UPDATE statement locks non-existent row (-1 replies)

Foreign key constraint. (1 reply)

Cheap wholesale best qaulity nfl jerseys from www jersey-style.com (no replies)

$
0
0
NFL Jerseys,MLB Jerseys,NHL Jerseys,NBA Jerseys Wholesale, CHEAP, Accept Paypal! A lot of Stock from www.jersey-style.com

1.Made of 100% Polyester Air knit 190gsm
2. Letters and number are sewn on jerseys body,100% embroidery
3. We can customize your design,Logo and Numbers on backside,size:48 50 52 54.

High-quality jersey for you, If you need to see the quality, we can supply the stock list and details prictures to you.This high quality jersey is made of breathable, quick-drying
Air-Knit polyester for long lasting comfort and durability.

The jersey is decorated in the team colors, has reinforced stitching on the shoulders and arm holes, and proudly displays the intricate embroidered and applique twill team graphics.

If you are interested in it ,Please detailed see every pictures.It will show itself all character for you. It is a good choose for every Gentlewoman.Hope you don't miss it !We also sell other brand goods american football jersey,baseball jersey,soccer jersey,basketall jersey etc,More details please don't hesitate to contact me at: jerseystyle@yahoo.com

PK in decending order (1 reply)

$
0
0
Hello!
I'm a long time user of MyISAM-tables for a large website, and now we are experimenting with converting our tables to InnoDB.

Some of our largest tables (~180 million rows) currently have a PK that is negavite and decreasing for each new row (we mostly fetch rows in reverse insert-order, and back in the days when we started we used MySQL 3.23, and ORDER BY ... DESC was not optimized, so we had to make this trick for performance)

Now with InnoDB, will this cause any problems?
I think, if we use a "negative" primary key in an InnoDB-table and decrease it's value for each new insert, will this lead to performance issues for inserts?

As InnoDB will store the rows in PK order, I guess inserting new records with decreasing value for PK would cause InnoDB to always insert the rows in the beginning of the tablespace.
Will this have a huge impact on performance, and do you recommended us changing this to "normal increasing PK"?

We normally have quite many inserts during normal operation, but at the same time, the server will have plenty of RAM and these tables should fit in memory...

Thanks for any advice!
/Tobias

error dropping database (1 reply)

$
0
0
Hi,

MySQL 5.1.39 on Linux, InnoDB Engine

I was dropping a 500+ GB database and got an error which crashed MySQL. Almost all of the data was in one 2+ million row table. MySQL recovered, but the 2 million row table in the database is now corrupted and I can not drop the table or database.

How can I clean this up and drop the table and database?

before the database drop:
root@mysql-production-pro.jcvi.org clcdb_2> select count(*) from lazy_children ;
+----------+
| count(*) |
+----------+
| 2366753 |
+----------+
1 row in set (14 min 21.48 sec)


Command that failed:
root@mysql-production.jcvi.org (none)> drop database clcdb_2 ;
ERROR 2013 (HY000): Lost connection to MySQL server during query
root@mysql-production.jcvi.org (none)> show processlist ;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql-production.jcvi.org' (111)
ERROR:
Can't connect to the server


Fortunately, MySQL came back up after the crash, but the table/database is now corrupted. In errorlog when I try and drop the table now:

110811 11:20:56 [ERROR] Cannot find or open table clcdb_2/lazy_children from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html
how you can resolve the problem.

here is what is currently in the database directory on the server:

12 -rw-rw---- 1 mysql mysql 8630 Nov 24 2010 lazy_children.frm
12 -rw-rw---- 1 mysql mysql 8694 Nov 25 2010 #sql-b6d_3b908cb.frm
2052 -rw-rw---- 1 mysql mysql 2097152 Nov 25 2010 #sql-b6d_3b908cb.ibd

Errors from errorlog when mysql crashed during the drop database:

110811 11:03:52 InnoDB: Assertion failure in thread 1147169088 in file srv/srv0srv.c line 2137
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
110811 11:03:52 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=67108864
read_buffer_size=4194304
max_used_connections=251
max_threads=650
threads_connected=13
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 13384157 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = (nil) thread_stack 0x30000
/db/mysql/base/bin/mysqld(my_print_stacktrace+0x20) [0xa0a7a8]
/db/mysql/base/bin/mysqld(handle_segfault+0x368) [0x60354c]
/lib64/libpthread.so.0 [0x3b40c0de60]
/db/mysql/base/bin/mysqld(srv_error_monitor_thread+0x2f3) [0x938c3f]
/lib64/libpthread.so.0 [0x3b40c062e7]
/lib64/libc.so.6(clone+0x6d) [0x3b400ce3bd]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
110811 11:04:18 mysqld_safe Number of processes running now: 0
110811 11:04:18 mysqld_safe mysqld restarted
110811 11:04:18 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: Log scan progressed past the checkpoint lsn 6017 2626484087
110811 11:04:21 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: trying to add tablespace 8437 of name './misc_apis/#sql-5d87_133c21.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 8437 of name './misc_apis/@0023sql@002d5d87_133c21.ibd' already exists in the tablespace
InnoDB: memory cache!
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 6017 2631726592
InnoDB: Doing recovery: scanned up to log sequence number 6017 2636969472
InnoDB: Doing recovery: scanned up to log sequence number 6017 2642212352
InnoDB: Doing recovery: scanned up to log sequence number 6017 2647455232
InnoDB: Doing recovery: scanned up to log sequence number 6017 2652698112
InnoDB: Doing recovery: scanned up to log sequence number 6017 2657940992
InnoDB: Doing recovery: scanned up to log sequence number 6017 2663183872
InnoDB: Doing recovery: scanned up to log sequence number 6017 2668426752
InnoDB: Doing recovery: scanned up to log sequence number 6017 2673669632
InnoDB: Doing recovery: scanned up to log sequence number 6017 2678912512
InnoDB: Doing recovery: scanned up to log sequence number 6017 2684155392
InnoDB: Doing recovery: scanned up to log sequence number 6017 2689398272
InnoDB: Doing recovery: scanned up to log sequence number 6017 2694641152
InnoDB: Doing recovery: scanned up to log sequence number 6017 2699884032
InnoDB: Doing recovery: scanned up to log sequence number 6017 2705126912
InnoDB: Doing recovery: scanned up to log sequence number 6017 2710369792
InnoDB: Doing recovery: scanned up to log sequence number 6017 2715612672
InnoDB: Doing recovery: scanned up to log sequence number 6017 2720855552
InnoDB: Doing recovery: scanned up to log sequence number 6017 2726098432
InnoDB: Doing recovery: scanned up to log sequence number 6017 2731341312
InnoDB: Doing recovery: scanned up to log sequence number 6017 2736584192
InnoDB: Doing recovery: scanned up to log sequence number 6017 2741827072
InnoDB: Doing recovery: scanned up to log sequence number 6017 2747069952
InnoDB: Doing recovery: scanned up to log sequence number 6017 2749799344
110811 11:05:26 InnoDB: Error: table 'misc_apis/#sql-5d87_133c21'
InnoDB: in InnoDB data dictionary has tablespace id 8422,
InnoDB: but tablespace with that id or name does not exist. Have
InnoDB: you deleted or moved .ibd files?
InnoDB: This may also be a table created with CREATE TEMPORARY TABLE
InnoDB: whose .ibd and .frm files MySQL automatically removed, but the
InnoDB: table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
110811 11:05:26 InnoDB: Error: table 'misc_apis/#sql-6dc9_15eaf1'
InnoDB: in InnoDB data dictionary has tablespace id 8393,
InnoDB: but tablespace with that id or name does not exist. Have
InnoDB: you deleted or moved .ibd files?
InnoDB: This may also be a table created with CREATE TEMPORARY TABLE
InnoDB: whose .ibd and .frm files MySQL automatically removed, but the
InnoDB: table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
110811 11:05:26 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Last MySQL binlog file position 0 238867296, file name ./mysql-bin.000017
110811 11:05:29 InnoDB: Started; log sequence number 6017 2749799344
110811 11:05:29 [ERROR] /db/mysql/base/bin/mysqld: Table './mysql/event' is marked as crashed and should be repaired
110811 11:05:29 [Warning] Checking table: './mysql/event'
110811 11:05:29 [ERROR] 1 client is using or hasn't closed the table properly
110811 11:05:29 [Note] Event Scheduler: Loaded 4 events
110811 11:05:29 [Note] /db/mysql/base/bin/mysqld: ready for connections.
Version: '5.1.39-log' socket: '/db/mysql/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
110811 11:05:29 [Note] Event Scheduler: scheduler thread started with id 1

Thank you!
Angel Tirone
Viewing all 1954 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>