]> git.sur5r.net Git - openldap/commitdiff
Don't check LEAF2 pages for subnodes
authorHoward Chu <hyc@symas.com>
Wed, 2 Jul 2014 14:45:12 +0000 (07:45 -0700)
committerHoward Chu <hyc@symas.com>
Wed, 2 Jul 2014 14:45:12 +0000 (07:45 -0700)
libraries/liblmdb/mdb.c

index 9a8e60c312954c2d04f594b54811699cce4d8c81..6ea9ebc7e63d8b2f56b4742a420621acba9b707c 100644 (file)
@@ -8139,41 +8139,44 @@ mdb_env_cwalk(mdb_copy *my, pgno_t pg)
                unsigned n;
                mp = mc.mc_pg[mc.mc_top];
                n = NUMKEYS(mp);
+
                if (IS_LEAF(mp)) {
-                       for (i=0; i<n; i++) {
-                               ni = NODEPTR(mp, i);
-                               if (ni->mn_flags & F_BIGDATA) {
-                                       MDB_page *omp;
-                                       pgno_t pg;
-                                       memcpy(&pg, NODEDATA(ni), sizeof(pg));
-                                       rc = mdb_page_get(txn, pg, &omp, NULL);
-                                       if (rc)
-                                               goto done;
-                                       if (my->mc_wlen[toggle] >= WBUF) {
+                       if (!IS_LEAF2(mp)) {
+                               for (i=0; i<n; i++) {
+                                       ni = NODEPTR(mp, i);
+                                       if (ni->mn_flags & F_BIGDATA) {
+                                               MDB_page *omp;
+                                               pgno_t pg;
+                                               memcpy(&pg, NODEDATA(ni), sizeof(pg));
+                                               rc = mdb_page_get(txn, pg, &omp, NULL);
+                                               if (rc)
+                                                       goto done;
+                                               if (my->mc_wlen[toggle] >= WBUF) {
+                                                       rc = mdb_env_cthr_toggle(my);
+                                                       if (rc)
+                                                               goto done;
+                                                       toggle ^= 1;
+                                               }
+                                               mo = (MDB_page *)(my->mc_wbuf[toggle] + my->mc_wlen[toggle]);
+                                               memcpy(mo, omp, my->mc_env->me_psize);
+                                               mo->mp_pgno = my->mc_next_pgno;
+                                               my->mc_next_pgno += omp->mp_pages;
+                                               my->mc_wlen[toggle] += my->mc_env->me_psize;
+                                               my->mc_olen[toggle] = my->mc_env->me_psize * (omp->mp_pages - 1);
+                                               my->mc_obuf[toggle] = (char *)omp + my->mc_env->me_psize;
                                                rc = mdb_env_cthr_toggle(my);
                                                if (rc)
                                                        goto done;
                                                toggle ^= 1;
+                                       } else if (ni->mn_flags & F_SUBDATA) {
+                                               MDB_db db;
+                                               memcpy(&db, NODEDATA(ni), sizeof(db));
+                                               my->mc_toggle = toggle;
+                                               rc = mdb_env_cwalk(my, db.md_root);
+                                               if (rc)
+                                                       goto done;
+                                               toggle = my->mc_toggle;
                                        }
-                                       mo = (MDB_page *)(my->mc_wbuf[toggle] + my->mc_wlen[toggle]);
-                                       memcpy(mo, omp, my->mc_env->me_psize);
-                                       mo->mp_pgno = my->mc_next_pgno;
-                                       my->mc_next_pgno += omp->mp_pages;
-                                       my->mc_wlen[toggle] += my->mc_env->me_psize;
-                                       my->mc_olen[toggle] = my->mc_env->me_psize * (omp->mp_pages - 1);
-                                       my->mc_obuf[toggle] = (char *)omp + my->mc_env->me_psize;
-                                       rc = mdb_env_cthr_toggle(my);
-                                       if (rc)
-                                               goto done;
-                                       toggle ^= 1;
-                               } else if (ni->mn_flags & F_SUBDATA) {
-                                       MDB_db db;
-                                       memcpy(&db, NODEDATA(ni), sizeof(db));
-                                       my->mc_toggle = toggle;
-                                       rc = mdb_env_cwalk(my, db.md_root);
-                                       if (rc)
-                                               goto done;
-                                       toggle = my->mc_toggle;
                                }
                        }
                } else {