~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/database_ms.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:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * Original author: Paul McCullagh
20
20
 * Continued development: Barry Leslie
545
545
        push_(file);
546
546
        if ((repo = file->myRepo)) {
547
547
                if (repo->isRemovingFP) {
548
 
                        repo->removeRepoFile(RETAIN(file));
 
548
                        repo->removeRepoFile(file);
549
549
                        myRepostoryList->wakeup();
550
550
                }
551
551
                else
552
 
                        repo->returnRepoFile(RETAIN(file));
 
552
                        repo->returnRepoFile(file);
553
553
                repo->release(); /* [++] here is the release.  */
554
554
        }
555
555
        release_(file);
1076
1076
                                                int len = ptr - dir_name;
1077
1077
                                                ptr++;
1078
1078
                                                if ((strtoul(ptr, NULL, 10) == db_id) && len) {
1079
 
                                                        db = getDatabase(CSString::newString(dir_name, len), true);
 
1079
                                                        db = getDatabase(CSCString::newString(dir_name, len), true);
1080
1080
                                                        ASSERT(db->myDatabaseID == db_id);
1081
1081
                                                }
1082
1082
                                        }
1597
1597
                        gDatabaseList->remove(doomedDatabase->getKey());
1598
1598
                if (!self->myMustQuit) 
1599
1599
                        unlock_(gDatabaseList); 
1600
 
                ASSERT(doomedDatabase->getRefCount() == 1);
 
1600
                ASSERT(doomedDatabase->iRefCount == 1);
1601
1601
                release_(doomedDatabase);
1602
1602
                
1603
1603
        } else {