MySQL Forums
Forum List  »  MyISAM

Re: MyISAM Index corruption
Posted by: shiraz khalid
Date: April 04, 2006 11:09AM

there are 3 clients that insert records into the DB. After which the data is selected into perl, processed and the timestamp and other entries on the record updated.
> Aha. 1.6 million per day is a lot. A lot of stress
> on the key cache. How many connections are doing
> these inserts?


i will restart the system this evening to get this info and post tomorrow
> You showed one top line only. I would like to see
> two lines. One after restart and one after the
> statement.



but here is a top right after my newest problem which might be the culprit for all these issues which i got while running the query below to figure out the returned rows. i got a "060404 11:37:27 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space"

I think this is whats causing the problem that i am for some reason running out of memory and the data is not being written to the file. although this time, i ran out of memory on a select, it might be the case on an insert/update as well. the table with all the records is

The whole table is about 13G with 27,084,205 million rows and the select was getting only about 826,384 rows and i got the error.
[root@windsor cdrs]# ls -lrth CDRS_TEMP*
-rw-rw---- 1 mysql mysql 12K Mar 28 11:47 CDRS_TEMP.frm
-rw-rw---- 1 mysql mysql 2.7G Apr 4 12:24 CDRS_TEMP.MYI
-rw-rw---- 1 mysql mysql 13G Apr 4 12:24 CDRS_TEMP.MYD


i never see the swap increase or decrease when i ran the query again, so maybe mysql is not able to get to it. any sugesstions? my tmpdir is setup on /tmp and the stats for that are below


[windsor /]# ls -lrt
drwxrwxrwt 8 root root 4096 Apr 4 12:09 tmp
[windsor tmp]# ls -lrt
total 68
drwx------ 2 root root 4096 Nov 22 15:54 ssh-hoIB1673
drwxr-xr-x 2 root root 4096 Feb 2 17:27 file-roller-cfile.21829.0
drwx------ 2 root root 4096 Feb 2 17:56 ssh-drmk1579
-rwxr--r-- 1 root root 44217 Mar 26 00:18 scrollkeeper-tempfile.0
drwx------ 2 root root 8192 Mar 26 03:20 orbit-root
-rw-r--r-- 1 root root 34 Apr 1 12:05 files.tmp
srwxrwxrwx 1 mysql mysql 0 Apr 4 02:33 mysql.sock


windsor> free -o
total used free shared buffers cached
Mem: 5932084 5913784 18300 0 5068 5281448
Swap: 2044072 118228 1925844

+--------------------------+-----------+
| Variable_name | Value |
+--------------------------+-----------+
| key_buffer_size | 268435456 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
+--------------------------+-----------+

windsor> top
11:56:37 up 2 days, 22:51, 2 users, load average: 1.19, 2.97, 3.84
87 processes: 86 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 0.5% 0.0% 0.2% 0.0% 0.0% 49.0% 50.1%
cpu00 1.6% 0.0% 0.0% 0.0% 0.0% 0.0% 98.4%
cpu01 0.2% 0.0% 1.0% 0.0% 0.0% 97.4% 1.4%
cpu02 0.2% 0.0% 0.0% 0.0% 0.0% 0.0% 99.8%
cpu03 0.1% 0.0% 0.1% 0.0% 0.0% 98.6% 0.9%
Mem: 5932084k av, 5914056k used, 18028k free, 0k shrd, 3952k buff
4521964k actv, 563520k in_d, 96340k in_c
Swap: 2044072k av, 118228k used, 1925844k free 5282752k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
2829 root 15 0 15848 7396 932 S 0.3 0.1 9:00 0 X
21140 mysql 15 0 286M 270M 3920 S 0.3 4.6 104:54 2 mysqld
1 root 15 0 484 484 428 S 0.0 0.0 0:08 1 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root RT 0 0 0 0 SW 0.0 0.0 0:00 2 migration/2
5 root RT 0 0 0 0 SW 0.0 0.0 0:00 3 migration/3
6 root 15 0 0 0 0 SW 0.0 0.0 0:00 3 keventd
7 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
8 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd/1
9 root 34 19 0 0 0 SWN 0.0 0.0 0:00 2 ksoftirqd/2
10 root 34 19 0 0 0 SWN 0.0 0.0 0:00 3 ksoftirqd/3
13 root 15 0 0 0 0 SW 0.0 0.0 0:07 3 bdflush
11 root 15 0 0 0 0 SW 0.0 0.0 5:38 1 kswapd
12 root 15 0 0 0 0 SW 0.0 0.0 1:01 3 kscand
14 root 15 0 0 0 0 SW 0.0 0.0 0:15 2 kupdated


explain
SELECT COUNTRY_CODE AS COL1,
DATE_FORMAT(DATE_TIME,'%m-%d-%Y %H') AS COL2,
DISC_CODE, ISDN_CODE, count(*), SUM(PDD), SUM(DURATION),
MAX(DATE_TIME) + INTERVAL 0.0 HOUR
FROM CDRS_TEMP
WHERE DATE_TIME >= '2006-04-02 00:00:00'
AND DATE_TIME < '2006-04-02 23:59:59'
AND COUNTRY_CODE LIKE 'mex%'
AND ORIG_GW LIKE 'pr%'
AND CDR_TYPE = 'end1' GROUP
BY COL1, COL2, DISC_CODE, ISDN_CODE
ORDER BY COL1, COL2 DESC;

+----+-------------+-----------+-------+----------------------------------------------------------------------------+------------+---------+------+--------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+----------------------------------------------------------------------------+------------+---------+------+--------+----------------------------------------------+
| 1 | SIMPLE | CDRS_TEMP | range | INDX_TDATE,INDX_TCDRSYPE,INDX_TORIG_GW,INDX_DATE_TERM_GW,INDX_DATE_ORIG_GW | INDX_TDATE | 8 | NULL | 826384 | Using where; Using temporary; Using filesort |
+----+-------------+-----------+-------+----------------------------------------------------------------------------+------------+---------+------+--------+----------------------------------------------+





> Your select is not a join, but group by and order
> by require a temporary table. Now the question is
> how much data does it return? And how selective is
> your index (or in other words, how many rows are
> rejected from RATEDCDR.SELLID != 'IPSono')?
> What do you mean with "the data return is very
> slow"? That the download rate is bad? Or that it
> takes a while until the download starts? I assume
> the latter, because of GROUP and ORDER.







mysql> show variables;
+---------------------------------+--------------------------------------------------------------------------+
| Variable_name | Value |
+---------------------------------+--------------------------------------------------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /usr/local/mysql-standard-5.0.19-linux-i686-glibc23/ |
| binlog_cache_size | 32768 |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-standard-5.0.19-linux-i686-glibc23/share/mysql/latin1/ |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
| datadir | /usr/local/mysql/data/ |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| div_precision_increment | 4 |
| engine_condition_pushdown | OFF |
| expire_logs_days | 0 |
| flush | OFF |
| flush_time | 0 |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 4 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | (built-in) |
| group_concat_max_len | 1024 |
| have_archive | YES |
| have_bdb | NO |
| have_blackhole_engine | NO |
| have_compress | YES |
| have_crypt | YES |
| have_csv | NO |
| have_example_engine | NO |
| have_federated_engine | NO |
| have_geometry | YES |
| have_innodb | YES |
| have_isam | NO |
| have_ndbcluster | NO |
| have_openssl | NO |
| have_query_cache | YES |
| have_raid | NO |
| have_rtree_keys | YES |
| have_symlink | YES |
| init_connect | |
| init_file | |
| init_slave | |
| innodb_additional_mem_pool_size | 1048576 |
| innodb_autoextend_increment | 8 |
| innodb_buffer_pool_awe_mem_mb | 0 |
| innodb_buffer_pool_size | 8388608 |
| innodb_checksums | ON |
| innodb_commit_concurrency | 0 |
| innodb_concurrency_tickets | 500 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_doublewrite | ON |
| innodb_fast_shutdown | 1 |
| innodb_file_io_threads | 4 |
| innodb_file_per_table | OFF |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_flush_method | |
| innodb_force_recovery | 0 |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_arch_dir | |
| innodb_log_archive | OFF |
| innodb_log_buffer_size | 1048576 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_max_dirty_pages_pct | 90 |
| innodb_max_purge_lag | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_open_files | 300 |
| innodb_support_xa | ON |
| innodb_sync_spin_loops | 20 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 0 |
| innodb_thread_sleep_delay | 10000 |
| interactive_timeout | 1800 |
| join_buffer_size | 131072 |
| key_buffer_size | 268435456 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| language | /usr/local/mysql-standard-5.0.19-linux-i686-glibc23/share/mysql/english/ |
| large_files_support | ON |
| large_page_size | 0 |
| large_pages | OFF |
| license | GPL |
| local_infile | ON |
| locked_in_memory | OFF |
| log | OFF |
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_error | |
| log_slave_updates | OFF |
| log_slow_queries | ON |
| log_warnings | 1 |
| long_query_time | 10 |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 1047552 |
| max_binlog_cache_size | 4294967295 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 100 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20 |
| max_join_size | 18446744073709551615 |
| max_length_for_sort_data | 1024 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 4294967295 |
| max_sort_length | 1024 |
| max_sp_recursion_depth | 0 |
| max_tmp_tables | 32 |
| max_user_connections | 0 |
| max_write_lock_count | 4294967295 |
| multi_range_count | 256 |
| myisam_data_pointer_size | 6 |
| myisam_max_sort_file_size | 2147483647 |
| myisam_recover_options | OFF |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 67108864 |
| myisam_stats_method | nulls_unequal |
| net_buffer_length | 16384 |
| net_read_timeout | 30 |
| net_retry_count | 10 |
| net_write_timeout | 60 |
| new | OFF |
| old_passwords | ON |
| open_files_limit | 1024 |
| optimizer_prune_level | 1 |
| optimizer_search_depth | 62 |
| pid_file | /usr/local/mysql/data/windsor.ipsono.com.pid |
| port | 3306 |
| preload_buffer_size | 32768 |
| protocol_version | 10 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| query_prealloc_size | 8192 |
| range_alloc_block_size | 2048 |
| read_buffer_size | 1044480 |
| read_only | OFF |
| read_rnd_buffer_size | 4190208 |
| relay_log_purge | ON |
| relay_log_space_limit | 0 |
| rpl_recovery_rank | 0 |
| secure_auth | OFF |
| server_id | 1 |
| skip_external_locking | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_compressed_protocol | OFF |
| slave_load_tmpdir | /tmp/ |
| slave_net_timeout | 3600 |
| slave_skip_errors | OFF |
| slave_transaction_retries | 10 |
| slow_launch_time | 2 |
| socket | /tmp/mysql.sock |
| sort_buffer_size | 1048568 |
| sql_mode | |
| sql_notes | ON |
| sql_warnings | ON |
| storage_engine | MyISAM |
| sync_binlog | 0 |
| sync_frm | ON |
| sync_replication | 0 |
| sync_replication_slave_id | 0 |
| sync_replication_timeout | 10 |
| system_time_zone | CDT |
| table_cache | 256 |
| table_lock_wait_timeout | 50 |
| table_type | MyISAM |
| thread_cache_size | 8 |
| thread_stack | 196608 |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| timed_mutexes | OFF |
| tmp_table_size | 33554432 |
| tmpdir | /tmp |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| updatable_views_with_limit | YES |
| version | 5.0.19-standard-log |
| version_comment | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
| wait_timeout | 1800 |
+---------------------------------+--------------------------------------------------------------------------+



Edited 2 time(s). Last edit at 04/04/2006 11:26AM by shiraz khalid.

Options: ReplyQuote


Subject
Views
Written By
Posted
2827
April 03, 2006 01:27AM
1905
April 03, 2006 07:31AM
1796
April 03, 2006 09:04AM
1887
April 04, 2006 03:50AM
Re: MyISAM Index corruption
1764
April 04, 2006 11:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.