Learn about Centmin Mod LEMP Stack today
Become a Member

MariaDB InnoDB: Error: Attempted to open a previously opened tablespace

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by ndha, Apr 13, 2019.

Tags:
  1. ndha

    ndha Member

    83
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    4:22 AM
    1.27
    10.6
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: i.e. 1.15.11
    • PHP Version Installed: i.e. 7.2.17
    • MariaDB MySQL Version Installed: 10.1.38
    • When was last time updated Centmin Mod code base ? : Latest Update run centmin.sh menu option 23 submenu option 2 or cmupdate command
    • Persistent Config: Yes, Standard

    Hi @eva2000
    I got problem like this ini MariaDB error Won't Start
    Code (Text):
    [19:23][root@localhost ~]# journalctl -u mariadb --no-pager -n30
    -- Logs begin at Fri 2019-04-12 10:05:13 WIB, end at Sat 2019-04-13 19:23:32 WIB. --
    Apr 13 19:23:32 localhost mysqld[6370]: It is possible that mysqld could use up to
    Apr 13 19:23:32 localhost mysqld[6370]: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 995543 K  bytes of memory
    Apr 13 19:23:32 localhost mysqld[6370]: Hope that's ok; if not, decrease some variables in the equation.
    Apr 13 19:23:32 localhost mysqld[6370]: Thread pointer: 0x0
    Apr 13 19:23:32 localhost mysqld[6370]: Attempting backtrace. You can use the following information to find out
    Apr 13 19:23:32 localhost mysqld[6370]: where mysqld died. If you see no messages after this, something went
    Apr 13 19:23:32 localhost mysqld[6370]: terribly wrong...
    Apr 13 19:23:32 localhost mysqld[6370]: stack_bottom = 0x0 thread_stack 0x48400
    Apr 13 19:23:32 localhost mysqld[6370]: mysys/stacktrace.c:268(my_print_stacktrace)[0x5638b9284b2e]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/signal_handler.cc:168(handle_fatal_signal)[0x5638b8da7355]
    Apr 13 19:23:32 localhost mysqld[6370]: sigaction.c:0(__restore_rt)[0x7f2d15dfe5d0]
    Apr 13 19:23:32 localhost mysqld[6370]: :0(__GI_raise)[0x7f2d13e9d207]
    Apr 13 19:23:32 localhost mysqld[6370]: :0(__GI_abort)[0x7f2d13e9e8f8]
    Apr 13 19:23:32 localhost mysqld[6370]: fil/fil0fil.cc:5161(fil_load_single_table_tablespaces(unsigned long (*)(char const*, char const*)))[0x5638b91ae29e]
    Apr 13 19:23:32 localhost mysqld[6370]: log/log0recv.cc:3005(recv_init_crash_recovery)[0x5638b904981c]
    Apr 13 19:23:32 localhost mysqld[6370]: log/log0recv.cc:3240(recv_recovery_from_checkpoint_start_func(unsigned long, unsigned long, unsigned long))[0x5638b904a9ef]
    Apr 13 19:23:32 localhost mysqld[6370]: srv/srv0start.cc:2642(innobase_start_or_create_for_mysql())[0x5638b90dcc00]
    Apr 13 19:23:32 localhost mysqld[6370]: handler/ha_innodb.cc:4528(innobase_init(void*))[0x5638b8ff9a0d]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/handler.cc:522(ha_initialize_handlerton(st_plugin_int*))[0x5638b8da9604]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/sql_plugin.cc:1409(plugin_initialize(st_mem_root*, st_plugin_int*, int*, char**, bool))[0x5638b8c2ebb0]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/sql_plugin.cc:1686(plugin_init(int*, char**, int))[0x5638b8c3049a]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/mysqld.cc:5167(init_server_components())[0x5638b8b85611]
    Apr 13 19:23:32 localhost mysqld[6370]: sql/mysqld.cc:5760(mysqld_main(int, char**))[0x5638b8b894c0]
    Apr 13 19:23:32 localhost mysqld[6370]: /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f2d13e893d5]
    Apr 13 19:23:32 localhost mysqld[6370]: /usr/sbin/mysqld(+0x396b5d)[0x5638b8b7cb5d]
    Apr 13 19:23:32 localhost mysqld[6370]: The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
    Apr 13 19:23:32 localhost systemd[1]: mariadb.service: main process exited, code=killed, status=6/ABRT
    Apr 13 19:23:32 localhost systemd[1]: Failed to start MariaDB 10.1.38 database server.
    Apr 13 19:23:32 localhost systemd[1]: Unit mariadb.service entered failed state.
    Apr 13 19:23:32 localhost systemd[1]: mariadb.service failed.
    
    Status: "InnoDB: Error: Attempted to open a previously opened tablespace. Previous tablespace wp181922058db_28389/mng_ewwwio_images uses space ID: 3 at filepath: ./wp181922058db_28389/mng_ewwwio_images.ibd. Cannot open tablespace mysql/gtid_slave_pos which uses space ID: 3 at filepath: ./mysql/gtid_slave_pos.ibd"
    



    Did you know the problem is ??
    Already google fu but seems none works..
    Also already tried all solutions in your MariaDB Tutorial but still won't start..
    Thanks..
     
  2. eva2000

    eva2000 Administrator Staff Member

    59,370
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    7:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    have you ever restored mysql data to the mariadb mysql server ? if you have how was it done ? mysql restore command line ? phpmyadmin import ? or straight database files copy into /var/lib/mysql/databasename directory ? have you recently done any server reboots while mysql was still actively writing data or had data in memory buffers ?

    which tutorial ? Starting fresh with restored backup is best way forward as you won't know the extent of the database corruption. So doing a total mysqldump and data wipe and restore outlined at MariaDB - Insight Guide - How to use mysql_install_db to reset your MySQL database directory may be best - there is still possibility of database corruption depending on how bad the corruption is but it gets you to a running mysql server state at least.
     
  3. ndha

    ndha Member

    83
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    4:22 AM
    1.27
    10.6
    Hi @eva2000
    Yes already restored using latest backup which is before the trouble start..
    Restore using mysql -u command..
    At first it works, but as soon when i check database from PMA, mysql down again and won't start..
    Then i delete the database then restore again using mysql -u command..
    Yes, server reboot when CPU in high process, after that the problem is coming..

    Using your tutor in here MariaDB - Insight Guide - How to use mysql_install_db to reset your MySQL database directory
    but i can't mysqldump from it, so i skip that part then later restore from backup..
    Mysql still won't start sadly..

    show error :
    Code (Text):
    Status: "InnoDB: Error: Attempted to open a previously opened tablespace. Previous tablespace wp181922058db_28389/mng_ewwwio_images uses space ID: 3 at filepath: ./wp181922058db_28389/mng_ewwwio_images.ibd. Cannot open tablespace mysql/gtid_slave_pos which uses space ID: 3 at filepath: ./mysql/gtid_slave_pos.ibd"


    From that error, i already truncated the table that show in error, but it rise again in next tables with same error only change the table name..

    So far i cant mysqldump the latest database even using innodb_force_recovery = 1 or 2 because it always show error like this and so on :
    Code (Text):
    mysqldump: Couldn't execute 'SELECT engine FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE() AND table_name = 'mng_commentmeta'': Lost connection to MySQL server during query (2013)


    Now mysql server running using innodb_force_recovery = 2
    but everytime i try to mysqldump it show error like above..

    Any hints or tutorial that i missed ??
    Thanks a lot..
     
  4. eva2000

    eva2000 Administrator Staff Member

    59,370
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    7:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    that's why you are continuing to have problems probably did you restore just the single database itself or all databases including system mysql database ? if you did not restore all databases on server + system mysql database, you will continue to have same problems and further corrupt your databases to the point of not being able to recover.

    By skipping the full server all database mysqldump and restore, you probably further corrupted your databases too.

    That will cause more problems that it would solve unfortunately.

    If you have working known full backups of your site's mysql databases you can restore from, then you may need to forgo recovery/repair and just do the database file/directory backup and wipe of /var/lib/mysql outlined at MariaDB - Insight Guide - How to use mysql_install_db to reset your MySQL database directory and do a fresh restore of all known working full database backups to the freshly wiped /var/lib/mysql data directory for mysql and/or you probably need to hire a professional for database corruption and recovery.
     
  5. ndha

    ndha Member

    83
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    4:22 AM
    1.27
    10.6
    @eva2000 yes only databases not include system mysql database sadly..
    Cause when i tried to do :
    mkdir -p /home/mysqlbackup
    mysqldump --all-databases > /home/mysqlbackup/alldatabases.sql
    it serve error like i mentions above..
    It just seems mysql down when i perform that mysqldump all databases like you said,
    then UP again because innodb recovery mode, down again if i execute mysqldump..

    I will try again from the scratch..
     
  6. eva2000

    eva2000 Administrator Staff Member

    59,370
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    7:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+