~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-11 09:18:19 UTC
  • mfrom: (2395 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2396.
  • Revision ID: olafvdspek@gmail.com-20110811091819-em9vnmtco1zt6uvm
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
static buffer_pool_constraint innobase_buffer_pool_size;
184
184
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
185
185
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
 
186
typedef constrained_check<uint32_t,
 
187
                          (1 << UNIV_PAGE_SIZE_SHIFT_MAX),
 
188
                                (1 << 12)> page_size_constraint;
 
189
static page_size_constraint innobase_page_size;
 
190
typedef constrained_check<uint32_t,
 
191
                          (1 << UNIV_PAGE_SIZE_SHIFT_MAX),
 
192
                                (1 << 9)> log_block_size_constraint;
 
193
static log_block_size_constraint innobase_log_block_size;
186
194
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
187
195
static io_capacity_constraint innodb_io_capacity;
188
196
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
2218
2226
  }
2219
2227
#endif /* UNIV_DEBUG */
2220
2228
 
 
2229
  srv_page_size = 0;
 
2230
  srv_page_size_shift = 0;
 
2231
 
 
2232
  uint32_t page_size = innobase_page_size.get();
 
2233
  uint32_t log_block_size = innobase_log_block_size.get();
 
2234
 
 
2235
  if (innobase_page_size != (1 << 14)) {
 
2236
    uint n_shift;
 
2237
 
 
2238
    errmsg_printf(error::WARN,
 
2239
                  "InnoDB: Warning: innodb_page_size has been changed from default value 16384. (###EXPERIMENTAL### operation)\n");
 
2240
    for (n_shift = 12; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) {
 
2241
      if (innobase_page_size == (1UL << n_shift)) {
 
2242
        srv_page_size_shift = n_shift;
 
2243
        srv_page_size = (1 << srv_page_size_shift);
 
2244
        errmsg_printf(error::WARN,
 
2245
                      "InnoDB: The universal page size of the database is set to %lu.\n",
 
2246
                      srv_page_size);
 
2247
        break;
 
2248
      }
 
2249
    }
 
2250
  } else {
 
2251
    srv_page_size_shift = 14;
 
2252
    srv_page_size = (1 << srv_page_size_shift);
 
2253
  }
 
2254
 
 
2255
  if (!srv_page_size_shift) {
 
2256
    errmsg_printf(error::ERROR,
 
2257
                  "InnoDB: Error: %"PRIu32" is not a valid value for innodb_page_size.\n"
 
2258
                  "InnoDB: Error: Valid values are 4096, 8192, and 16384 (default=16384).\n",
 
2259
                  page_size);
 
2260
    goto error;
 
2261
  }
 
2262
 
 
2263
  srv_log_block_size = 0;
 
2264
  if (log_block_size != (1 << 9)) { /*!=512*/
 
2265
    uint        n_shift;
 
2266
 
 
2267
    errmsg_printf(error::WARN,
 
2268
                  "InnoDB: Warning: innodb_log_block_size has been changed from default value 512. (###EXPERIMENTAL### operation)\n");
 
2269
    for (n_shift = 9; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) {
 
2270
      if (log_block_size == (1UL << n_shift)) {
 
2271
        srv_log_block_size = (1 << n_shift);
 
2272
        errmsg_printf(error::WARN, "InnoDB: The log block size is set to %"PRIu32".\n",
 
2273
                      srv_log_block_size);
 
2274
        break;
 
2275
      }
 
2276
    }
 
2277
  } else {
 
2278
    srv_log_block_size = 512;
 
2279
  }
 
2280
 
 
2281
  if (!srv_log_block_size) {
 
2282
    errmsg_printf(error::ERROR,
 
2283
                  "InnoDB: Error: %"PRIu32" is not a valid value for innodb_log_block_size.\n"
 
2284
                  "InnoDB: Error: A valid value for innodb_log_block_size is\n"
 
2285
                  "InnoDB: Error: a power of 2 from 512 to 16384.\n",
 
2286
                  log_block_size);
 
2287
    goto error;
 
2288
  }
 
2289
 
2221
2290
  os_innodb_umask = (ulint)internal::my_umask;
2222
2291
 
2223
2292
 
2495
2564
                                                  innodb_file_format_max_validate));
2496
2565
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2497
2566
  context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
 
2567
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("page_size", innobase_page_size));
 
2568
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_block_size", innobase_log_block_size));
2498
2569
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("flush_log_at_trx_commit",
2499
2570
                                                  innodb_flush_log_at_trx_commit));
2500
2571
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
6269
6340
      | DICT_TF_COMPACT
6270
6341
      | DICT_TF_FORMAT_ZIP
6271
6342
      << DICT_TF_FORMAT_SHIFT;
6272
 
#if DICT_TF_ZSSIZE_MAX < 1
6273
 
# error "DICT_TF_ZSSIZE_MAX < 1"
6274
 
#endif
6275
6343
 
6276
6344
    if (strict_mode)
6277
6345
    {
9341
9409
  context("log-file-size",
9342
9410
          po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9343
9411
          "The size of the buffer which InnoDB uses to write log to the log files on disk.");
 
9412
  context("page-size",
 
9413
          po::value<page_size_constraint>(&innobase_page_size)->default_value(1 << 14),
 
9414
          "###EXPERIMENTAL###: The universal page size of the database. Changing for created database is not supported. Use on your own risk!");
 
9415
  context("log-block-size",
 
9416
          po::value<log_block_size_constraint>(&innobase_log_block_size)->default_value(1 << 9),
 
9417
          "###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!");
9344
9418
  context("log-files-in-group",
9345
9419
          po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9346
9420
          "Number of log files in the log group. InnoDB writes to the files in a circular fashion.");