~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_schema.h

  • 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:
23
23
 
24
24
#include <drizzled/statement.h>
25
25
#include <drizzled/message/schema.pb.h>
26
 
#include <uuid/uuid.h>
27
26
 
28
27
namespace drizzled
29
28
{
34
33
 
35
34
class CreateSchema : public Statement
36
35
{
37
 
  bool check(const SchemaIdentifier &identifier);
38
 
 
39
36
public:
40
 
  CreateSchema(Session *in_session) :
41
 
    Statement(in_session),
42
 
    is_if_not_exists(false)
 
37
  CreateSchema(Session *in_session)
 
38
    :
 
39
      Statement(in_session),
 
40
      is_if_not_exists(false)
43
41
  {
44
42
    schema_message.set_creation_timestamp(time(NULL));
45
43
    schema_message.set_update_timestamp(time(NULL));
46
 
 
47
 
    /* 36 characters for uuid string +1 for NULL */
48
 
    uuid_t uu;
49
 
    char uuid_string[37];
50
 
    uuid_generate_random(uu);
51
 
    uuid_unparse(uu, uuid_string);
52
 
    schema_message.set_uuid(uuid_string, 36);
53
 
 
54
 
    schema_message.set_version(1);
55
44
  }
56
45
 
57
46
  bool execute();