From: Jorgen Loland Date: October 12 2011 12:32pm Subject: bzr push into mysql-trunk branch (jorgen.loland:3454 to 3455) WL#5860 List-Archive: http://lists.mysql.com/commits/141395 Message-Id: <20111012123241.B5A7E40A@atum21.no.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3455 Jorgen Loland 2011-10-12 WL#5860: Implement static const variable as function to please compilers on Win and Solaris. modified: sql/handler.cc sql/handler.h 3454 Jorgen Loland 2011-10-12 WL#5860: Windows and Solaris compilers don't like static const member variables. modified: sql/handler.cc sql/handler.h === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-10-12 12:23:18 +0000 +++ b/sql/handler.cc 2011-10-12 12:32:20 +0000 @@ -54,8 +54,6 @@ inline double log2(double x) } #endif -const double Cost_estimate::IO_BLOCK_READ_COST = 1.0; - /* While we have legacy_db_type, we have this array to check for dups and to find handlerton from legacy_db_type. @@ -4619,10 +4617,10 @@ handler::multi_range_read_info_const(uin DBUG_ASSERT(cost->is_zero()); if ((*flags & HA_MRR_INDEX_ONLY) && total_rows > 2) cost->add_io(index_only_read_time(keyno, total_rows) * - Cost_estimate::IO_BLOCK_READ_COST); + Cost_estimate::IO_BLOCK_READ_COST()); else cost->add_io(read_time(keyno, n_ranges, total_rows) * - Cost_estimate::IO_BLOCK_READ_COST); + Cost_estimate::IO_BLOCK_READ_COST()); cost->add_cpu(total_rows * ROW_EVALUATE_COST + 0.01); } return total_rows; @@ -4676,10 +4674,10 @@ ha_rows handler::multi_range_read_info(u /* Produce the same cost as non-MRR code does */ if (*flags & HA_MRR_INDEX_ONLY) cost->add_io(index_only_read_time(keyno, n_rows) * - Cost_estimate::IO_BLOCK_READ_COST); + Cost_estimate::IO_BLOCK_READ_COST()); else cost->add_io(read_time(keyno, n_ranges, n_rows) * - Cost_estimate::IO_BLOCK_READ_COST); + Cost_estimate::IO_BLOCK_READ_COST()); return 0; } @@ -5375,7 +5373,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost } /* Total cost of all index accesses */ index_read_cost= h->index_only_read_time(keynr, rows); - cost->add_io(index_read_cost * Cost_estimate::IO_BLOCK_READ_COST); + cost->add_io(index_read_cost * Cost_estimate::IO_BLOCK_READ_COST()); return FALSE; } @@ -5464,7 +5462,7 @@ void get_sweep_read_cost(TABLE *table, h { cost->add_io(table->file->read_time(table->s->primary_key, (uint)nrows, nrows) * - Cost_estimate::IO_BLOCK_READ_COST); + Cost_estimate::IO_BLOCK_READ_COST()); } else { @@ -5480,7 +5478,7 @@ void get_sweep_read_cost(TABLE *table, h DBUG_PRINT("info",("sweep: nblocks=%g, busy_blocks=%g", n_blocks, busy_blocks)); if (interrupted) - cost->add_io(busy_blocks * Cost_estimate::IO_BLOCK_READ_COST); + cost->add_io(busy_blocks * Cost_estimate::IO_BLOCK_READ_COST()); else /* Assume reading is done in one 'sweep' */ cost->add_io(busy_blocks * === modified file 'sql/handler.h' --- a/sql/handler.h 2011-10-12 12:23:18 +0000 +++ b/sql/handler.h 2011-10-12 12:32:20 +0000 @@ -1070,7 +1070,7 @@ private: public: /// The cost of one I/O operation - static const double IO_BLOCK_READ_COST; + static double IO_BLOCK_READ_COST() { return 1.0; } Cost_estimate() : io_cost(0), No bundle (reason: useless for push emails).