~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/transaction_log.h

  • Committer: Stewart Smith
  • Date: 2010-08-12 16:48:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: stewart@flamingspork.com-20100812164846-s9bhy47g60bvqs41
bug lp:611379 Equivalent queries with Impossible where return different results

The following two equivalent queries return different results in maria 5.2 and 5.3 (and identical results in mysql 5.5.5) :

SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` ;

SELECT * FROM ( SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` );

MariaDB returns 0 on the second query and NULL on the first, whereas MySQL returns NULL on both. In MariaDB, both EXPLAIN plans agree that "Impossible WHERE noticed after reading const tables"



We have some slightly different output in drizzle:

main.bug_lp611379 [ fail ]
drizzletest: At line 9: query 'explain select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a)
as t' failed: 1048: Column 'sum(distinct t1.a)' cannot be null

but the fix gets us the correct query results, although with slightly different execution plans.



This fix is directly ported from MariaDB.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    ONLINE,
62
62
    WRITING
63
63
  };
64
 
  static const uint32_t FLUSH_FREQUENCY_OS= 0; ///< Rely on operating system to sync log file
65
 
  static const uint32_t FLUSH_FREQUENCY_EVERY_WRITE= 1; //< Sync on every write to the log file
66
 
  static const uint32_t FLUSH_FREQUENCY_EVERY_SECOND= 2; ///< Sync no more than once a second
 
64
  static const uint32_t SYNC_METHOD_OS= 0; ///< Rely on operating system to sync log file
 
65
  static const uint32_t SYNC_METHOD_EVERY_WRITE= 1; //< Sync on every write to the log file
 
66
  static const uint32_t SYNC_METHOD_EVERY_SECOND= 2; ///< Sync no more than once a second
67
67
public:
68
68
  TransactionLog(const std::string in_log_file_path,
69
 
                 uint32_t in_flush_frequency,
 
69
                 uint32_t in_sync_method,
70
70
                 bool in_do_checksum);
71
71
 
72
72
  /** Destructor */
189
189
  void clearError();
190
190
  /**
191
191
   * Helper method which synchronizes/flushes the transaction log file
192
 
   * according to the transaction_log_flush_frequency system variable
 
192
   * according to the transaction_log_sync_method system variable
193
193
   *
194
194
   * @retval
195
195
   *   0 == Success
205
205
  drizzled::atomic<off_t> log_offset; ///< Offset in log file where log will write next command
206
206
  bool has_error; ///< Is the log in error?
207
207
  std::string error_message; ///< Current error message
208
 
  uint32_t flush_frequency; ///< Determines behaviour of syncing log file
209
 
  time_t last_sync_time; ///< Last time the log file was synced (only set in FLUSH_FREQUENCY_EVERY_SECOND)
 
208
  uint32_t sync_method; ///< Determines behaviour of syncing log file
 
209
  time_t last_sync_time; ///< Last time the log file was synced (only set in SYNC_METHOD_EVERY_SECOND)
210
210
  bool do_checksum; ///< Do a CRC32 checksum when writing Transaction message to log?
211
211
};
212
212