Details

    Description

      Using default settings, I got the following error, once the DB reached 250 GB:

      2017-10-10  7:31:56 140711626262272 [ERROR] LibRocksDB:[/opt/slapgrid/7c3e140d2be16dd0fc4001874fc875be/parts/mariadb__compile__/mariadb-10.2.9/storage/rocksdb/rocksdb/db/compaction_job.cc:1240] [default] [JOB 13239] OpenCompactionOutputFiles for table #28903 fails at NewWritableFile with status IO error: While open a file for appending: ./.rocksdb/028903.sst: Too many open files
      2017-10-10  7:31:56 140711626262272 [ERROR] LibRocksDB:[/opt/slapgrid/7c3e140d2be16dd0fc4001874fc875be/parts/mariadb__compile__/mariadb-10.2.9/storage/rocksdb/rocksdb/db/db_impl_compaction_flush.cc:1335] Waiting after background compaction error: IO error: While open a file for appending: ./.rocksdb/028903.sst: Too many open files, Accumulated background error counts: 1
      mysqld: /opt/slapgrid/7c3e140d2be16dd0fc4001874fc875be/parts/mariadb__compile__/mariadb-10.2.9/storage/rocksdb/rocksdb/db/db_impl.cc:710: void rocksdb::DBImpl::MarkLogsSynced(uint64_t, bool, const rocksdb::Status&): Assertion `log.getting_synced' failed.
      171010  7:31:57 [ERROR] mysqld got signal 6 ;
      

      I increased limits so that it can reach 6 TB:

      • rocksdb_max_open_files = 32768
      • rocksdb_merge_buf_size = 256M

      However, RocksDB continues to split the DB in files of 64 MB so I'm not sure I changed the correct variable.

      Anyway, we think that RocksDB should adapt automatically as the DB grows.

      edit: Increasing rocksdb_max_open_files does nothing if open_files_limit is not also increased. Maybe one of them should be calculated automatically from the other.

      Attachments

        Issue Links

          Activity

            anikitin Andrii Nikitin (Inactive) added a comment - - edited

            In my understanding no matter how we try to auto-adjust rocksdb_open_files_limit - there will be practical situations where IO attempt will receive errno: 24.
            And the Engine must survive that error, e.g. just returning user error the same way when Server fails to open .frm file.

            So I suggest looking at auto-adjustment of rocksdb_open_files_limit in another ticket.
            AFAIK current formula for adjusting table_open_cache and max_connections is something like :
            open_files_limit > 9 + 2*table_open_cache + max_connections

            That comes with assumption that for 100 open MyISAM tables and 50 simultaneous connections server will need at least 2*100+50 file descriptors. (both .MYI and .MYD files are counted).
            In my understanding RocksDB may be hungry for file descriptors without correlation to neither table_open_cache nor max_connections. (E.g. huge single RocksDB table may be stored in many .sst files).
            So I think we should try to investigate something like :

            long_size_t requested_limit =  9 + 2*configured_table_open_cache + configured_max_connections + configured_rocksdb_open_files_limit ;
            double koefficient = ( requested_limit < open_files_limit ) ? 1 : requested_limit / open_files_limit ;
            table_open_cache=configured_table_open_cache / koefficient;
            max_connections=configured_table_open_cache / koefficient;
            rocksdb_open_files_limits=configured_table_open_cache / koefficient;
            

            anikitin Andrii Nikitin (Inactive) added a comment - - edited In my understanding no matter how we try to auto-adjust rocksdb_open_files_limit - there will be practical situations where IO attempt will receive errno: 24. And the Engine must survive that error, e.g. just returning user error the same way when Server fails to open .frm file. So I suggest looking at auto-adjustment of rocksdb_open_files_limit in another ticket. AFAIK current formula for adjusting table_open_cache and max_connections is something like : open_files_limit > 9 + 2*table_open_cache + max_connections That comes with assumption that for 100 open MyISAM tables and 50 simultaneous connections server will need at least 2*100+50 file descriptors. (both .MYI and .MYD files are counted). In my understanding RocksDB may be hungry for file descriptors without correlation to neither table_open_cache nor max_connections. (E.g. huge single RocksDB table may be stored in many .sst files ). So I think we should try to investigate something like : long_size_t requested_limit = 9 + 2*configured_table_open_cache + configured_max_connections + configured_rocksdb_open_files_limit ; double koefficient = ( requested_limit < open_files_limit ) ? 1 : requested_limit / open_files_limit ; table_open_cache=configured_table_open_cache / koefficient; max_connections=configured_table_open_cache / koefficient; rocksdb_open_files_limits=configured_table_open_cache / koefficient;

            In my understanding no matter how we try to auto-adjust rocksdb_open_files_limit - there will be practical situations where IO attempt will receive errno: 24.

            Well if rocksdb_open_files_limit is sufficiently low and all non-RocksDB file descriptor usage utilizes not more than open_files_limit - rocksdb_open_files_limit descriptors, we should be fine, right?

            And the Engine must survive that error, e.g. just returning user error the same way when Server fails to open .frm file.

            It could actually do better - it could try closing a few files it has open and retry.
            I am not sure about how complex it is implement this, though.

            In my understanding RocksDB may be hungry for file descriptors without correlation to neither table_open_cache nor max_connections. (E.g. huge single RocksDB table may be stored in many .sst files).

            Correct.

            So I think we should try to investigate something like :

            Does this imply that the values of table_open_cache and max_connections should be "auto-magically" adjusted when MyRocks plugin is loaded ?

            psergei Sergei Petrunia added a comment - In my understanding no matter how we try to auto-adjust rocksdb_open_files_limit - there will be practical situations where IO attempt will receive errno: 24. Well if rocksdb_open_files_limit is sufficiently low and all non-RocksDB file descriptor usage utilizes not more than open_files_limit - rocksdb_open_files_limit descriptors, we should be fine, right? And the Engine must survive that error, e.g. just returning user error the same way when Server fails to open .frm file. It could actually do better - it could try closing a few files it has open and retry. I am not sure about how complex it is implement this, though. In my understanding RocksDB may be hungry for file descriptors without correlation to neither table_open_cache nor max_connections. (E.g. huge single RocksDB table may be stored in many .sst files). Correct. So I think we should try to investigate something like : Does this imply that the values of table_open_cache and max_connections should be "auto-magically" adjusted when MyRocks plugin is loaded ?
            psergei Sergei Petrunia added a comment - - edited

            For the record, I was able to reproduce.

            I was loading data (concurrently, without bulk load modes) until the datadir was about 64G, and there were 1048 SST files.

            With that size, the server is not able to start when one is using ulimit -n 512. It fails with a message:

            2017-11-03  9:13:56 140046930872128 [ERROR] LibRocksDB:[/home/ubuntu/mariadb-10.2/storage/
             rocksdb/rocksdb/db/version_set.cc:2624] [default] Error in committing version edit to MANIFEST: 
            ...
            2017-11-03  9:13:56 140046930872128 [ERROR] RocksDB: Error opening instance, Status Code: 5, 
              Status: IO error: While open a file for appending: ./.rocksdb/019884.dbtmp: Too many open files
            

            Then I've started mysqld again under ulimit -n 1200 and continued data loading. Datadir grew to 1108 SST files and 68 G and then the server crashed:

            2017/11/03-12:16:50.546730 7f3cf2907700 [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/flush_job.cc:293] [default] [JOB 297] Level-0 flush table #21189: started
            2017/11/03-12:16:50.546750 7f3cf2907700 [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/flush_job.cc:324] [default] [JOB 297] Level-0 flush table #21189: 0 bytes IO error: While open a file for appending: ./.rocksdb/021189.sst: Too many open files
            2017/11/03-12:16:50.546769 7f3cf2907700 [ERROR] [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/db_impl_compaction_flush.cc:1279] Waiting after background flush error: IO error: While open a file for appending: ./.rocksdb/021189.sst: Too many open filesAccumulated background error counts: 1
            

            Looking at what limits are there by default:

            ubuntu@ip-172-31-26-163:~$ ulimit -n
            1024
            ubuntu@ip-172-31-26-163:~$ ulimit -n -H
            1048576
            

            Started mysqld and examined its /proc/$PID/limits :

            Limit                     Soft Limit           Hard Limit           Units
            Max open files            4162                 4162                 files
            

            That number goes higher if one sets higher open_files_limit.

            I think for the moment we can de-prioritize this bug
            and just add a note to the tuning guide that those who which to have >200G of data need to increase their open_files_limit .
            anikitin any objections?

            psergei Sergei Petrunia added a comment - - edited For the record, I was able to reproduce. I was loading data (concurrently, without bulk load modes) until the datadir was about 64G, and there were 1048 SST files. With that size, the server is not able to start when one is using ulimit -n 512 . It fails with a message: 2017-11-03 9:13:56 140046930872128 [ERROR] LibRocksDB:[/home/ubuntu/mariadb-10.2/storage/ rocksdb/rocksdb/db/version_set.cc:2624] [default] Error in committing version edit to MANIFEST: ... 2017-11-03 9:13:56 140046930872128 [ERROR] RocksDB: Error opening instance, Status Code: 5, Status: IO error: While open a file for appending: ./.rocksdb/019884.dbtmp: Too many open files Then I've started mysqld again under ulimit -n 1200 and continued data loading. Datadir grew to 1108 SST files and 68 G and then the server crashed: 2017/11/03-12:16:50.546730 7f3cf2907700 [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/flush_job.cc:293] [default] [JOB 297] Level-0 flush table #21189: started 2017/11/03-12:16:50.546750 7f3cf2907700 [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/flush_job.cc:324] [default] [JOB 297] Level-0 flush table #21189: 0 bytes IO error: While open a file for appending: ./.rocksdb/021189.sst: Too many open files 2017/11/03-12:16:50.546769 7f3cf2907700 [ERROR] [/home/ubuntu/mariadb-10.2/storage/rocksdb/rocksdb/db/db_impl_compaction_flush.cc:1279] Waiting after background flush error: IO error: While open a file for appending: ./.rocksdb/021189.sst: Too many open filesAccumulated background error counts: 1 Looking at what limits are there by default: ubuntu@ip-172-31-26-163:~$ ulimit -n 1024 ubuntu@ip-172-31-26-163:~$ ulimit -n -H 1048576 Started mysqld and examined its /proc/$PID/limits : Limit Soft Limit Hard Limit Units Max open files 4162 4162 files That number goes higher if one sets higher open_files_limit . I think for the moment we can de-prioritize this bug and just add a note to the tuning guide that those who which to have >200G of data need to increase their open_files_limit . anikitin any objections?
            psergei Sergei Petrunia added a comment - Also asked on MyRocks-Dev: https://groups.google.com/forum/#!topic/myrocks-dev/jp40Sk--CY8
            danblack Daniel Black added a comment - MyRocks fix https://github.com/facebook/mysql-5.6/commit/aac18139d3cffa7b3b9c19d5f9ad2d6c1d6bbbff

            People

              psergei Sergei Petrunia
              jmuchemb Julien Muchembled
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.