~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSMd5.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-07-18 03:36:32 UTC
  • mto: (1662.1.4 rollup)
  • mto: This revision was merged to the branch mainline in revision 1664.
  • Revision ID: prafulla_t@users.sourceforge.net-20100718033632-p7q6qtgliqbhe38p
Fix for Bug 592444

There were two problems:
o. In greedy_search optimizer method, best_extension_by_limited search
   maintains join embedding(nestedness) of tables added so far, so that 
   correct(valid)  join order is selected
   These are requirements from nested outer join executioner.
   The problem was, embedding_map was not correctly updated when a table 
   is added to optimal plan outside best_extension_by_limited search, 
   by greedy_search method. We need to update join->cur_embedding_map
   correctly here so that execution plan for other tables get
   generated.
   Invoked checked_interleaving_with_nj from greedy_search on the
   best_table selected. Fixed its prototype to take only one JoinTab
   This is same as mysql 5.1 source tree.
o. The other problem was, join->cur_embedding_map was not restored correctly
   when a table is added to the optimal plan to reflect the current embedding 
   map. 
   Taken good documented method restore_prev_nj_state which restores 
   cur_embedding_map from mysql 5.1 source tree and modified it for drizzled 
   code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
#include <string.h>
56
56
 
57
57
#include "CSDefs.h"
 
58
 
58
59
#include "CSMd5.h"
59
 
#include "CSStrUtil.h"
60
60
 
61
61
#undef BYTE_ORDER       /* 1 = big-endian, -1 = little-endian, 0 = unknown */
62
62
#ifdef ARCH_IS_BIG_ENDIAN
321
321
void
322
322
CSMd5::md5_init()
323
323
{
324
 
        /* Indicates that there is no digest: */
325
 
        digest_cstr[0] = 0;
326
 
 
327
324
    md5_state.count[0] = md5_state.count[1] = 0;
328
325
    md5_state.abcd[0] = 0x67452301;
329
326
    md5_state.abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
342
339
                return;
343
340
        }
344
341
        
 
342
        
345
343
   /* Update the message length. */
346
344
    md5_state.count[1] += nbytes >> 29;
347
345
    md5_state.count[0] += nbits;
370
368
}
371
369
 
372
370
 
373
 
void CSMd5::md5_digest()
 
371
void
 
372
CSMd5::md5_digest(Md5Digest *digest)
374
373
{
375
374
    static const u_char pad[64] = {
376
375
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
389
388
    /* Append the length. */
390
389
    md5_append(data, 8);
391
390
    for (i = 0; i < 16; ++i)
392
 
                digest[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
393
 
 
394
 
        /* Generate the text version: */
395
 
        cs_bin_to_hex(MD5_CHECKSUM_STRING_SIZE, digest_cstr, MD5_CHECKSUM_SIZE, digest);
 
391
                digest->val[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
396
392
}