From 871c5c0175cc579f355202464f9f858b473a9357 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Sep 2004 16:44:25 +0500 Subject: [PATCH 01/34] Fix for bug #5136(Geometry object corrupted after the query) sql/item_geofunc.cc: We should force geometry's charset to be BINARY --- sql/item_geofunc.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 9d58cc37c2a..790fdcd5cd1 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -44,6 +44,7 @@ String *Item_func_geometry_from_text::val_str(String *str) if ((arg_count == 2) && !args[1]->null_value) srid= (uint32)args[1]->val_int(); + str->set_charset(&my_charset_bin); if (str->reserve(SRID_SIZE, 512)) return 0; str->length(0); @@ -71,6 +72,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str) if ((arg_count == 2) && !args[1]->null_value) srid= (uint32)args[1]->val_int(); + str->set_charset(&my_charset_bin); if (str->reserve(SRID_SIZE, 512)) return 0; str->length(0); @@ -180,6 +182,7 @@ String *Item_func_envelope::val_str(String *str) return 0; srid= uint4korr(swkb->ptr()); + str->set_charset(&my_charset_bin); str->length(0); if (str->reserve(SRID_SIZE, 512)) return 0; @@ -202,6 +205,7 @@ String *Item_func_centroid::val_str(String *str) swkb->length() - SRID_SIZE)))) return 0; + str->set_charset(&my_charset_bin); if (str->reserve(SRID_SIZE, 512)) return 0; str->length(0); @@ -232,6 +236,7 @@ String *Item_func_spatial_decomp::val_str(String *str) return 0; srid= uint4korr(swkb->ptr()); + str->set_charset(&my_charset_bin); if (str->reserve(SRID_SIZE, 512)) goto err; str->length(0); @@ -279,6 +284,7 @@ String *Item_func_spatial_decomp_n::val_str(String *str) swkb->length() - SRID_SIZE))))) return 0; + str->set_charset(&my_charset_bin); if (str->reserve(SRID_SIZE, 512)) goto err; srid= uint4korr(swkb->ptr()); @@ -333,6 +339,7 @@ String *Item_func_point::val_str(String *str) str->realloc(1 + 4 + SIZEOF_STORED_DOUBLE*2)))) return 0; + str->set_charset(&my_charset_bin); str->length(0); str->q_append((char)Geometry::wkb_ndr); str->q_append((uint32)Geometry::wkb_point); @@ -358,6 +365,7 @@ String *Item_func_spatial_collection::val_str(String *str) String arg_value; uint i; + str->set_charset(&my_charset_bin); str->length(0); if (str->reserve(1 + 4 + 4, 512)) goto err; From 764ea714f4c22c50bcfefc89cb1bbba951437f58 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Sep 2004 03:33:22 +0200 Subject: [PATCH 02/34] The major change for this changeset is the addition of code to handle: OPTIMIZE TABLE This recompresses the table, thus removing any additional gzip headers caused by opening/closing or flushing the table. mysql-test/r/archive.result: Added optimize test case for archive engine. mysql-test/t/archive.test: Added test case for OPTIMIZE table sql/examples/ha_archive.cc: The big change was the addition of optimize() call to allow tables to be recompressed (so if you have been reading/writing/reading/writing and ending up with larger files then you should, this will solve it). Though adding this feature is going to make it a real headache to add row level locking. Also fixed bug reported by JD where storage engine code was not functioning (this of course was because I didn't check for the propper return value for hash_init). Removed BROKEN_GZIP ifdef since there was no way to enable it. sql/examples/ha_archive.h: Added optimize() method. --- mysql-test/r/archive.result | 1208 +++++++++++++++++++++++++++++++++++ mysql-test/t/archive.test | 2 + sql/examples/ha_archive.cc | 69 +- sql/examples/ha_archive.h | 2 +- 4 files changed, 1267 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index b380ea910de..4adb8a5410e 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -1393,4 +1393,1212 @@ auto fld1 companynr fld3 fld4 fld5 fld6 2 011401 37 breaking dreaded Steinberg W 3 011402 37 Romans scholastics jarring 4 011403 37 intercepted audiology tinily +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize status OK +SELECT * FROM t2; +auto fld1 companynr fld3 fld4 fld5 fld6 +1 000001 00 Omaha teethe neat +2 011401 37 breaking dreaded Steinberg W +3 011402 37 Romans scholastics jarring +4 011403 37 intercepted audiology tinily +5 011501 37 bewilderingly wallet balled +6 011701 37 astound parters persist W +7 011702 37 admonishing eschew attainments +8 011703 37 sumac quitter fanatic +9 012001 37 flanking neat measures FAS +10 012003 37 combed Steinberg rightfulness +11 012004 37 subjective jarring capably +12 012005 37 scatterbrain tinily impulsive +13 012301 37 Eulerian balled starlet +14 012302 36 dubbed persist terminators +15 012303 37 Kane attainments untying +16 012304 37 overlay fanatic announces FAS +17 012305 37 perturb measures featherweight FAS +18 012306 37 goblins rightfulness pessimist FAS +19 012501 37 annihilates capably daughter +20 012602 37 Wotan impulsive decliner FAS +21 012603 37 snatching starlet lawgiver +22 012604 37 concludes terminators stated +23 012605 37 laterally untying readable +24 012606 37 yelped announces attrition +25 012701 37 grazing featherweight cascade FAS +26 012702 37 Baird pessimist motors FAS +27 012703 37 celery daughter interrogate +28 012704 37 misunderstander decliner pests W +29 013601 37 handgun lawgiver stairway +30 013602 37 foldout stated dopers FAS +31 013603 37 mystic readable testicle W +32 013604 37 succumbed attrition Parsifal W +33 013605 37 Nabisco cascade leavings +34 013606 37 fingerings motors postulation W +35 013607 37 aging interrogate squeaking +36 013608 37 afield pests contrasted +37 013609 37 ammonium stairway leftover +38 013610 37 boat dopers whiteners +39 013801 37 intelligibility testicle erases W +40 013802 37 Augustine Parsifal Punjab W +41 013803 37 teethe leavings Merritt +42 013804 37 dreaded postulation Quixotism +43 013901 37 scholastics squeaking sweetish FAS +44 016001 37 audiology contrasted dogging FAS +45 016201 37 wallet leftover scornfully FAS +46 016202 37 parters whiteners bellow +47 016301 37 eschew erases bills +48 016302 37 quitter Punjab cupboard FAS +49 016303 37 neat Merritt sureties FAS +50 016304 37 Steinberg Quixotism puddings +51 018001 37 jarring sweetish tapestry +52 018002 37 tinily dogging fetters +53 018003 37 balled scornfully bivalves +54 018004 37 persist bellow incurring +55 018005 37 attainments bills Adolph +56 018007 37 fanatic cupboard pithed +57 018008 37 measures sureties emergency +58 018009 37 rightfulness puddings Miles +59 018010 37 capably tapestry trimmings +60 018012 37 impulsive fetters tragedies W +61 018013 37 starlet bivalves skulking W +62 018014 37 terminators incurring flint +63 018015 37 untying Adolph flopping W +64 018016 37 announces pithed relaxing FAS +65 018017 37 featherweight emergency offload FAS +66 018018 37 pessimist Miles suites W +67 018019 37 daughter trimmings lists FAS +68 018020 37 decliner tragedies animized FAS +69 018021 37 lawgiver skulking multilayer W +70 018022 37 stated flint standardizes FAS +71 018023 37 readable flopping Judas +72 018024 37 attrition relaxing vacuuming W +73 018025 37 cascade offload dentally W +74 018026 37 motors suites humanness W +75 018027 37 interrogate lists inch W +76 018028 37 pests animized Weissmuller W +77 018029 37 stairway multilayer irresponsibly W +78 018030 37 dopers standardizes luckily FAS +79 018032 37 testicle Judas culled W +80 018033 37 Parsifal vacuuming medical FAS +81 018034 37 leavings dentally bloodbath FAS +82 018035 37 postulation humanness subschema W +83 018036 37 squeaking inch animals W +84 018037 37 contrasted Weissmuller Micronesia +85 018038 37 leftover irresponsibly repetitions +86 018039 37 whiteners luckily Antares +87 018040 37 erases culled ventilate W +88 018041 37 Punjab medical pityingly +89 018042 37 Merritt bloodbath interdependent +90 018043 37 Quixotism subschema Graves FAS +91 018044 37 sweetish animals neonatal +92 018045 37 dogging Micronesia scribbled FAS +93 018046 37 scornfully repetitions chafe W +94 018048 37 bellow Antares honoring +95 018049 37 bills ventilate realtor +96 018050 37 cupboard pityingly elite +97 018051 37 sureties interdependent funereal +98 018052 37 puddings Graves abrogating +99 018053 50 tapestry neonatal sorters +100 018054 37 fetters scribbled Conley +101 018055 37 bivalves chafe lectured +102 018056 37 incurring honoring Abraham +103 018057 37 Adolph realtor Hawaii W +104 018058 37 pithed elite cage +105 018059 36 emergency funereal hushes +106 018060 37 Miles abrogating Simla +107 018061 37 trimmings sorters reporters +108 018101 37 tragedies Conley Dutchman FAS +109 018102 37 skulking lectured descendants FAS +110 018103 37 flint Abraham groupings FAS +111 018104 37 flopping Hawaii dissociate +112 018201 37 relaxing cage coexist W +113 018202 37 offload hushes Beebe +114 018402 37 suites Simla Taoism +115 018403 37 lists reporters Connally +116 018404 37 animized Dutchman fetched FAS +117 018405 37 multilayer descendants checkpoints FAS +118 018406 37 standardizes groupings rusting +119 018409 37 Judas dissociate galling +120 018601 37 vacuuming coexist obliterates +121 018602 37 dentally Beebe traitor +122 018603 37 humanness Taoism resumes FAS +123 018801 37 inch Connally analyzable FAS +124 018802 37 Weissmuller fetched terminator FAS +125 018803 37 irresponsibly checkpoints gritty FAS +126 018804 37 luckily rusting firearm W +127 018805 37 culled galling minima +128 018806 37 medical obliterates Selfridge +129 018807 37 bloodbath traitor disable +130 018808 37 subschema resumes witchcraft W +131 018809 37 animals analyzable betroth W +132 018810 37 Micronesia terminator Manhattanize +133 018811 37 repetitions gritty imprint +134 018812 37 Antares firearm peeked +135 019101 37 ventilate minima swelling +136 019102 37 pityingly Selfridge interrelationships W +137 019103 37 interdependent disable riser +138 019201 37 Graves witchcraft Gandhian W +139 030501 37 neonatal betroth peacock A +140 030502 50 scribbled Manhattanize bee A +141 030503 37 chafe imprint kanji +142 030504 37 honoring peeked dental +143 031901 37 realtor swelling scarf FAS +144 036001 37 elite interrelationships chasm A +145 036002 37 funereal riser insolence A +146 036004 37 abrogating Gandhian syndicate +147 036005 37 sorters peacock alike +148 038001 37 Conley bee imperial A +149 038002 37 lectured kanji convulsion A +150 038003 37 Abraham dental railway A +151 038004 37 Hawaii scarf validate A +152 038005 37 cage chasm normalizes A +153 038006 37 hushes insolence comprehensive +154 038007 37 Simla syndicate chewing +155 038008 37 reporters alike denizen +156 038009 37 Dutchman imperial schemer +157 038010 37 descendants convulsion chronicle +158 038011 37 groupings railway Kline +159 038012 37 dissociate validate Anatole +160 038013 37 coexist normalizes partridges +161 038014 37 Beebe comprehensive brunch +162 038015 37 Taoism chewing recruited +163 038016 37 Connally denizen dimensions W +164 038017 37 fetched schemer Chicana W +165 038018 37 checkpoints chronicle announced +166 038101 37 rusting Kline praised FAS +167 038102 37 galling Anatole employing +168 038103 37 obliterates partridges linear +169 038104 37 traitor brunch quagmire +170 038201 37 resumes recruited western A +171 038202 37 analyzable dimensions relishing +172 038203 37 terminator Chicana serving A +173 038204 37 gritty announced scheduling +174 038205 37 firearm praised lore +175 038206 37 minima employing eventful +176 038208 37 Selfridge linear arteriole A +177 042801 37 disable quagmire disentangle +178 042802 37 witchcraft western cured A +179 046101 37 betroth relishing Fenton W +180 048001 37 Manhattanize serving avoidable A +181 048002 37 imprint scheduling drains A +182 048003 37 peeked lore detectably FAS +183 048004 37 swelling eventful husky +184 048005 37 interrelationships arteriole impelling +185 048006 37 riser disentangle undoes +186 048007 37 Gandhian cured evened +187 048008 37 peacock Fenton squeezes +188 048101 37 bee avoidable destroyer FAS +189 048102 37 kanji drains rudeness +190 048201 37 dental detectably beaner FAS +191 048202 37 scarf husky boorish +192 048203 37 chasm impelling Everhart +193 048204 37 insolence undoes encompass A +194 048205 37 syndicate evened mushrooms +195 048301 37 alike squeezes Alison A +196 048302 37 imperial destroyer externally FAS +197 048303 37 convulsion rudeness pellagra +198 048304 37 railway beaner cult +199 048305 37 validate boorish creek A +200 048401 37 normalizes Everhart Huffman +201 048402 37 comprehensive encompass Majorca FAS +202 048403 37 chewing mushrooms governing A +203 048404 37 denizen Alison gadfly FAS +204 048405 37 schemer externally reassigned FAS +205 048406 37 chronicle pellagra intentness W +206 048407 37 Kline cult craziness +207 048408 37 Anatole creek psychic +208 048409 37 partridges Huffman squabbled +209 048410 37 brunch Majorca burlesque +210 048411 37 recruited governing capped +211 048412 37 dimensions gadfly extracted A +212 048413 37 Chicana reassigned DiMaggio +213 048601 37 announced intentness exclamation FAS +214 048602 37 praised craziness subdirectory +215 048603 37 employing psychic fangs +216 048604 37 linear squabbled buyer A +217 048801 37 quagmire burlesque pithing A +218 050901 37 western capped transistorizing A +219 051201 37 relishing extracted nonbiodegradable +220 056002 37 serving DiMaggio dislocate +221 056003 37 scheduling exclamation monochromatic FAS +222 056004 37 lore subdirectory batting +223 056102 37 eventful fangs postcondition A +224 056203 37 arteriole buyer catalog FAS +225 056204 37 disentangle pithing Remus +226 058003 37 cured transistorizing devices A +227 058004 37 Fenton nonbiodegradable bike A +228 058005 37 avoidable dislocate qualify +229 058006 37 drains monochromatic detained +230 058007 37 detectably batting commended +231 058101 37 husky postcondition civilize +232 058102 37 impelling catalog Elmhurst +233 058103 37 undoes Remus anesthetizing +234 058105 37 evened devices deaf +235 058111 37 squeezes bike Brigham +236 058112 37 destroyer qualify title +237 058113 37 rudeness detained coarse +238 058114 37 beaner commended combinations +239 058115 37 boorish civilize grayness +240 058116 37 Everhart Elmhurst innumerable FAS +241 058117 37 encompass anesthetizing Caroline A +242 058118 37 mushrooms deaf fatty FAS +243 058119 37 Alison Brigham eastbound +244 058120 37 externally title inexperienced +245 058121 37 pellagra coarse hoarder A +246 058122 37 cult combinations scotch W +247 058123 37 creek grayness passport A +248 058124 37 Huffman innumerable strategic FAS +249 058125 37 Majorca Caroline gated +250 058126 37 governing fatty flog +251 058127 37 gadfly eastbound Pipestone +252 058128 37 reassigned inexperienced Dar +253 058201 37 intentness hoarder Corcoran +254 058202 37 craziness scotch flyers A +255 058303 37 psychic passport competitions W +256 058304 37 squabbled strategic suppliers FAS +257 058602 37 burlesque gated skips +258 058603 37 capped flog institutes +259 058604 37 extracted Pipestone troop A +260 058605 37 DiMaggio Dar connective W +261 058606 37 exclamation Corcoran denies +262 058607 37 subdirectory flyers polka +263 060401 36 fangs competitions observations FAS +264 061701 36 buyer suppliers askers +265 066201 36 pithing skips homeless FAS +266 066501 36 transistorizing institutes Anna +267 068001 36 nonbiodegradable troop subdirectories W +268 068002 36 dislocate connective decaying FAS +269 068005 36 monochromatic denies outwitting W +270 068006 36 batting polka Harpy W +271 068007 36 postcondition observations crazed +272 068008 36 catalog askers suffocate +273 068009 36 Remus homeless provers FAS +274 068010 36 devices Anna technically +275 068011 36 bike subdirectories Franklinizations +276 068202 36 qualify decaying considered +277 068302 36 detained outwitting tinnily +278 068303 36 commended Harpy uninterruptedly +279 068401 36 civilize crazed whistled A +280 068501 36 Elmhurst suffocate automate +281 068502 36 anesthetizing provers gutting W +282 068503 36 deaf technically surreptitious +283 068602 36 Brigham Franklinizations Choctaw +284 068603 36 title considered cooks +285 068701 36 coarse tinnily millivolt FAS +286 068702 36 combinations uninterruptedly counterpoise +287 068703 36 grayness whistled Gothicism +288 076001 36 innumerable automate feminine +289 076002 36 Caroline gutting metaphysically W +290 076101 36 fatty surreptitious sanding A +291 076102 36 eastbound Choctaw contributorily +292 076103 36 inexperienced cooks receivers FAS +293 076302 36 hoarder millivolt adjourn +294 076303 36 scotch counterpoise straggled A +295 076304 36 passport Gothicism druggists +296 076305 36 strategic feminine thanking FAS +297 076306 36 gated metaphysically ostrich +298 076307 36 flog sanding hopelessness FAS +299 076402 36 Pipestone contributorily Eurydice +300 076501 36 Dar receivers excitation W +301 076502 36 Corcoran adjourn presumes FAS +302 076701 36 flyers straggled imaginable FAS +303 078001 36 competitions druggists concoct W +304 078002 36 suppliers thanking peering W +305 078003 36 skips ostrich Phelps FAS +306 078004 36 institutes hopelessness ferociousness FAS +307 078005 36 troop Eurydice sentences +308 078006 36 connective excitation unlocks +309 078007 36 denies presumes engrossing W +310 078008 36 polka imaginable Ruth +311 078101 36 observations concoct tying +312 078103 36 askers peering exclaimers +313 078104 36 homeless Phelps synergy +314 078105 36 Anna ferociousness Huey W +315 082101 36 subdirectories sentences merging +316 083401 36 decaying unlocks judges A +317 084001 36 outwitting engrossing Shylock W +318 084002 36 Harpy Ruth Miltonism +319 086001 36 crazed tying hen W +320 086102 36 suffocate exclaimers honeybee FAS +321 086201 36 provers synergy towers +322 088001 36 technically Huey dilutes W +323 088002 36 Franklinizations merging numerals FAS +324 088003 36 considered judges democracy FAS +325 088004 36 tinnily Shylock Ibero- +326 088101 36 uninterruptedly Miltonism invalids +327 088102 36 whistled hen behavior +328 088103 36 automate honeybee accruing +329 088104 36 gutting towers relics A +330 088105 36 surreptitious dilutes rackets +331 088106 36 Choctaw numerals Fischbein W +332 088201 36 cooks democracy phony W +333 088203 36 millivolt Ibero- cross FAS +334 088204 36 counterpoise invalids cleanup +335 088302 37 Gothicism behavior conspirator +336 088303 37 feminine accruing label FAS +337 088305 37 metaphysically relics university +338 088402 37 sanding rackets cleansed FAS +339 088501 36 contributorily Fischbein ballgown +340 088502 36 receivers phony starlet +341 088503 36 adjourn cross aqueous +342 098001 58 straggled cleanup portrayal A +343 098002 58 druggists conspirator despising W +344 098003 58 thanking label distort W +345 098004 58 ostrich university palmed +346 098005 58 hopelessness cleansed faced +347 098006 58 Eurydice ballgown silverware +348 141903 29 excitation starlet assessor +349 098008 58 presumes aqueous spiders +350 098009 58 imaginable portrayal artificially +351 098010 58 concoct despising reminiscence +352 098011 58 peering distort Mexican +353 098012 58 Phelps palmed obnoxious +354 098013 58 ferociousness faced fragile +355 098014 58 sentences silverware apprehensible +356 098015 58 unlocks assessor births +357 098016 58 engrossing spiders garages +358 098017 58 Ruth artificially panty +359 098018 58 tying reminiscence anteater +360 098019 58 exclaimers Mexican displacement A +361 098020 58 synergy obnoxious drovers A +362 098021 58 Huey fragile patenting A +363 098022 58 merging apprehensible far A +364 098023 58 judges births shrieks +365 098024 58 Shylock garages aligning W +366 098025 37 Miltonism panty pragmatism +367 106001 36 hen anteater fevers W +368 108001 36 honeybee displacement reexamines A +369 108002 36 towers drovers occupancies +370 108003 36 dilutes patenting sweats FAS +371 108004 36 numerals far modulators +372 108005 36 democracy shrieks demand W +373 108007 36 Ibero- aligning Madeira +374 108008 36 invalids pragmatism Viennese W +375 108009 36 behavior fevers chillier W +376 108010 36 accruing reexamines wildcats FAS +377 108011 36 relics occupancies gentle +378 108012 36 rackets sweats Angles W +379 108101 36 Fischbein modulators accuracies +380 108102 36 phony demand toggle +381 108103 36 cross Madeira Mendelssohn W +382 108111 50 cleanup Viennese behaviorally +383 108105 36 conspirator chillier Rochford +384 108106 36 label wildcats mirror W +385 108107 36 university gentle Modula +386 108108 50 cleansed Angles clobbering +387 108109 36 ballgown accuracies chronography +388 108110 36 starlet toggle Eskimoizeds +389 108201 36 aqueous Mendelssohn British W +390 108202 36 portrayal behaviorally pitfalls +391 108203 36 despising Rochford verify W +392 108204 36 distort mirror scatter FAS +393 108205 36 palmed Modula Aztecan +394 108301 36 faced clobbering acuity W +395 108302 36 silverware chronography sinking W +396 112101 36 assessor Eskimoizeds beasts FAS +397 112102 36 spiders British Witt W +398 113701 36 artificially pitfalls physicists FAS +399 116001 36 reminiscence verify folksong A +400 116201 36 Mexican scatter strokes FAS +401 116301 36 obnoxious Aztecan crowder +402 116302 36 fragile acuity merry +403 116601 36 apprehensible sinking cadenced +404 116602 36 births beasts alimony A +405 116603 36 garages Witt principled A +406 116701 36 panty physicists golfing +407 116702 36 anteater folksong undiscovered +408 118001 36 displacement strokes irritates +409 118002 36 drovers crowder patriots A +410 118003 36 patenting merry rooms FAS +411 118004 36 far cadenced towering W +412 118005 36 shrieks alimony displease +413 118006 36 aligning principled photosensitive +414 118007 36 pragmatism golfing inking +415 118008 36 fevers undiscovered gainers +416 118101 36 reexamines irritates leaning A +417 118102 36 occupancies patriots hydrant A +418 118103 36 sweats rooms preserve +419 118202 36 modulators towering blinded A +420 118203 36 demand displease interactions A +421 118204 36 Madeira photosensitive Barry +422 118302 36 Viennese inking whiteness A +423 118304 36 chillier gainers pastimes W +424 118305 36 wildcats leaning Edenization +425 118306 36 gentle hydrant Muscat +426 118307 36 Angles preserve assassinated +427 123101 36 accuracies blinded labeled +428 123102 36 toggle interactions glacial A +429 123301 36 Mendelssohn Barry implied W +430 126001 36 behaviorally whiteness bibliographies W +431 126002 36 Rochford pastimes Buchanan +432 126003 36 mirror Edenization forgivably FAS +433 126101 36 Modula Muscat innuendo A +434 126301 36 clobbering assassinated den FAS +435 126302 36 chronography labeled submarines W +436 126402 36 Eskimoizeds glacial mouthful A +437 126601 36 British implied expiring +438 126602 36 pitfalls bibliographies unfulfilled FAS +439 126702 36 verify Buchanan precession +440 128001 36 scatter forgivably nullified +441 128002 36 Aztecan innuendo affects +442 128003 36 acuity den Cynthia +443 128004 36 sinking submarines Chablis A +444 128005 36 beasts mouthful betterments FAS +445 128007 36 Witt expiring advertising +446 128008 36 physicists unfulfilled rubies A +447 128009 36 folksong precession southwest FAS +448 128010 36 strokes nullified superstitious A +449 128011 36 crowder affects tabernacle W +450 128012 36 merry Cynthia silk A +451 128013 36 cadenced Chablis handsomest A +452 128014 36 alimony betterments Persian A +453 128015 36 principled advertising analog W +454 128016 36 golfing rubies complex W +455 128017 36 undiscovered southwest Taoist +456 128018 36 irritates superstitious suspend +457 128019 36 patriots tabernacle relegated +458 128020 36 rooms silk awesome W +459 128021 36 towering handsomest Bruxelles +460 128022 36 displease Persian imprecisely A +461 128023 36 photosensitive analog televise +462 128101 36 inking complex braking +463 128102 36 gainers Taoist true FAS +464 128103 36 leaning suspend disappointing FAS +465 128104 36 hydrant relegated navally W +466 128106 36 preserve awesome circus +467 128107 36 blinded Bruxelles beetles +468 128108 36 interactions imprecisely trumps +469 128202 36 Barry televise fourscore W +470 128203 36 whiteness braking Blackfoots +471 128301 36 pastimes true Grady +472 128302 36 Edenization disappointing quiets FAS +473 128303 36 Muscat navally floundered FAS +474 128304 36 assassinated circus profundity W +475 128305 36 labeled beetles Garrisonian W +476 128307 36 glacial trumps Strauss +477 128401 36 implied fourscore cemented FAS +478 128502 36 bibliographies Blackfoots contrition A +479 128503 36 Buchanan Grady mutations +480 128504 36 forgivably quiets exhibits W +481 128505 36 innuendo floundered tits +482 128601 36 den profundity mate A +483 128603 36 submarines Garrisonian arches +484 128604 36 mouthful Strauss Moll +485 128702 36 expiring cemented ropers +486 128703 36 unfulfilled contrition bombast +487 128704 36 precession mutations difficultly A +488 138001 36 nullified exhibits adsorption +489 138002 36 affects tits definiteness FAS +490 138003 36 Cynthia mate cultivation A +491 138004 36 Chablis arches heals A +492 138005 36 betterments Moll Heusen W +493 138006 36 advertising ropers target FAS +494 138007 36 rubies bombast cited A +495 138008 36 southwest difficultly congresswoman W +496 138009 36 superstitious adsorption Katherine +497 138102 36 tabernacle definiteness titter A +498 138103 36 silk cultivation aspire A +499 138104 36 handsomest heals Mardis +500 138105 36 Persian Heusen Nadia W +501 138201 36 analog target estimating FAS +502 138302 36 complex cited stuck A +503 138303 36 Taoist congresswoman fifteenth A +504 138304 36 suspend Katherine Colombo +505 138401 29 relegated titter survey A +506 140102 29 awesome aspire staffing +507 140103 29 Bruxelles Mardis obtain +508 140104 29 imprecisely Nadia loaded +509 140105 29 televise estimating slaughtered +510 140201 29 braking stuck lights A +511 140701 29 true fifteenth circumference +512 141501 29 disappointing Colombo dull A +513 141502 29 navally survey weekly A +514 141901 29 circus staffing wetness +515 141902 29 beetles obtain visualized +516 142101 29 trumps loaded Tannenbaum +517 142102 29 fourscore slaughtered moribund +518 142103 29 Blackfoots lights demultiplex +519 142701 29 Grady circumference lockings +520 143001 29 quiets dull thugs FAS +521 143501 29 floundered weekly unnerves +522 143502 29 profundity wetness abut +523 148001 29 Garrisonian visualized Chippewa A +524 148002 29 Strauss Tannenbaum stratifications A +525 148003 29 cemented moribund signaled +526 148004 29 contrition demultiplex Italianizes A +527 148005 29 mutations lockings algorithmic A +528 148006 29 exhibits thugs paranoid FAS +529 148007 29 tits unnerves camping A +530 148009 29 mate abut signifying A +531 148010 29 arches Chippewa Patrice W +532 148011 29 Moll stratifications search A +533 148012 29 ropers signaled Angeles A +534 148013 29 bombast Italianizes semblance +535 148023 36 difficultly algorithmic taxed +536 148015 29 adsorption paranoid Beatrice +537 148016 29 definiteness camping retrace +538 148017 29 cultivation signifying lockout +539 148018 29 heals Patrice grammatic +540 148019 29 Heusen search helmsman +541 148020 29 target Angeles uniform W +542 148021 29 cited semblance hamming +543 148022 29 congresswoman taxed disobedience +544 148101 29 Katherine Beatrice captivated A +545 148102 29 titter retrace transferals A +546 148201 29 aspire lockout cartographer A +547 148401 29 Mardis grammatic aims FAS +548 148402 29 Nadia helmsman Pakistani +549 148501 29 estimating uniform burglarized FAS +550 148502 29 stuck hamming saucepans A +551 148503 29 fifteenth disobedience lacerating A +552 148504 29 Colombo captivated corny +553 148601 29 survey transferals megabytes FAS +554 148602 29 staffing cartographer chancellor +555 150701 29 obtain aims bulk A +556 152101 29 loaded Pakistani commits A +557 152102 29 slaughtered burglarized meson W +558 155202 36 lights saucepans deputies +559 155203 29 circumference lacerating northeaster A +560 155204 29 dull corny dipole +561 155205 29 weekly megabytes machining 0 +562 156001 29 wetness chancellor therefore +563 156002 29 visualized bulk Telefunken +564 156102 29 Tannenbaum commits salvaging +565 156301 29 moribund meson Corinthianizes A +566 156302 29 demultiplex deputies restlessly A +567 156303 29 lockings northeaster bromides +568 156304 29 thugs dipole generalized A +569 156305 29 unnerves machining mishaps +570 156306 29 abut therefore quelling +571 156501 29 Chippewa Telefunken spiritual A +572 158001 29 stratifications salvaging beguiles FAS +573 158002 29 signaled Corinthianizes Trobriand FAS +574 158101 29 Italianizes restlessly fleeing A +575 158102 29 algorithmic bromides Armour A +576 158103 29 paranoid generalized chin A +577 158201 29 camping mishaps provers A +578 158202 29 signifying quelling aeronautic A +579 158203 29 Patrice spiritual voltage W +580 158204 29 search beguiles sash +581 158301 29 Angeles Trobriand anaerobic A +582 158302 29 semblance fleeing simultaneous A +583 158303 29 taxed Armour accumulating A +584 158304 29 Beatrice chin Medusan A +585 158305 29 retrace provers shouted A +586 158306 29 lockout aeronautic freakish +587 158501 29 grammatic voltage index FAS +588 160301 29 helmsman sash commercially +589 166101 50 uniform anaerobic mistiness A +590 166102 50 hamming simultaneous endpoint +591 168001 29 disobedience accumulating straight A +592 168002 29 captivated Medusan flurried +593 168003 29 transferals shouted denotative A +594 168101 29 cartographer freakish coming FAS +595 168102 29 aims index commencements FAS +596 168103 29 Pakistani commercially gentleman +597 168104 29 burglarized mistiness gifted +598 168202 29 saucepans endpoint Shanghais +599 168301 29 lacerating straight sportswriting A +600 168502 29 corny flurried sloping A +601 168503 29 megabytes denotative navies +602 168601 29 chancellor coming leaflet A +603 173001 40 bulk commencements shooter +604 173701 40 commits gentleman Joplin FAS +605 173702 40 meson gifted babies +606 176001 40 deputies Shanghais subdivision FAS +607 176101 40 northeaster sportswriting burstiness W +608 176201 40 dipole sloping belted FAS +609 176401 40 machining navies assails FAS +610 176501 40 therefore leaflet admiring W +611 176601 40 Telefunken shooter swaying 0 +612 176602 40 salvaging Joplin Goldstine FAS +613 176603 40 Corinthianizes babies fitting +614 178001 40 restlessly subdivision Norwalk W +615 178002 40 bromides burstiness weakening W +616 178003 40 generalized belted analogy FAS +617 178004 40 mishaps assails deludes +618 178005 40 quelling admiring cokes +619 178006 40 spiritual swaying Clayton +620 178007 40 beguiles Goldstine exhausts +621 178008 40 Trobriand fitting causality +622 178101 40 fleeing Norwalk sating FAS +623 178102 40 Armour weakening icon +624 178103 40 chin analogy throttles +625 178201 40 provers deludes communicants FAS +626 178202 40 aeronautic cokes dehydrate FAS +627 178301 40 voltage Clayton priceless FAS +628 178302 40 sash exhausts publicly +629 178401 40 anaerobic causality incidentals FAS +630 178402 40 simultaneous sating commonplace +631 178403 40 accumulating icon mumbles +632 178404 40 Medusan throttles furthermore W +633 178501 40 shouted communicants cautioned W +634 186002 37 freakish dehydrate parametrized A +635 186102 37 index priceless registration A +636 186201 40 commercially publicly sadly FAS +637 186202 40 mistiness incidentals positioning +638 186203 40 endpoint commonplace babysitting +639 186302 37 straight mumbles eternal A +640 188007 37 flurried furthermore hoarder +641 188008 37 denotative cautioned congregates +642 188009 37 coming parametrized rains +643 188010 37 commencements registration workers W +644 188011 37 gentleman sadly sags A +645 188012 37 gifted positioning unplug W +646 188013 37 Shanghais babysitting garage A +647 188014 37 sportswriting eternal boulder A +648 188015 37 sloping hoarder hollowly A +649 188016 37 navies congregates specifics +650 188017 37 leaflet rains Teresa +651 188102 37 shooter workers Winsett +652 188103 37 Joplin sags convenient A +653 188202 37 babies unplug buckboards FAS +654 188301 40 subdivision garage amenities +655 188302 40 burstiness boulder resplendent FAS +656 188303 40 belted hollowly priding FAS +657 188401 37 assails specifics configurations +658 188402 37 admiring Teresa untidiness A +659 188503 37 swaying Winsett Brice W +660 188504 37 Goldstine convenient sews FAS +661 188505 37 fitting buckboards participated +662 190701 37 Norwalk amenities Simon FAS +663 190703 50 weakening resplendent certificates +664 191701 37 analogy priding Fitzpatrick +665 191702 37 deludes configurations Evanston A +666 191703 37 cokes untidiness misted +667 196001 37 Clayton Brice textures A +668 196002 37 exhausts sews save +669 196003 37 causality participated count +670 196101 37 sating Simon rightful A +671 196103 37 icon certificates chaperone +672 196104 37 throttles Fitzpatrick Lizzy A +673 196201 37 communicants Evanston clenched A +674 196202 37 dehydrate misted effortlessly +675 196203 37 priceless textures accessed +676 198001 37 publicly save beaters A +677 198003 37 incidentals count Hornblower FAS +678 198004 37 commonplace rightful vests A +679 198005 37 mumbles chaperone indulgences FAS +680 198006 37 furthermore Lizzy infallibly A +681 198007 37 cautioned clenched unwilling FAS +682 198008 37 parametrized effortlessly excrete FAS +683 198009 37 registration accessed spools A +684 198010 37 sadly beaters crunches FAS +685 198011 37 positioning Hornblower overestimating FAS +686 198012 37 babysitting vests ineffective +687 198013 37 eternal indulgences humiliation A +688 198014 37 hoarder infallibly sophomore +689 198015 37 congregates unwilling star +690 198017 37 rains excrete rifles +691 198018 37 workers spools dialysis +692 198019 37 sags crunches arriving +693 198020 37 unplug overestimating indulge +694 198021 37 garage ineffective clockers +695 198022 37 boulder humiliation languages +696 198023 50 hollowly sophomore Antarctica A +697 198024 37 specifics star percentage +698 198101 37 Teresa rifles ceiling A +699 198103 37 Winsett dialysis specification +700 198105 37 convenient arriving regimented A +701 198106 37 buckboards indulge ciphers +702 198201 37 amenities clockers pictures A +703 198204 37 resplendent languages serpents A +704 198301 53 priding Antarctica allot A +705 198302 53 configurations percentage realized A +706 198303 53 untidiness ceiling mayoral A +707 198304 53 Brice specification opaquely A +708 198401 37 sews regimented hostess FAS +709 198402 37 participated ciphers fiftieth +710 198403 37 Simon pictures incorrectly +711 202101 37 certificates serpents decomposition FAS +712 202301 37 Fitzpatrick allot stranglings +713 202302 37 Evanston realized mixture FAS +714 202303 37 misted mayoral electroencephalography FAS +715 202304 37 textures opaquely similarities FAS +716 202305 37 save hostess charges W +717 202601 37 count fiftieth freest FAS +718 202602 37 rightful incorrectly Greenberg FAS +719 202605 37 chaperone decomposition tinting +720 202606 37 Lizzy stranglings expelled W +721 202607 37 clenched mixture warm +722 202901 37 effortlessly electroencephalography smoothed +723 202902 37 accessed similarities deductions FAS +724 202903 37 beaters charges Romano W +725 202904 37 Hornblower freest bitterroot +726 202907 37 vests Greenberg corset +727 202908 37 indulgences tinting securing +728 203101 37 infallibly expelled environing FAS +729 203103 37 unwilling warm cute +730 203104 37 excrete smoothed Crays +731 203105 37 spools deductions heiress FAS +732 203401 37 crunches Romano inform FAS +733 203402 37 overestimating bitterroot avenge +734 203404 37 ineffective corset universals +735 203901 37 humiliation securing Kinsey W +736 203902 37 sophomore environing ravines FAS +737 203903 37 star cute bestseller +738 203906 37 rifles Crays equilibrium +739 203907 37 dialysis heiress extents 0 +740 203908 37 arriving inform relatively +741 203909 37 indulge avenge pressure FAS +742 206101 37 clockers universals critiques FAS +743 206201 37 languages Kinsey befouled +744 206202 37 Antarctica ravines rightfully FAS +745 206203 37 percentage bestseller mechanizing FAS +746 206206 37 ceiling equilibrium Latinizes +747 206207 37 specification extents timesharing +748 206208 37 regimented relatively Aden +749 208001 37 ciphers pressure embassies +750 208002 37 pictures critiques males FAS +751 208003 37 serpents befouled shapelessly FAS +752 208004 37 allot rightfully genres FAS +753 208008 37 realized mechanizing mastering +754 208009 37 mayoral Latinizes Newtonian +755 208010 37 opaquely timesharing finishers FAS +756 208011 37 hostess Aden abates +757 208101 37 fiftieth embassies teem +758 208102 37 incorrectly males kiting FAS +759 208103 37 decomposition shapelessly stodgy FAS +760 208104 37 stranglings genres scalps FAS +761 208105 37 mixture mastering feed FAS +762 208110 37 electroencephalography Newtonian guitars +763 208111 37 similarities finishers airships +764 208112 37 charges abates store +765 208113 37 freest teem denounces +766 208201 37 Greenberg kiting Pyle FAS +767 208203 37 tinting stodgy Saxony +768 208301 37 expelled scalps serializations FAS +769 208302 37 warm feed Peruvian FAS +770 208305 37 smoothed guitars taxonomically FAS +771 208401 37 deductions airships kingdom A +772 208402 37 Romano store stint A +773 208403 37 bitterroot denounces Sault A +774 208404 37 corset Pyle faithful +775 208501 37 securing Saxony Ganymede FAS +776 208502 37 environing serializations tidiness FAS +777 208503 37 cute Peruvian gainful FAS +778 208504 37 Crays taxonomically contrary FAS +779 208505 37 heiress kingdom Tipperary FAS +780 210101 37 inform stint tropics W +781 210102 37 avenge Sault theorizers +782 210103 37 universals faithful renew 0 +783 210104 37 Kinsey Ganymede already +784 210105 37 ravines tidiness terminal +785 210106 37 bestseller gainful Hegelian +786 210107 37 equilibrium contrary hypothesizer +787 210401 37 extents Tipperary warningly FAS +788 213201 37 relatively tropics journalizing FAS +789 213203 37 pressure theorizers nested +790 213204 37 critiques renew Lars +791 213205 37 befouled already saplings +792 213206 37 rightfully terminal foothill +793 213207 37 mechanizing Hegelian labeled +794 216101 37 Latinizes hypothesizer imperiously FAS +795 216103 37 timesharing warningly reporters FAS +796 218001 37 Aden journalizing furnishings FAS +797 218002 37 embassies nested precipitable FAS +798 218003 37 males Lars discounts FAS +799 218004 37 shapelessly saplings excises FAS +800 143503 50 genres foothill Stalin +801 218006 37 mastering labeled despot FAS +802 218007 37 Newtonian imperiously ripeness FAS +803 218008 37 finishers reporters Arabia +804 218009 37 abates furnishings unruly +805 218010 37 teem precipitable mournfulness +806 218011 37 kiting discounts boom FAS +807 218020 37 stodgy excises slaughter A +808 218021 50 scalps Stalin Sabine +809 218022 37 feed despot handy FAS +810 218023 37 guitars ripeness rural +811 218024 37 airships Arabia organizer +812 218101 37 store unruly shipyard FAS +813 218102 37 denounces mournfulness civics FAS +814 218103 37 Pyle boom inaccuracy FAS +815 218201 37 Saxony slaughter rules FAS +816 218202 37 serializations Sabine juveniles FAS +817 218203 37 Peruvian handy comprised W +818 218204 37 taxonomically rural investigations +819 218205 37 kingdom organizer stabilizes A +820 218301 37 stint shipyard seminaries FAS +821 218302 37 Sault civics Hunter A +822 218401 37 faithful inaccuracy sporty FAS +823 218402 37 Ganymede rules test FAS +824 218403 37 tidiness juveniles weasels +825 218404 37 gainful comprised CERN +826 218407 37 contrary investigations tempering +827 218408 37 Tipperary stabilizes afore FAS +828 218409 37 tropics seminaries Galatean +829 218410 37 theorizers Hunter techniques W +830 226001 37 renew sporty error +831 226002 37 already test veranda +832 226003 37 terminal weasels severely +833 226004 37 Hegelian CERN Cassites FAS +834 226005 37 hypothesizer tempering forthcoming +835 226006 37 warningly afore guides +836 226007 37 journalizing Galatean vanish FAS +837 226008 37 nested techniques lied A +838 226203 37 Lars error sawtooth FAS +839 226204 37 saplings veranda fated FAS +840 226205 37 foothill severely gradually +841 226206 37 labeled Cassites widens +842 226207 37 imperiously forthcoming preclude +843 226208 37 reporters guides Jobrel +844 226209 37 furnishings vanish hooker +845 226210 37 precipitable lied rainstorm +846 226211 37 discounts sawtooth disconnects +847 228001 37 excises fated cruelty +848 228004 37 Stalin gradually exponentials A +849 228005 37 despot widens affective A +850 228006 37 ripeness preclude arteries +851 228007 37 Arabia Jobrel Crosby FAS +852 228008 37 unruly hooker acquaint +853 228009 37 mournfulness rainstorm evenhandedly +854 228101 37 boom disconnects percentage +855 228108 37 slaughter cruelty disobedience +856 228109 37 Sabine exponentials humility +857 228110 37 handy affective gleaning A +858 228111 37 rural arteries petted A +859 228112 37 organizer Crosby bloater A +860 228113 37 shipyard acquaint minion A +861 228114 37 civics evenhandedly marginal A +862 228115 37 inaccuracy percentage apiary A +863 228116 37 rules disobedience measures +864 228117 37 juveniles humility precaution +865 228118 37 comprised gleaning repelled +866 228119 37 investigations petted primary FAS +867 228120 37 stabilizes bloater coverings +868 228121 37 seminaries minion Artemia A +869 228122 37 Hunter marginal navigate +870 228201 37 sporty apiary spatial +871 228206 37 test measures Gurkha +872 228207 37 weasels precaution meanwhile A +873 228208 37 CERN repelled Melinda A +874 228209 37 tempering primary Butterfield +875 228210 37 afore coverings Aldrich A +876 228211 37 Galatean Artemia previewing A +877 228212 37 techniques navigate glut A +878 228213 37 error spatial unaffected +879 228214 37 veranda Gurkha inmate +880 228301 37 severely meanwhile mineral +881 228305 37 Cassites Melinda impending A +882 228306 37 forthcoming Butterfield meditation A +883 228307 37 guides Aldrich ideas +884 228308 37 vanish previewing miniaturizes W +885 228309 37 lied glut lewdly +886 228310 37 sawtooth unaffected title +887 228311 37 fated inmate youthfulness +888 228312 37 gradually mineral creak FAS +889 228313 37 widens impending Chippewa +890 228314 37 preclude meditation clamored +891 228401 65 Jobrel ideas freezes +892 228402 65 hooker miniaturizes forgivably FAS +893 228403 65 rainstorm lewdly reduce FAS +894 228404 65 disconnects title McGovern W +895 228405 65 cruelty youthfulness Nazis W +896 228406 65 exponentials creak epistle W +897 228407 65 affective Chippewa socializes W +898 228408 65 arteries clamored conceptions +899 228409 65 Crosby freezes Kevin +900 228410 65 acquaint forgivably uncovering +901 230301 37 evenhandedly reduce chews FAS +902 230302 37 percentage McGovern appendixes FAS +903 230303 37 disobedience Nazis raining +904 018062 37 humility epistle infest +905 230501 37 gleaning socializes compartment +906 230502 37 petted conceptions minting +907 230503 37 bloater Kevin ducks +908 230504 37 minion uncovering roped A +909 230505 37 marginal chews waltz +910 230506 37 apiary appendixes Lillian +911 230507 37 measures raining repressions A +912 230508 37 precaution infest chillingly +913 230509 37 repelled compartment noncritical +914 230901 37 primary minting lithograph +915 230902 37 coverings ducks spongers +916 230903 37 Artemia roped parenthood +917 230904 37 navigate waltz posed +918 230905 37 spatial Lillian instruments +919 230906 37 Gurkha repressions filial +920 230907 37 meanwhile chillingly fixedly +921 230908 37 Melinda noncritical relives +922 230909 37 Butterfield lithograph Pandora +923 230910 37 Aldrich spongers watering A +924 230911 37 previewing parenthood ungrateful +925 230912 37 glut posed secures +926 230913 37 unaffected instruments chastisers +927 230914 37 inmate filial icon +928 231304 37 mineral fixedly reuniting A +929 231305 37 impending relives imagining A +930 231306 37 meditation Pandora abiding A +931 231307 37 ideas watering omnisciently +932 231308 37 miniaturizes ungrateful Britannic +933 231309 37 lewdly secures scholastics A +934 231310 37 title chastisers mechanics A +935 231311 37 youthfulness icon humidly A +936 231312 37 creak reuniting masterpiece +937 231313 37 Chippewa imagining however +938 231314 37 clamored abiding Mendelian +939 231315 37 freezes omnisciently jarred +940 232102 37 forgivably Britannic scolds +941 232103 37 reduce scholastics infatuate +942 232104 37 McGovern mechanics willed A +943 232105 37 Nazis humidly joyfully +944 232106 37 epistle masterpiece Microsoft +945 232107 37 socializes however fibrosities +946 232108 37 conceptions Mendelian Baltimorean +947 232601 37 Kevin jarred equestrian +948 232602 37 uncovering scolds Goodrich +949 232603 37 chews infatuate apish A +950 232605 37 appendixes willed Adlerian +5950 1232605 37 appendixes willed Adlerian +5951 1232606 37 appendixes willed Adlerian +5952 1232607 37 appendixes willed Adlerian +5953 1232608 37 appendixes willed Adlerian +5954 1232609 37 appendixes willed Adlerian +951 232606 37 raining joyfully Tropez +952 232607 37 infest Microsoft nouns +953 232608 37 compartment fibrosities distracting +954 232609 37 minting Baltimorean mutton +955 236104 37 ducks equestrian bridgeable A +956 236105 37 roped Goodrich stickers A +957 236106 37 waltz apish transcontinental A +958 236107 37 Lillian Adlerian amateurish +959 236108 37 repressions Tropez Gandhian +960 236109 37 chillingly nouns stratified +961 236110 37 noncritical distracting chamberlains +962 236111 37 lithograph mutton creditably +963 236112 37 spongers bridgeable philosophic +964 236113 37 parenthood stickers ores +965 238005 37 posed transcontinental Carleton +966 238006 37 instruments amateurish tape A +967 238007 37 filial Gandhian afloat A +968 238008 37 fixedly stratified goodness A +969 238009 37 relives chamberlains welcoming +970 238010 37 Pandora creditably Pinsky FAS +971 238011 37 watering philosophic halting +972 238012 37 ungrateful ores bibliography +973 238013 37 secures Carleton decoding +974 240401 41 chastisers tape variance A +975 240402 41 icon afloat allowed A +976 240901 41 reuniting goodness dire A +977 240902 41 imagining welcoming dub A +978 241801 41 abiding Pinsky poisoning +979 242101 41 omnisciently halting Iraqis A +980 242102 41 Britannic bibliography heaving +981 242201 41 scholastics decoding population A +982 242202 41 mechanics variance bomb A +983 242501 41 humidly allowed Majorca A +984 242502 41 masterpiece dire Gershwins +985 246201 41 however dub explorers +986 246202 41 Mendelian poisoning libretto A +987 246203 41 jarred Iraqis occurred +988 246204 41 scolds heaving Lagos +989 246205 41 infatuate population rats +990 246301 41 willed bomb bankruptcies A +991 246302 41 joyfully Majorca crying +992 248001 41 Microsoft Gershwins unexpected +993 248002 41 fibrosities explorers accessed A +994 248003 41 Baltimorean libretto colorful A +995 248004 41 equestrian occurred versatility A +996 248005 41 Goodrich Lagos cosy +997 248006 41 apish rats Darius A +998 248007 41 Adlerian bankruptcies mastering A +999 248008 41 Tropez crying Asiaticizations A +1000 248009 41 nouns unexpected offerers A +1001 248010 41 distracting accessed uncles A +1002 248011 41 mutton colorful sleepwalk +1003 248012 41 bridgeable versatility Ernestine +1004 248013 41 stickers cosy checksumming +1005 248014 41 transcontinental Darius stopped +1006 248015 41 amateurish mastering sicker +1007 248016 41 Gandhian Asiaticizations Italianization +1008 248017 41 stratified offerers alphabetic +1009 248018 41 chamberlains uncles pharmaceutic +1010 248019 41 creditably sleepwalk creator +1011 248020 41 philosophic Ernestine chess +1012 248021 41 ores checksumming charcoal +1013 248101 41 Carleton stopped Epiphany A +1014 248102 41 tape sicker bulldozes A +1015 248201 41 afloat Italianization Pygmalion A +1016 248202 41 goodness alphabetic caressing A +1017 248203 41 welcoming pharmaceutic Palestine A +1018 248204 41 Pinsky creator regimented A +1019 248205 41 halting chess scars A +1020 248206 41 bibliography charcoal realest A +1021 248207 41 decoding Epiphany diffusing A +1022 248208 41 variance bulldozes clubroom A +1023 248209 41 allowed Pygmalion Blythe A +1024 248210 41 dire caressing ahead +1025 248211 50 dub Palestine reviver +1026 250501 34 poisoning regimented retransmitting A +1027 250502 34 Iraqis scars landslide +1028 250503 34 heaving realest Eiffel +1029 250504 34 population diffusing absentee +1030 250505 34 bomb clubroom aye +1031 250601 34 Majorca Blythe forked A +1032 250602 34 Gershwins ahead Peruvianizes +1033 250603 34 explorers reviver clerked +1034 250604 34 libretto retransmitting tutor +1035 250605 34 occurred landslide boulevard +1036 251001 34 Lagos Eiffel shuttered +1037 251002 34 rats absentee quotes A +1038 251003 34 bankruptcies aye Caltech +1039 251004 34 crying forked Mossberg +1040 251005 34 unexpected Peruvianizes kept +1041 251301 34 accessed clerked roundly +1042 251302 34 colorful tutor features A +1043 251303 34 versatility boulevard imaginable A +1044 251304 34 cosy shuttered controller +1045 251305 34 Darius quotes racial +1046 251401 34 mastering Caltech uprisings A +1047 251402 34 Asiaticizations Mossberg narrowed A +1048 251403 34 offerers kept cannot A +1049 251404 34 uncles roundly vest +1050 251405 34 sleepwalk features famine +1051 251406 34 Ernestine imaginable sugars +1052 251801 34 checksumming controller exterminated A +1053 251802 34 stopped racial belays +1054 252101 34 sicker uprisings Hodges A +1055 252102 34 Italianization narrowed translatable +1056 252301 34 alphabetic cannot duality A +1057 252302 34 pharmaceutic vest recording A +1058 252303 34 creator famine rouses A +1059 252304 34 chess sugars poison +1060 252305 34 charcoal exterminated attitude +1061 252306 34 Epiphany belays dusted +1062 252307 34 bulldozes Hodges encompasses +1063 252308 34 Pygmalion translatable presentation +1064 252309 34 caressing duality Kantian +1065 256001 34 Palestine recording imprecision A +1066 256002 34 regimented rouses saving +1067 256003 34 scars poison maternal +1068 256004 34 realest attitude hewed +1069 256005 34 diffusing dusted kerosene +1070 258001 34 clubroom encompasses Cubans +1071 258002 34 Blythe presentation photographers +1072 258003 34 ahead Kantian nymph A +1073 258004 34 reviver imprecision bedlam A +1074 258005 34 retransmitting saving north A +1075 258006 34 landslide maternal Schoenberg A +1076 258007 34 Eiffel hewed botany A +1077 258008 34 absentee kerosene curs +1078 258009 34 aye Cubans solidification +1079 258010 34 forked photographers inheritresses +1080 258011 34 Peruvianizes nymph stiller +1081 258101 68 clerked bedlam t1 A +1082 258102 68 tutor north suite A +1083 258103 34 boulevard Schoenberg ransomer +1084 258104 68 shuttered botany Willy +1085 258105 68 quotes curs Rena A +1086 258106 68 Caltech solidification Seattle A +1087 258107 68 Mossberg inheritresses relaxes A +1088 258108 68 kept stiller exclaim +1089 258109 68 roundly t1 implicated A +1090 258110 68 features suite distinguish +1091 258111 68 imaginable ransomer assayed +1092 258112 68 controller Willy homeowner +1093 258113 68 racial Rena and +1094 258201 34 uprisings Seattle stealth +1095 258202 34 narrowed relaxes coinciding A +1096 258203 34 cannot exclaim founder A +1097 258204 34 vest implicated environing +1098 258205 34 famine distinguish jewelry +1099 258301 34 sugars assayed lemons A +1100 258401 34 exterminated homeowner brokenness A +1101 258402 34 belays and bedpost A +1102 258403 34 Hodges stealth assurers A +1103 258404 34 translatable coinciding annoyers +1104 258405 34 duality founder affixed +1105 258406 34 recording environing warbling +1106 258407 34 rouses jewelry seriously +1107 228123 37 poison lemons boasted +1108 250606 34 attitude brokenness Chantilly +1109 208405 37 dusted bedpost Iranizes +1110 212101 37 encompasses assurers violinist +1111 218206 37 presentation annoyers extramarital +1112 150401 37 Kantian affixed spates +1113 248212 41 imprecision warbling cloakroom +1114 128026 00 saving seriously gazer +1115 128024 00 maternal boasted hand +1116 128027 00 hewed Chantilly tucked +1117 128025 00 kerosene Iranizes gems +1118 128109 00 Cubans violinist clinker +1119 128705 00 photographers extramarital refiner +1120 126303 00 nymph spates callus +1121 128308 00 bedlam cloakroom leopards +1122 128204 00 north gazer comfortingly +1123 128205 00 Schoenberg hand generically +1124 128206 00 botany tucked getters +1125 128207 00 curs gems sexually +1126 118205 00 solidification clinker spear +1127 116801 00 inheritresses refiner serums +1128 116803 00 stiller callus Italianization +1129 116804 00 t1 leopards attendants +1130 116802 00 suite comfortingly spies +1131 128605 00 ransomer generically Anthony +1132 118308 00 Willy getters planar +1133 113702 00 Rena sexually cupped +1134 113703 00 Seattle spear cleanser +1135 112103 00 relaxes serums commuters +1136 118009 00 exclaim Italianization honeysuckle +5136 1118009 00 exclaim Italianization honeysuckle +1137 138011 00 implicated attendants orphanage +1138 138010 00 distinguish spies skies +1139 138012 00 assayed Anthony crushers +1140 068304 00 homeowner planar Puritan +1141 078009 00 and cupped squeezer +1142 108013 00 stealth cleanser bruises +1143 084004 00 coinciding commuters bonfire +1144 083402 00 founder honeysuckle Colombo +1145 084003 00 environing orphanage nondecreasing +1146 088504 00 jewelry skies innocents +1147 088005 00 lemons crushers masked +1148 088007 00 brokenness Puritan file +1149 088006 00 bedpost squeezer brush +1150 148025 00 assurers bruises mutilate +1151 148024 00 annoyers bonfire mommy +1152 138305 00 affixed Colombo bulkheads +1153 138306 00 warbling nondecreasing undeclared +1154 152701 00 seriously innocents displacements +1155 148505 00 boasted masked nieces +1156 158003 00 Chantilly file coeducation +1157 156201 00 Iranizes brush brassy +1158 156202 00 violinist mutilate authenticator +1159 158307 00 extramarital mommy Washoe +1160 158402 00 spates bulkheads penny +1161 158401 00 cloakroom undeclared Flagler +1162 068013 00 gazer displacements stoned +1163 068012 00 hand nieces cranes +1164 068203 00 tucked coeducation masterful +1165 088205 00 gems brassy biracial +1166 068704 00 clinker authenticator steamships +1167 068604 00 refiner Washoe windmills +1168 158502 00 callus penny exploit +1169 123103 00 leopards Flagler riverfront +1170 148026 00 comfortingly stoned sisterly +1171 123302 00 generically cranes sharpshoot +1172 076503 00 getters masterful mittens +1173 126304 00 sexually biracial interdependency +1174 068306 00 spear steamships policy +1175 143504 00 serums windmills unleashing +1176 160201 00 Italianization exploit pretenders +1177 148028 00 attendants riverfront overstatements +1178 148027 00 spies sisterly birthed +1179 143505 00 Anthony sharpshoot opportunism +1180 108014 00 planar mittens showroom +1181 076104 00 cupped interdependency compromisingly +1182 078106 00 cleanser policy Medicare +1183 126102 00 commuters unleashing corresponds +1184 128029 00 honeysuckle pretenders hardware +1185 128028 00 orphanage overstatements implant +1186 018410 00 skies birthed Alicia +1187 128110 00 crushers opportunism requesting +1188 148506 00 Puritan showroom produced +1189 123303 00 squeezer compromisingly criticizes +1190 123304 00 bruises Medicare backer +1191 068504 00 bonfire corresponds positively +1192 068305 00 Colombo hardware colicky +1193 000000 00 nondecreasing implant thrillingly +1 000001 00 Omaha teethe neat +2 011401 37 breaking dreaded Steinberg W +3 011402 37 Romans scholastics jarring +4 011403 37 intercepted audiology tinily drop table t1, t2; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 5c2e73e5af7..f55aea6e104 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1297,4 +1297,6 @@ INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W'); INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring',''); INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); SELECT * FROM t2; +OPTIMIZE TABLE t2; +SELECT * FROM t2; drop table t1, t2; diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index c004330932c..e71ae05734a 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -70,7 +70,6 @@ Allow users to set compression level. Add truncate table command. Implement versioning, should be easy. - Implement optimize so we can fix broken tables. Allow for errors, find a way to mark bad rows. See if during an optimize you can make the table smaller. Talk to the gzip guys, come up with a writable format so that updates are doable @@ -88,6 +87,7 @@ static int archive_init= 0; /* The file extension */ #define ARZ ".ARZ" +#define ARN ".ARN" /* Used for hash table that tracks open tables. @@ -117,7 +117,7 @@ static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table) if (!archive_init) { VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST)); - if (!hash_init(&archive_open_tables,system_charset_info,32,0,0, + if (hash_init(&archive_open_tables,system_charset_info,32,0,0, (hash_get_key) archive_get_key,0,0)) { pthread_mutex_unlock(&LOCK_mysql_create_db); @@ -205,7 +205,7 @@ static int free_share(ARCHIVE_SHARE *share) We just implement one additional file extension. */ const char **ha_archive::bas_ext() const -{ static const char *ext[]= { ARZ, NullS }; return ext; } +{ static const char *ext[]= { ARZ, ARN, NullS }; return ext; } /* @@ -322,6 +322,11 @@ err: /* Look at ha_archive::open() for an explanation of the row format. Here we just write out the row. + + Wondering about start_bulk_insert()? We don't implement it for + archive since it optimizes for lots of writes. The only save + for implementing start_bulk_insert() is that we could skip + setting dirty to true each time. */ int ha_archive::write_row(byte * buf) { @@ -380,17 +385,7 @@ int ha_archive::rnd_init(bool scan) pthread_mutex_lock(&share->mutex); if (share->dirty == TRUE) { -/* I was having problems with OSX, but it worked for 10.3 so I am wrapping this with and ifdef */ -#ifdef BROKEN_GZFLUSH - gzclose(share->archive_write); - if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL) - { - pthread_mutex_unlock(&share->mutex); - DBUG_RETURN(errno ? errno : -1); - } -#else gzflush(share->archive_write, Z_SYNC_FLUSH); -#endif share->dirty= FALSE; } pthread_mutex_unlock(&share->mutex); @@ -504,6 +499,54 @@ int ha_archive::rnd_pos(byte * buf, byte *pos) DBUG_RETURN(get_row(buf)); } +/* + The table can become fragmented if data was inserted, read, and then + inserted again. What we do is open up the file and recompress it completely. + */ +int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + DBUG_ENTER("ha_archive::optimize"); + int read; // Bytes read, gzread() returns int + gzFile reader, writer; + char block[IO_SIZE]; + char writer_filename[FN_REFLEN]; + + /* Lets create a file to contain the new data */ + fn_format(writer_filename,share->table_name,"",ARN, MY_REPLACE_EXT|MY_UNPACK_FILENAME); + + /* Closing will cause all data waiting to be flushed, to be flushed */ + gzclose(share->archive_write); + + if ((reader= gzopen(share->data_file_name, "rb")) == NULL) + DBUG_RETURN(-1); + + if ((writer= gzopen(writer_filename, "wb")) == NULL) + { + gzclose(reader); + DBUG_RETURN(-1); + } + + while (read= gzread(reader, block, IO_SIZE)) + gzwrite(writer, block, read); + + gzclose(reader); + gzclose(writer); + + my_rename(writer_filename,share->data_file_name,MYF(0)); + + /* + We reopen the file in case some IO is waiting to go through. + In theory the table is closed right after this operation, + but it is possible for IO to still happen. + I may be being a bit too paranoid right here. + */ + if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL) + DBUG_RETURN(errno ? errno : -1); + share->dirty= FALSE; + + DBUG_RETURN(0); +} + /****************************************************************************** Everything below here is default, please look at ha_example.cc for diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index f08353a5d6c..cf7becc5bc0 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -112,7 +112,7 @@ public: int external_lock(THD *thd, int lock_type); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); - + int optimize(THD* thd, HA_CHECK_OPT* check_opt); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); }; From 19b92eecfcbb4aaa3cf9ff7f85eea3219e47c5bf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Sep 2004 08:58:44 +0200 Subject: [PATCH 03/34] - Bumped up version number: 4.1.5 -> 4.1.6 (still keeping the "gamma" label for now) - tagged ChangeSet 1.2015.1.10 as "mysql-4.1.5" configure.in: - Bumped up version number: 4.1.5 -> 4.1.6 (still keeping the "gamma" label for now) --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 0704123f082..be365ec8584 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.1.5-gamma) +AM_INIT_AUTOMAKE(mysql, 4.1.6-gamma) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From c7deb0d6759f6f1cac1f030331b8202cfcc5b244 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Sep 2004 12:52:56 +0000 Subject: [PATCH 04/34] bug#5591 --- sql/ha_ndbcluster.cc | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 1a311938a36..4e474568671 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -175,7 +175,7 @@ void ha_ndbcluster::records_update() DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d", ((const NDBTAB *)m_table)->getTableId(), info->no_uncommitted_rows_count)); - if (info->records == ~(ha_rows)0) + // if (info->records == ~(ha_rows)0) { Uint64 rows; if(ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0) == 0){ @@ -607,7 +607,7 @@ int ha_ndbcluster::get_metadata(const char *path) DBUG_ENTER("get_metadata"); DBUG_PRINT("enter", ("m_tabname: %s, path: %s", m_tabname, path)); - if (!(tab= dict->getTable(m_tabname, &m_table_info))) + if (!(tab= dict->getTable(m_tabname))) ERR_RETURN(dict->getNdbError()); DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion())); @@ -655,8 +655,8 @@ int ha_ndbcluster::get_metadata(const char *path) if (error) DBUG_RETURN(error); - // All checks OK, lets use the table - m_table= (void*)tab; + m_table= NULL; + m_table_info= NULL; DBUG_RETURN(build_index_list(table, ILBP_OPEN)); } @@ -771,6 +771,7 @@ void ha_ndbcluster::release_metadata() DBUG_PRINT("enter", ("m_tabname: %s", m_tabname)); m_table= NULL; + m_table_info= NULL; // Release index list for (i= 0; i < MAX_KEY; i++) @@ -2394,7 +2395,17 @@ void ha_ndbcluster::info(uint flag) if (flag & HA_STATUS_VARIABLE) { DBUG_PRINT("info", ("HA_STATUS_VARIABLE")); - records_update(); + if (m_table_info) + { + records_update(); + } + else + { + Uint64 rows; + if(ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0) == 0){ + records= rows; + } + } } if (flag & HA_STATUS_ERRKEY) { @@ -2781,6 +2792,16 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) // Start of transaction retrieve_all_fields= FALSE; ops_pending= 0; + { + NDBDICT *dict= m_ndb->getDictionary(); + const NDBTAB *tab; + void *tab_info; + if (!(tab= dict->getTable(m_tabname, &tab_info))) + ERR_RETURN(dict->getNdbError()); + DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion())); + m_table= (void *)tab; + m_table_info= tab_info; + } no_uncommitted_rows_init(thd); } else @@ -2803,6 +2824,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) thd->transaction.stmt.ndb_tid= 0; } } + m_table= NULL; + m_table_info= NULL; if (m_active_trans) DBUG_PRINT("warning", ("m_active_trans != NULL")); if (m_active_cursor) @@ -3288,6 +3311,7 @@ int ha_ndbcluster::alter_table_name(const char *from, const char *to) ERR_RETURN(dict->getNdbError()); m_table= NULL; + m_table_info= NULL; DBUG_RETURN(0); } From b61bfd8c9786da2c33530699245eacc2b96d768b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Sep 2004 14:58:23 +0200 Subject: [PATCH 05/34] Make operation list on fragment fifo so that uncommitted operations are undo-logged in correct order Add bunch of testcases to autotest ndb/src/kernel/blocks/dbtup/Dbtup.hpp: Send fragrecord ptr to initOpConnection so that is does not have to look it up every time (if needed) Make operation list on fragment fifo so that uncommitted operations are undo-logged in correct order ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp: Send fragptr to initOpConnection ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp: dllist -> dlfifolist ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: dllist -> dlfifolist ndb/src/kernel/blocks/dbtup/DbtupGen.cpp: Make operation list on fragment fifo so that uncommitted operations are undo-logged in correct order ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: Fix uninitialized variable c_start.m_startTime which made startPartial and startPartitioned fail ndb/test/ndbapi/testSystemRestart.cpp: Added testSystemRestart -n SR9 which demonstrates that two prepared operation on same records _used to_ be undo-logged in wrong order makeing system restart fail ndb/test/run-test/daily-devel-tests.txt: Add * testSystemRestart -n SR6 Restart while some nodes have fs and other not * testSystemRestart -n SR7 Restart in partition win * testSystemRestart -n SR8 Restart in partition win, others starting during restart * testSystemRestart -n SR9 Multiple ops on same record prepared before --- ndb/src/kernel/blocks/dbtup/Dbtup.hpp | 3 +- ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp | 6 +- ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp | 15 ++--- .../kernel/blocks/dbtup/DbtupExecQuery.cpp | 20 +++--- ndb/src/kernel/blocks/dbtup/DbtupGen.cpp | 3 +- ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp | 8 ++- ndb/test/ndbapi/testSystemRestart.cpp | 62 ++++++++++++++++++- ndb/test/run-test/daily-devel-tests.txt | 16 +++++ 8 files changed, 103 insertions(+), 30 deletions(-) diff --git a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp index ce81c1c9bc8..0e8dd5fbbe8 100644 --- a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp +++ b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp @@ -515,6 +515,7 @@ struct Fragrecord { Uint32 emptyPrimPage; Uint32 firstusedOprec; + Uint32 lastusedOprec; Uint32 thFreeFirst; Uint32 thFreeCopyFirst; @@ -1653,7 +1654,7 @@ private: //------------------------------------------------------------------ //------------------------------------------------------------------ - void initOpConnection(Operationrec* const regOperPtr); + void initOpConnection(Operationrec* regOperPtr, Fragrecord*); //------------------------------------------------------------------ //------------------------------------------------------------------ diff --git a/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp b/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp index 1ffc5f06754..e9043a8b52d 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp @@ -77,7 +77,7 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) if (regOperPtr.p->optype == ZREAD) { ljam(); freeAllAttrBuffers(regOperPtr.p); - initOpConnection(regOperPtr.p); + initOpConnection(regOperPtr.p, 0); return; }//if @@ -134,7 +134,7 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ndbrequire(regOperPtr.p->tupleState == ALREADY_ABORTED); commitUpdate(signal, regOperPtr.p, regFragPtr.p, regTabPtr.p); }//if - initOpConnection(regOperPtr.p); + initOpConnection(regOperPtr.p, regFragPtr.p); }//execTUP_ABORTREQ() void Dbtup::setTupleStateOnPreviousOps(Uint32 prevOpIndex) @@ -459,7 +459,7 @@ void Dbtup::tupkeyErrorLab(Signal* signal) freeAllAttrBuffers(regOperPtr); abortUpdate(signal, regOperPtr, fragptr.p, tabptr.p); removeActiveOpList(regOperPtr); - initOpConnection(regOperPtr); + initOpConnection(regOperPtr, fragptr.p); regOperPtr->transstate = IDLE; regOperPtr->tupleState = NO_OTHER_OP; TupKeyRef * const tupKeyRef = (TupKeyRef *)signal->getDataPtrSend(); diff --git a/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp b/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp index fa3667b221e..cbd56c3281f 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp @@ -224,7 +224,8 @@ void Dbtup::removeActiveOpList(Operationrec* const regOperPtr) /* ---------------------------------------------------------------- */ /* INITIALIZATION OF ONE CONNECTION RECORD TO PREPARE FOR NEXT OP. */ /* ---------------------------------------------------------------- */ -void Dbtup::initOpConnection(Operationrec* const regOperPtr) +void Dbtup::initOpConnection(Operationrec* regOperPtr, + Fragrecord * fragPtrP) { Uint32 RinFragList = regOperPtr->inFragList; regOperPtr->transstate = IDLE; @@ -244,22 +245,18 @@ void Dbtup::initOpConnection(Operationrec* const regOperPtr) regOperPtr->inFragList = ZFALSE; if (tropPrevLinkPtr.i == RNIL) { ljam(); - FragrecordPtr regFragPtr; - regFragPtr.i = regOperPtr->fragmentPtr; - ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord); - regFragPtr.p->firstusedOprec = tropNextLinkPtr.i; + fragPtrP->firstusedOprec = tropNextLinkPtr.i; } else { ljam(); ptrCheckGuard(tropPrevLinkPtr, cnoOfOprec, operationrec); tropPrevLinkPtr.p->nextOprecInList = tropNextLinkPtr.i; }//if if (tropNextLinkPtr.i == RNIL) { - ; + fragPtrP->lastusedOprec = tropPrevLinkPtr.i; } else { - ljam(); ptrCheckGuard(tropNextLinkPtr, cnoOfOprec, operationrec); tropNextLinkPtr.p->prevOprecInList = tropPrevLinkPtr.i; - }//if + } regOperPtr->prevOprecInList = RNIL; regOperPtr->nextOprecInList = RNIL; }//if @@ -336,7 +333,7 @@ void Dbtup::execTUP_COMMITREQ(Signal* signal) commitUpdate(signal, regOperPtr.p, regFragPtr.p, regTabPtr.p); removeActiveOpList(regOperPtr.p); }//if - initOpConnection(regOperPtr.p); + initOpConnection(regOperPtr.p, regFragPtr.p); }//execTUP_COMMITREQ() void diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index dfd1e37d4f5..0061ebe812d 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -319,24 +319,20 @@ void Dbtup::linkOpIntoFragList(OperationrecPtr regOperPtr, Fragrecord* const regFragPtr) { OperationrecPtr sopTmpOperPtr; -/* ----------------------------------------------------------------- */ -/* LINK THE OPERATION INTO A DOUBLY LINKED LIST ON THE FRAGMENT*/ -/* PUT IT FIRST IN THIS LIST SINCE IT DOESN'T MATTER WHERE IT */ -/* IS PUT. */ -/* ----------------------------------------------------------------- */ + Uint32 tail = regFragPtr->lastusedOprec; ndbrequire(regOperPtr.p->inFragList == ZFALSE); regOperPtr.p->inFragList = ZTRUE; - regOperPtr.p->prevOprecInList = RNIL; - sopTmpOperPtr.i = regFragPtr->firstusedOprec; - regFragPtr->firstusedOprec = regOperPtr.i; - regOperPtr.p->nextOprecInList = sopTmpOperPtr.i; - if (sopTmpOperPtr.i == RNIL) { - return; + regOperPtr.p->prevOprecInList = tail; + regOperPtr.p->nextOprecInList = RNIL; + sopTmpOperPtr.i = tail; + if (tail == RNIL) { + regFragPtr->firstusedOprec = regOperPtr.i; } else { jam(); ptrCheckGuard(sopTmpOperPtr, cnoOfOprec, operationrec); - sopTmpOperPtr.p->prevOprecInList = regOperPtr.i; + sopTmpOperPtr.p->nextOprecInList = regOperPtr.i; }//if + regFragPtr->lastusedOprec = regOperPtr.i; }//Dbtup::linkOpIntoFragList() /* diff --git a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp index f3391ff7b59..d33adcd08e1 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp @@ -963,6 +963,7 @@ void Dbtup::initializeFragrecord() regFragPtr.p->nextfreefrag = regFragPtr.i + 1; regFragPtr.p->checkpointVersion = RNIL; regFragPtr.p->firstusedOprec = RNIL; + regFragPtr.p->lastusedOprec = RNIL; regFragPtr.p->fragStatus = IDLE; }//for regFragPtr.i = cnoOfFragrec - 1; @@ -1164,7 +1165,7 @@ void Dbtup::execTUPSEIZEREQ(Signal* signal) return; }//if regOperPtr.p->optype = ZREAD; - initOpConnection(regOperPtr.p); + initOpConnection(regOperPtr.p, 0); regOperPtr.p->userpointer = userPtr; regOperPtr.p->userblockref = userRef; signal->theData[0] = regOperPtr.p->userpointer; diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp index ff4876b1506..568ed6c6566 100644 --- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp +++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp @@ -103,7 +103,7 @@ void Ndbcntr::execCONTINUEB(Signal* signal) } Uint64 now = NdbTick_CurrentMillisecond(); - if(c_start.m_startFailureTimeout > now){ + if(now > c_start.m_startFailureTimeout){ ndbrequire(false); } @@ -446,13 +446,17 @@ void Ndbcntr::execREAD_NODESCONF(Signal* signal) ndb_mgm_get_int_parameter(p, CFG_DB_START_PARTITION_TIMEOUT, &to_2); ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT, &to_3); + c_start.m_startTime = NdbTick_CurrentMillisecond(); c_start.m_startPartialTimeout = setTimeout(c_start.m_startTime, to_1); c_start.m_startPartitionedTimeout = setTimeout(c_start.m_startTime, to_2); c_start.m_startFailureTimeout = setTimeout(c_start.m_startTime, to_3); - + UpgradeStartup::sendCmAppChg(* this, signal, 0); // ADD sendCntrStartReq(signal); + + signal->theData[0] = ZSTARTUP; + sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 1); return; } diff --git a/ndb/test/ndbapi/testSystemRestart.cpp b/ndb/test/ndbapi/testSystemRestart.cpp index 68e5eacc631..f8f2b84acc4 100644 --- a/ndb/test/ndbapi/testSystemRestart.cpp +++ b/ndb/test/ndbapi/testSystemRestart.cpp @@ -872,7 +872,7 @@ int runSystemRestart7(NDBT_Context* ctx, NDBT_Step* step){ const Uint32 nodeCount = restarter.getNumDbNodes(); if(nodeCount < 2){ - g_info << "SR8 - Needs atleast 2 nodes to test" << endl; + g_info << "SR7 - Needs atleast 2 nodes to test" << endl; return NDBT_OK; } @@ -1001,7 +1001,52 @@ int runSystemRestart8(NDBT_Context* ctx, NDBT_Step* step){ i++; } - g_info << "runSystemRestart7 finished" << endl; + g_info << "runSystemRestart8 finished" << endl; + + return result; +} + +int runSystemRestart9(NDBT_Context* ctx, NDBT_Step* step){ + Ndb* pNdb = GETNDB(step); + int result = NDBT_OK; + int timeout = 300; + Uint32 loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + NdbRestarter restarter; + Uint32 i = 1; + + Uint32 currentRestartNodeIndex = 1; + UtilTransactions utilTrans(*ctx->getTab()); + HugoTransactions hugoTrans(*ctx->getTab()); + + int args[] = { DumpStateOrd::DihMaxTimeBetweenLCP }; + int dump[] = { DumpStateOrd::DihStartLcpImmediately }; + + do { + CHECK(restarter.dumpStateAllNodes(args, 1) == 0); + + HugoOperations ops(* ctx->getTab()); + CHECK(ops.startTransaction(pNdb) == 0); + for(i = 0; i<10; i++){ + CHECK(ops.pkInsertRecord(pNdb, i, 1, 1) == 0); + CHECK(ops.execute_NoCommit(pNdb) == 0); + } + for(i = 0; i<10; i++){ + CHECK(ops.pkUpdateRecord(pNdb, i, 1) == 0); + CHECK(ops.execute_NoCommit(pNdb) == 0); + } + NdbSleep_SecSleep(10); + CHECK(restarter.dumpStateAllNodes(dump, 1) == 0); + NdbSleep_SecSleep(10); + CHECK(ops.execute_Commit(pNdb) == 0); + + CHECK(restarter.restartAll() == 0); + CHECK(restarter.waitClusterStarted(timeout) == 0); + CHECK(pNdb->waitUntilReady(timeout) == 0); + ops.closeTransaction(pNdb); + } while(0); + + g_info << "runSystemRestart9 finished" << endl; return result; } @@ -1176,6 +1221,19 @@ TESTCASE("SR8", STEP(runSystemRestart8); FINALIZER(runClearTable); } +TESTCASE("SR9", + "Perform partition win system restart with other nodes delayed\n" + "* 1. Start transaction\n" + "* 2. insert (1,1)\n" + "* 3. update (1,2)\n" + "* 4. start lcp\n" + "* 5. commit\n" + "* 6. restart\n"){ + INITIALIZER(runWaitStarted); + INITIALIZER(runClearTable); + STEP(runSystemRestart9); + FINALIZER(runClearTable); +} NDBT_TESTSUITE_END(testSystemRestart); int main(int argc, const char** argv){ diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 522bbde32bc..64d11bc7701 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -190,3 +190,19 @@ max-time: 2500 cmd: test_event args: -n BasicEventOperation T1 T6 +# +max-time: 1500 +cmd: testSystemRestart +args: -n SR6 -l 1 T1 + +max-time: 1500 +cmd: testSystemRestart +args: -n SR7 -l 1 T1 + +max-time: 1500 +cmd: testSystemRestart +args: -n S8 -l 1 T1 + +max-time: 1500 +cmd: testSystemRestart +args: -n S9 -l 1 T1 From 0094f7e4ec1c1c5da01cbe1e916dbe8034c33a0b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Sep 2004 17:31:01 +0000 Subject: [PATCH 06/34] config parameter changed --- ndb/include/mgmapi/mgmapi_config_parameters.h | 6 ++---- ndb/src/common/mgmcommon/IPCConfig.cpp | 8 ++------ ndb/src/mgmsrv/ConfigInfo.cpp | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 3110d3bc830..6a0cd376355 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -125,10 +125,8 @@ #define CFG_SCI_HOST1_ID_1 551 #define CFG_SCI_HOST2_ID_0 552 #define CFG_SCI_HOST2_ID_1 553 -#define CFG_SCI_HOSTNAME_1 554 -#define CFG_SCI_HOSTNAME_2 555 -#define CFG_SCI_SEND_LIMIT 556 -#define CFG_SCI_BUFFER_MEM 557 +#define CFG_SCI_SEND_LIMIT 554 +#define CFG_SCI_BUFFER_MEM 555 #define CFG_OSE_PRIO_A_SIZE 602 #define CFG_OSE_PRIO_B_SIZE 603 diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp index b70881dd830..780504d2c62 100644 --- a/ndb/src/common/mgmcommon/IPCConfig.cpp +++ b/ndb/src/common/mgmcommon/IPCConfig.cpp @@ -398,18 +398,14 @@ IPCConfig::configureTransporters(Uint32 nodeId, } case CONNECTION_TYPE_SCI:{ SCI_TransporterConfiguration conf; - const char * host1, * host2; conf.localNodeId = nodeId; conf.remoteNodeId = remoteNodeId; conf.checksum = checksum; conf.signalId = sendSignalId; conf.port= server_port; - if(iter.get(CFG_SCI_HOSTNAME_1, &host1)) break; - if(iter.get(CFG_SCI_HOSTNAME_2, &host2)) break; - - conf.localHostName = (nodeId == nodeId1 ? host1 : host2); - conf.remoteHostName = (nodeId == nodeId1 ? host2 : host1); + conf.localHostName = localHostName; + conf.remoteHostName = remoteHostName; if(iter.get(CFG_SCI_SEND_LIMIT, &conf.sendLimit)) break; if(iter.get(CFG_SCI_BUFFER_MEM, &conf.bufferSize)) break; diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index a7c20a55eb7..0b7c664dfd3 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -1831,7 +1831,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { STR_VALUE(MAX_INT_RNIL) }, { - CFG_SCI_HOSTNAME_1, + CFG_CONNECTION_HOSTNAME_1, "HostName1", "SCI", "Name/IP of computer on one side of the connection", @@ -1842,7 +1842,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { 0, 0 }, { - CFG_SCI_HOSTNAME_2, + CFG_CONNECTION_HOSTNAME_2, "HostName2", "SCI", "Name/IP of computer on one side of the connection", From aa55c00558880bbccd5fae54a1a41da81d4e0281 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 05:48:52 +0200 Subject: [PATCH 07/34] misspelled testcase name --- ndb/test/run-test/daily-devel-tests.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 64d11bc7701..2497fa7d038 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -193,16 +193,16 @@ args: -n BasicEventOperation T1 T6 # max-time: 1500 cmd: testSystemRestart -args: -n SR6 -l 1 T1 +args: -l 1 -n SR6 T1 max-time: 1500 cmd: testSystemRestart -args: -n SR7 -l 1 T1 +args: -l 1 -n SR7 T1 max-time: 1500 cmd: testSystemRestart -args: -n S8 -l 1 T1 +args: -l 1 -n SR8 T1 max-time: 1500 cmd: testSystemRestart -args: -n S9 -l 1 T1 +args: -l 1 -n SR9 T1 From 71ead013168a1bf15af84037a7cd3da723323be7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 09:13:13 +0200 Subject: [PATCH 08/34] testScan - ReadWithLocksAndInserts testBasic LocksAndInserts ndb/test/src/HugoTransactions.cpp: Fix HugoTransaction::load so that transaction is closed and started if error is found --- ndb/test/src/HugoTransactions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ndb/test/src/HugoTransactions.cpp b/ndb/test/src/HugoTransactions.cpp index 53809ecc851..994a45de3dc 100644 --- a/ndb/test/src/HugoTransactions.cpp +++ b/ndb/test/src/HugoTransactions.cpp @@ -729,10 +729,9 @@ HugoTransactions::loadTable(Ndb* pNdb, NdbSleep_MilliSleep(doSleep); // if (first_batch || !oneTrans) { - if (first_batch) { + if (first_batch || !pTrans) { first_batch = false; pTrans = pNdb->startTransaction(); - if (pTrans == NULL) { const NdbError err = pNdb->getNdbError(); @@ -786,7 +785,7 @@ HugoTransactions::loadTable(Ndb* pNdb, if(check == -1 ) { const NdbError err = pTrans->getNdbError(); pNdb->closeTransaction(pTrans); - + pTrans= 0; switch(err.status){ case NdbError::Success: ERR(err); @@ -828,6 +827,7 @@ HugoTransactions::loadTable(Ndb* pNdb, else{ if (closeTrans) { pNdb->closeTransaction(pTrans); + pTrans= 0; } } From 22db858b5057e90ba80f49f9503c9b7884d478cb Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 09:27:34 +0200 Subject: [PATCH 09/34] Fix so that testBackup wait until start has finished before starting to restore --- ndb/test/ndbapi/testBackup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ndb/test/ndbapi/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp index 509cd4780bf..77b9d0a4baa 100644 --- a/ndb/test/ndbapi/testBackup.cpp +++ b/ndb/test/ndbapi/testBackup.cpp @@ -149,6 +149,9 @@ int runRestartInitial(NDBT_Context* ctx, NDBT_Step* step){ if (restarter.restartAll(true) != 0) return NDBT_FAILED; + if (restarter.waitClusterStarted() != 0) + return NDBT_FAILED; + return NDBT_OK; } @@ -413,7 +416,6 @@ TESTCASE("BackupOne", INITIALIZER(runRestoreOne); VERIFIER(runVerifyOne); FINALIZER(runClearTable); - FINALIZER(runDropTable); } TESTCASE("BackupBank", "Test that backup and restore works during transaction load\n" From ccf52b4fd5bd7ae0a418d22f2758cef345b6afa6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 15:50:07 +0400 Subject: [PATCH 10/34] A fix and test case for Bug#5315 "mysql_change_user() doesn't free prepared statements." include/hash.h: New declaration for hash_reset() function. The old version was not used. libmysql/client_settings.h: Declaration for mysql_detach_stmt_list(). libmysql/libmysql.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": add call to mysql_detach_stmt_list(prepared statements) to mysql_change_user(): all statements are freed by server, so client counterparts need to be marked as not usable. mysys/hash.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of hash_reset(), which frees all hash elements and prepares the hash for reuse. sql-common/client.c: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of mysql_detach_stmt_list(): zero connection pointer in given statement list, thus marking given statements as not usable. sql/sql_class.cc: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": reset prepared statements map in THD::change_user(). sql/sql_class.h: Fix for bug#5315 "mysql_change_user() doesn't free prepared statements": implementation of Statement_map::reset(). A little cleanup of ~Statement_map(): first empty names_hash, as st_hash has a free function, which will delete statements. tests/client_test.c: A test case for bug #5315 "mysql_change_user() doesn't free prepared statements". --- include/hash.h | 2 +- libmysql/client_settings.h | 1 + libmysql/libmysql.c | 31 ++++++++++++++++++---------- mysys/hash.c | 26 ++++++++++++++++++++++++ sql-common/client.c | 41 +++++++++++++++++++++++++------------- sql/sql_class.cc | 1 + sql/sql_class.h | 13 +++++++++--- tests/client_test.c | 30 ++++++++++++++++++++++++++++ 8 files changed, 116 insertions(+), 29 deletions(-) diff --git a/include/hash.h b/include/hash.h index c7cc118b7bd..6e6db27cd40 100644 --- a/include/hash.h +++ b/include/hash.h @@ -47,6 +47,7 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, uint key_length, hash_get_key get_key, void (*free_element)(void*), uint flags CALLER_INFO_PROTO); void hash_free(HASH *tree); +void hash_reset(HASH *hash); byte *hash_element(HASH *hash,uint idx); gptr hash_search(HASH *info,const byte *key,uint length); gptr hash_next(HASH *info,const byte *key,uint length); @@ -56,7 +57,6 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length); void hash_replace(HASH *hash, uint idx, byte *new_row); my_bool hash_check(HASH *hash); /* Only in debug library */ -#define hash_clear(H) bzero((char*) (H),sizeof(*(H))) #define hash_inited(H) ((H)->array.buffer != 0) #ifdef __cplusplus diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 5857c0c84d6..552307733ea 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -42,6 +42,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); +void mysql_detach_stmt_list(LIST **stmt_list); MYSQL * STDCALL cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6601d3e4ad7..2ad6771cc69 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -662,6 +662,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db) { char buff[512],*end=buff; + int rc; DBUG_ENTER("mysql_change_user"); if (!user) @@ -695,18 +696,26 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, /* Write authentication package */ simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1); - if ((*mysql->methods->read_change_user_result)(mysql, buff, passwd)) - DBUG_RETURN(1); - /* Free old connect information */ - my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + rc= (*mysql->methods->read_change_user_result)(mysql, buff, passwd); - /* alloc new connect information */ - mysql->user= my_strdup(user,MYF(MY_WME)); - mysql->passwd=my_strdup(passwd,MYF(MY_WME)); - mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0; - DBUG_RETURN(0); + /* + The server will close all statements no matter was the attempt + to change user successful or not. + */ + mysql_detach_stmt_list(&mysql->stmts); + if (rc == 0) + { + /* Free old connect information */ + my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + + /* alloc new connect information */ + mysql->user= my_strdup(user,MYF(MY_WME)); + mysql->passwd=my_strdup(passwd,MYF(MY_WME)); + mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0; + } + DBUG_RETURN(rc); } #if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL) diff --git a/mysys/hash.c b/mysys/hash.c index ce25ae89b63..6f2788ddce7 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -88,6 +88,32 @@ void hash_free(HASH *hash) DBUG_VOID_RETURN; } + +/* + Delete all elements from the hash (the hash itself is to be reused). + + SYNOPSIS + hash_reset() + hash the hash to delete elements of +*/ + +void hash_reset(HASH *hash) +{ + DBUG_ENTER("hash_reset"); + if (hash->free) + { + HASH_LINK *link= dynamic_element(&hash->array, 0, HASH_LINK*); + HASH_LINK *end= link + hash->records; + for (; link < end; ++link) + (*hash->free)(link->data); + } + reset_dynamic(&hash->array); + hash->records= 0; + hash->blength= 1; + hash->current_record= NO_RECORD; + DBUG_VOID_RETURN; +} + /* some helper functions */ /* diff --git a/sql-common/client.c b/sql-common/client.c index 930388d2459..43e116eb0b6 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2239,6 +2239,32 @@ static void mysql_close_free(MYSQL *mysql) } +/* + Clear connection pointer of every statement: this is necessary + to give error on attempt to use a prepared statement of closed + connection. + + SYNOPSYS + mysql_detach_stmt_list() + stmt_list pointer to mysql->stmts +*/ + +void mysql_detach_stmt_list(LIST **stmt_list) +{ +#ifdef MYSQL_CLIENT + /* Reset connection handle in all prepared statements. */ + LIST *element= *stmt_list; + for (; element; element= element->next) + { + MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; + stmt->mysql= 0; + /* No need to call list_delete for statement here */ + } + *stmt_list= 0; +#endif /* MYSQL_CLIENT */ +} + + void STDCALL mysql_close(MYSQL *mysql) { DBUG_ENTER("mysql_close"); @@ -2255,20 +2281,7 @@ void STDCALL mysql_close(MYSQL *mysql) } mysql_close_free_options(mysql); mysql_close_free(mysql); -#ifdef MYSQL_CLIENT - if (mysql->stmts) - { - /* Reset connection handle in all prepared statements. */ - LIST *element; - for (element= mysql->stmts; element; element= element->next) - { - MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; - stmt->mysql= 0; - /* No need to call list_delete for statement here */ - } - mysql->stmts= 0; - } -#endif /*MYSQL_CLIENT*/ + mysql_detach_stmt_list(&mysql->stmts); #ifndef TO_BE_DELETED /* free/close slave list */ if (mysql->rpl_pivot) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 16c0c206df3..bc8820a3a44 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -328,6 +328,7 @@ void THD::change_user(void) cleanup(); cleanup_done= 0; init(); + stmt_map.reset(); hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0, (hash_get_key) get_var_key, (hash_free_key) free_user_var, 0); diff --git a/sql/sql_class.h b/sql/sql_class.h index 387bba43cad..09b44568f90 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -566,7 +566,7 @@ public: assignment in Statement::Statement) Non-empty statement names are unique too: attempt to insert a new statement with duplicate name causes older statement to be deleted - + Statements are auto-deleted when they are removed from the map and when the map is deleted. */ @@ -575,7 +575,7 @@ class Statement_map { public: Statement_map(); - + int insert(Statement *statement); Statement *find_by_name(LEX_STRING *name) @@ -608,11 +608,18 @@ public: } hash_delete(&st_hash, (byte *) statement); } + /* Erase all statements (calls Statement destructor) */ + void reset() + { + hash_reset(&names_hash); + hash_reset(&st_hash); + last_found_statement= 0; + } ~Statement_map() { - hash_free(&st_hash); hash_free(&names_hash); + hash_free(&st_hash); } private: HASH st_hash; diff --git a/tests/client_test.c b/tests/client_test.c index 0a4d635984d..accefb668a8 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10391,6 +10391,34 @@ static void test_bug5194() } +static void test_bug5315() +{ + MYSQL_STMT *stmt; + const char *stmt_text; + int rc; + + myheader("test_bug5315"); + + stmt_text= "SELECT 1"; + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + DBUG_ASSERT(rc == 0); + mysql_change_user(mysql, opt_user, opt_password, current_db); + rc= mysql_stmt_execute(stmt); + DBUG_ASSERT(rc != 0); + if (rc) + printf("Got error (as expected):\n%s", mysql_stmt_error(stmt)); + /* check that connection is OK */ + mysql_stmt_close(stmt); + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + DBUG_ASSERT(rc == 0); + rc= mysql_stmt_execute(stmt); + DBUG_ASSERT(rc == 0); + mysql_stmt_close(stmt); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10694,6 +10722,8 @@ int main(int argc, char **argv) test_bug5399(); /* check that statement id uniquely identifies statement */ test_bug5194(); /* bulk inserts in prepared mode */ + test_bug5315(); /* check that mysql_change_user closes all + prepared statements */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. From 126ea49d08dda845740c2f9c93531b69bc707873 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 22:36:53 +0500 Subject: [PATCH 11/34] Additional fix for bug #5136 (Geometry object is corrupted when queried) CREATE TABLE t1 SELECT POINT(1,2); fixed mysql-test/r/gis.result: Appropriate test result mysql-test/t/gis.test: test case sql/item_geofunc.cc: Item_geometry_func::fix_lengths_and_dec implementation several fix_length_and_dec's not needed now sql/item_geofunc.h: Item_geometry_func class presented --- mysql-test/r/gis.result | 7 +++++ mysql-test/t/gis.test | 4 +++ sql/item_geofunc.cc | 25 +++++----------- sql/item_geofunc.h | 64 +++++++++++++++++++++-------------------- 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 9f5dd286cf9..fd71cad36a6 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -485,3 +485,10 @@ MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); AsText(a) POINT(1 1) drop table t1; +create table t1 select POINT(1,3); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `POINT(1,3)` longblob NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index e35b9996a44..30da019be3e 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -190,3 +190,7 @@ select AsText(a) from t1 where and MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); drop table t1; + +create table t1 select POINT(1,3); +show create table t1; +drop table t1; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 790fdcd5cd1..935925c1e83 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -27,6 +27,13 @@ #include "sql_acl.h" #include +void Item_geometry_func::fix_length_and_dec() +{ + collation.set(&my_charset_bin); + decimals=0; + max_length=MAX_BLOB_WIDTH; +} + String *Item_func_geometry_from_text::val_str(String *str) { @@ -55,12 +62,6 @@ String *Item_func_geometry_from_text::val_str(String *str) } -void Item_func_geometry_from_text::fix_length_and_dec() -{ - max_length=MAX_BLOB_WIDTH; -} - - String *Item_func_geometry_from_wkb::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -86,12 +87,6 @@ String *Item_func_geometry_from_wkb::val_str(String *str) } -void Item_func_geometry_from_wkb::fix_length_and_dec() -{ - max_length=MAX_BLOB_WIDTH; -} - - String *Item_func_as_wkt::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -140,12 +135,6 @@ String *Item_func_as_wkb::val_str(String *str) } -void Item_func_as_wkb::fix_length_and_dec() -{ - max_length= MAX_BLOB_WIDTH; -} - - String *Item_func_geometry_type::val_str(String *str) { DBUG_ASSERT(fixed == 1); diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index a1f36130152..79e4f804a04 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -23,24 +23,33 @@ #pragma interface /* gcc class implementation */ #endif -class Item_func_geometry_from_text: public Item_str_func +class Item_geometry_func: public Item_str_func { public: - Item_func_geometry_from_text(Item *a) :Item_str_func(a) {} - Item_func_geometry_from_text(Item *a, Item *srid) :Item_str_func(a, srid) {} - const char *func_name() const { return "geometryfromtext"; } - String *val_str(String *); + Item_geometry_func() :Item_str_func() {} + Item_geometry_func(Item *a) :Item_str_func(a) {} + Item_geometry_func(Item *a,Item *b) :Item_str_func(a,b) {} + Item_geometry_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {} + Item_geometry_func(List &list) :Item_str_func(list) {} void fix_length_and_dec(); }; -class Item_func_geometry_from_wkb: public Item_str_func +class Item_func_geometry_from_text: public Item_geometry_func { public: - Item_func_geometry_from_wkb(Item *a): Item_str_func(a) {} - Item_func_geometry_from_wkb(Item *a, Item *srid): Item_str_func(a, srid) {} + Item_func_geometry_from_text(Item *a) :Item_geometry_func(a) {} + Item_func_geometry_from_text(Item *a, Item *srid) :Item_geometry_func(a, srid) {} + const char *func_name() const { return "geometryfromtext"; } + String *val_str(String *); +}; + +class Item_func_geometry_from_wkb: public Item_geometry_func +{ +public: + Item_func_geometry_from_wkb(Item *a): Item_geometry_func(a) {} + Item_func_geometry_from_wkb(Item *a, Item *srid): Item_geometry_func(a, srid) {} const char *func_name() const { return "geometryfromwkb"; } String *val_str(String *); - void fix_length_and_dec(); }; class Item_func_as_wkt: public Item_str_func @@ -52,13 +61,12 @@ public: void fix_length_and_dec(); }; -class Item_func_as_wkb: public Item_str_func +class Item_func_as_wkb: public Item_geometry_func { public: - Item_func_as_wkb(Item *a): Item_str_func(a) {} + Item_func_as_wkb(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "aswkb"; } String *val_str(String *); - void fix_length_and_dec(); }; class Item_func_geometry_type: public Item_str_func @@ -73,40 +81,37 @@ public: }; }; -class Item_func_centroid: public Item_str_func +class Item_func_centroid: public Item_geometry_func { public: - Item_func_centroid(Item *a): Item_str_func(a) {} + Item_func_centroid(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "centroid"; } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} }; -class Item_func_envelope: public Item_str_func +class Item_func_envelope: public Item_geometry_func { public: - Item_func_envelope(Item *a): Item_str_func(a) {} + Item_func_envelope(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "envelope"; } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} }; -class Item_func_point: public Item_str_func +class Item_func_point: public Item_geometry_func { public: - Item_func_point(Item *a, Item *b): Item_str_func(a, b) {} - Item_func_point(Item *a, Item *b, Item *srid): Item_str_func(a, b, srid) {} + Item_func_point(Item *a, Item *b): Item_geometry_func(a, b) {} + Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {} const char *func_name() const { return "point"; } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} }; -class Item_func_spatial_decomp: public Item_str_func +class Item_func_spatial_decomp: public Item_geometry_func { enum Functype decomp_func; public: Item_func_spatial_decomp(Item *a, Item_func::Functype ft) : - Item_str_func(a) { decomp_func = ft; } + Item_geometry_func(a) { decomp_func = ft; } const char *func_name() const { switch (decomp_func) @@ -123,15 +128,14 @@ public: } } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} }; -class Item_func_spatial_decomp_n: public Item_str_func +class Item_func_spatial_decomp_n: public Item_geometry_func { enum Functype decomp_func_n; public: Item_func_spatial_decomp_n(Item *a, Item *b, Item_func::Functype ft): - Item_str_func(a, b) { decomp_func_n = ft; } + Item_geometry_func(a, b) { decomp_func_n = ft; } const char *func_name() const { switch (decomp_func_n) @@ -148,10 +152,9 @@ public: } } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} }; -class Item_func_spatial_collection: public Item_str_func +class Item_func_spatial_collection: public Item_geometry_func { String tmp_value; enum Geometry::wkbType coll_type; @@ -159,13 +162,12 @@ class Item_func_spatial_collection: public Item_str_func public: Item_func_spatial_collection( List &list, enum Geometry::wkbType ct, enum Geometry::wkbType it): - Item_str_func(list) + Item_geometry_func(list) { coll_type=ct; item_type=it; } String *val_str(String *); - void fix_length_and_dec(){max_length=MAX_BLOB_WIDTH;} const char *func_name() const { return "multipoint"; } }; From 99e809cbd944a58417a851b37db4848d6661bbb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Sep 2004 18:27:03 +0000 Subject: [PATCH 12/34] debug printout --- ndb/src/ndbapi/DictCache.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index 12300ce216f..d395e3c9847 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -70,6 +70,27 @@ LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){ void LocalDictCache::drop(const char * name){ Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); + +#ifndef DBUG_OFF + if (info == 0) { + ndbout_c("LocalDictCache::drop(%s) info==0", name); + ndbout_c("dump begin"); + NdbElement_t * curr = m_tableHash.getNext(0); + while(curr != 0){ + Ndb_local_table_info *tmp = curr->theData; + if (tmp) { + ndbout_c("m_table_impl=0x%x, id=%d, name=%s", + tmp->m_table_impl, + tmp->m_table_impl->m_tableId, + tmp->m_table_impl->getName()); + } else { + ndbout_c("NULL"); + } + curr = m_tableHash.getNext(curr); + } + ndbout_c("dump end"); + } +#endif DBUG_ASSERT(info != 0); Ndb_local_table_info::destroy(info); } From 8090516c5250f1d1873adf5f312fc16e70e3f6be Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 09:25:05 +0200 Subject: [PATCH 13/34] bug#5702 Check index version already in master to prevent "non-atmoic" failing drop index ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Check index version already in master to prevent "non-atmoic" failing drop index --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 4757f1d2bf3..b214538bce0 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -6545,6 +6545,8 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) jamEntry(); DropIndxReq* const req = (DropIndxReq*)signal->getDataPtrSend(); OpDropIndexPtr opPtr; + + int err = DropIndxRef::BadRequestType; const Uint32 senderRef = signal->senderBlockRef(); const DropIndxReq::RequestType requestType = req->getRequestType(); if (requestType == DropIndxReq::RT_USER) { @@ -6559,6 +6561,20 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) return; } // forward initial request plus operation key to all + Uint32 indexId= req->getIndexId(); + Uint32 indexVersion= req->getIndexVersion(); + TableRecordPtr tmp; + int res = getMetaTablePtr(tmp, indexId, indexVersion); + switch(res){ + case MetaData::InvalidArgument: + case MetaData::TableNotFound: + err = DropTableRef::NoSuchTable; + goto error; + case MetaData::InvalidTableVersion: + err = DropIndxRef::InvalidIndexVersion; + goto error; + } + req->setOpKey(++c_opRecordSequence); NodeReceiverGroup rg(DBDICT, c_aliveNodes); sendSignal(rg, GSN_DROP_INDX_REQ, @@ -6608,12 +6624,13 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) return; } } +error: jam(); // return to sender OpDropIndex opBad; opPtr.p = &opBad; opPtr.p->save(req); - opPtr.p->m_errorCode = DropIndxRef::BadRequestType; + opPtr.p->m_errorCode = (DropIndxRef::ErrorCode)err; opPtr.p->m_errorLine = __LINE__; dropIndex_sendReply(signal, opPtr, true); } From 7ba5d931eb6611a1b3794d3c4378381060ac925d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 13:48:17 +0400 Subject: [PATCH 14/34] Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work with memory roots in THD/Statement/Item_arena. Added assertions preventing memory allocation on bzero'ed MEM_ROOT since it is worked by pure luck and was very ineffective. include/my_sys.h: Reimplementation of Monty's optimization of clear_alloc_root(). Now clear_alloc_root() can be used only for detaching memory associated with MEM_ROOT (e.g. to avoid its freeing). It can not be used for MEM_ROOT initialization any longer (it was bad idea anyway since memory allocation on such MEM_ROOT was very ineffective and worked by pure luck). Introduced ALLOC_ROOT_MIN_BLOCK_SIZE constant. mysys/my_alloc.c: Added description of init_alloc_root(). Added assertions to alloc_root() and reset_root_defaults() so now they can only be used on previosly initialized MEM_ROOT. (It worked for bzeroed MEM_ROOT before but by pure luck and very inefficiently). Calling free_root() on bzero'ed MEM_ROOT is still ok (we can't remove this easily because of static MEM_ROOTs). Also now using ALLOC_ROOT_MIN_BLOCK_SIZE constant inside these functions. sql/opt_range.cc: Fixed get_quick_select_for_ref() function to not use bzero'ed MEM_ROOT for allocation. Also QUICK_RANGEs created in this function should be created in memory root of QUICK_SELECT. sql/sql_class.cc: Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work with memory roots in THD/Statement/Item_arena. Now we are always initing THD::transaction.mem_root and THD::mem_root in THD constructor (without memory allocation and with minimal block size) and then later change their parameters in THD::init_for_queries() (this is partially because we can't allocate anything on bzero'ed memory roots anymore). Item_arena() constructor is now trivial and is used only then Item_arena is created as backup storage for other Item_arena (we use Item_arena(bool) now if it is part of Statement). Both trivial Item_arena constructor and destructor are now inline. Removed unneeded clear_alloc_root from Item_arena::restore_backup_item_arena(). sql/sql_class.h: Both trivial Item_arena constructor and destructor are now inline. Commented various Item_arena constructors. --- include/my_sys.h | 3 +- mysys/my_alloc.c | 37 ++++++++++++++++++++---- sql/opt_range.cc | 8 ++++-- sql/sql_class.cc | 73 +++++++++++++++++++++++++++++++----------------- sql/sql_class.h | 16 +++++++++-- 5 files changed, 102 insertions(+), 35 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index ad1966ba67f..271e0ea0bcb 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -725,7 +725,8 @@ extern void my_free_lock(byte *ptr,myf flags); #define my_free_lock(A,B) my_free((A),(B)) #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) -#define clear_alloc_root(A) bzero((void *) (A), sizeof(MEM_ROOT)) +#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) +#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; } while(0) extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size); extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index c9784ddc9a0..f0bc62b10a0 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -22,6 +22,27 @@ #undef EXTRA_DEBUG #define EXTRA_DEBUG + +/* + Initialize memory root + + SYNOPSIS + init_alloc_root() + mem_root - memory root to initialize + block_size - size of chunks (blocks) used for memory allocation + (It is external size of chunk i.e. it should include + memory required for internal structures, thus it + should be no less than ALLOC_ROOT_MIN_BLOCK_SIZE) + pre_alloc_size - if non-0, then size of block that should be + pre-allocated during memory root initialization. + + DESCRIPTION + This function prepares memory root for further use, sets initial size of + chunk for memory allocation and pre-allocates first block if specified. + Altough error can happen during execution of this function if pre_alloc_size + is non-0 it won't be reported. Instead it will be reported as error in first + alloc_root() on this memory root. +*/ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { @@ -29,7 +50,7 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, DBUG_PRINT("enter",("root: 0x%lx", mem_root)); mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; - mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; mem_root->error_handler= 0; mem_root->block_num= 4; /* We shift this with >>2 */ mem_root->first_block_usage= 0; @@ -54,9 +75,9 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, SYNOPSIS reset_root_defaults() mem_root memory root to change defaults of - block_size new value of block size. Must be - greater than ~68 bytes (the exact value depends on - platform and compilation flags) + block_size new value of block size. Must be greater or equal + than ALLOC_ROOT_MIN_BLOCK_SIZE (this value is about + 68 bytes and depends on platform and compilation flags) pre_alloc_size new size of preallocated block. If not zero, must be equal to or greater than block size, otherwise means 'no prealloc'. @@ -70,7 +91,9 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, void reset_root_defaults(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { - mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; + DBUG_ASSERT(alloc_root_inited(mem_root)); + + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) if (pre_alloc_size) { @@ -123,6 +146,8 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) DBUG_ENTER("alloc_root"); DBUG_PRINT("enter",("root: 0x%lx", mem_root)); + DBUG_ASSERT(alloc_root_inited(mem_root)); + Size+=ALIGN_SIZE(sizeof(USED_MEM)); if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME)))) { @@ -140,6 +165,8 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) reg1 USED_MEM *next= 0; reg2 USED_MEM **prev; + DBUG_ASSERT(alloc_root_inited(mem_root)); + Size= ALIGN_SIZE(Size); if ((*(prev= &mem_root->free)) != NULL) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 27e8e9c11e7..9c5b0235767 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2554,7 +2554,8 @@ static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length) QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) { - QUICK_SELECT *quick=new QUICK_SELECT(thd, table, ref->key, 1); + MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC); + QUICK_SELECT *quick= new QUICK_SELECT(thd, table, ref->key); KEY *key_info = &table->key_info[ref->key]; KEY_PART *key_part; QUICK_RANGE *range; @@ -2566,7 +2567,7 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) { if (thd->is_fatal_error) goto err; // out of memory - return quick; // empty range + goto ok; // empty range } if (!(range= new QUICK_RANGE())) @@ -2613,9 +2614,12 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref) goto err; } +ok: + my_pthread_setspecific_ptr(THR_MALLOC, old_root); return quick; err: + my_pthread_setspecific_ptr(THR_MALLOC, old_root); delete quick; return 0; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 16c0c206df3..2074f0f5d40 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -221,7 +221,6 @@ THD::THD() init(); /* Initialize sub structures */ - clear_alloc_root(&transaction.mem_root); init_alloc_root(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE); user_connect=(USER_CONN *)0; hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0, @@ -258,6 +257,7 @@ THD::THD() transaction.trans_log.end_of_file= max_binlog_cache_size; } #endif + init_alloc_root(&transaction.mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); { ulong tmp=sql_rnd_with_mutex(); randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id); @@ -303,12 +303,12 @@ void THD::init(void) void THD::init_for_queries() { ha_enable_transaction(this,TRUE); - init_sql_alloc(&mem_root, - variables.query_alloc_block_size, - variables.query_prealloc_size); - init_sql_alloc(&transaction.mem_root, - variables.trans_alloc_block_size, - variables.trans_prealloc_size); + + reset_root_defaults(&mem_root, variables.query_alloc_block_size, + variables.query_prealloc_size); + reset_root_defaults(&transaction.mem_root, + variables.trans_alloc_block_size, + variables.trans_prealloc_size); } @@ -1331,6 +1331,17 @@ void select_dumpvar::cleanup() } +/* + Create arena for already constructed THD. + + SYNOPSYS + Item_arena() + thd - thread for which arena is created + + DESCRIPTION + Create arena for already existing THD using its variables as parameters + for memory root initialization. +*/ Item_arena::Item_arena(THD* thd) :free_list(0), state(INITIALIZED) @@ -1341,24 +1352,31 @@ Item_arena::Item_arena(THD* thd) } -/* This constructor is called when Item_arena is a subobject of THD */ +/* + Create arena and optionally initialize memory root. -Item_arena::Item_arena() + SYNOPSYS + Item_arena() + init_mem_root - whenever we need to initialize memory root + + DESCRIPTION + Create arena and optionally initialize memory root with minimal + possible parameters. + + NOTE + We use this constructor when arena is part of THD, but reinitialize + its memory root in THD::init_for_queries() before execution of real + statements. +*/ +Item_arena::Item_arena(bool init_mem_root) :free_list(0), state(CONVENTIONAL_EXECUTION) -{ - clear_alloc_root(&mem_root); -} - - -Item_arena::Item_arena(bool init_mem_root) - :free_list(0), - state(INITIALIZED) { if (init_mem_root) - clear_alloc_root(&mem_root); + init_alloc_root(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); } + Item_arena::Type Item_arena::type() const { DBUG_ASSERT("Item_arena::type()" == "abstract"); @@ -1366,10 +1384,6 @@ Item_arena::Type Item_arena::type() const } -Item_arena::~Item_arena() -{} - - /* Statement functions */ @@ -1393,7 +1407,8 @@ Statement::Statement(THD *thd) */ Statement::Statement() - :id(0), + :Item_arena((bool)TRUE), + id(0), set_query_id(1), allow_sum_func(0), /* initialized later */ lex(&main_lex), @@ -1461,8 +1476,16 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup) { set->set_item_arena(this); set_item_arena(backup); - // reset backup mem_root to avoid its freeing - init_alloc_root(&backup->mem_root, 0, 0); +#ifdef NOT_NEEDED_NOW + /* + Reset backup mem_root to avoid its freeing. + Since Item_arena's mem_root is freed only when it is part of Statement + we need this only if we use some Statement's arena as backup storage. + But we do this only with THD::stmt_backup and this Statement is specially + handled in this respect. So this code is not really needed now. + */ + clear_alloc_root(&backup->mem_root); +#endif } void Item_arena::set_item_arena(Item_arena *set) diff --git a/sql/sql_class.h b/sql/sql_class.h index 387bba43cad..89bf2dde12e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -441,11 +441,23 @@ public: STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE }; + /* + This constructor is used only when Item_arena is created as + backup storage for another instance of Item_arena. + */ + Item_arena() {}; + /* + Create arena for already constructed THD using its variables as + parameters for memory root initialization. + */ Item_arena(THD *thd); - Item_arena(); + /* + Create arena and optionally init memory root with minimal values. + Particularly used if Item_arena is part of Statement. + */ Item_arena(bool init_mem_root); virtual Type type() const; - virtual ~Item_arena(); + virtual ~Item_arena() {}; inline bool is_stmt_prepare() const { return (int)state < (int)PREPARED; } inline bool is_first_stmt_execute() const { return state == PREPARED; } From b76d3b4f70541e404f0dd4499ba241ece4cdce41 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 12:16:56 +0200 Subject: [PATCH 15/34] Fix for BUG#5705: "SET CHARATER_SET_SERVERetc will be lost if STOP SLAVE before following query": we do not increment rli->group_master_log_pos if we are just after a SET ONE_SHOT (it's not a standalone event) mysql-test/r/rpl_charset.result: testing interruption of slave SQL thread between SET CHARACTER_SET_SERVER... and the companion INSERT. mysql-test/t/rpl_charset.test: testing interruption of slave SQL thread between SET CHARACTER_SET_SERVER... and the companion INSERT. sql/log_event.cc: we do not increment rli->group_master_log_pos if we are just after a SET ONE_SHOT, because SET ONE_SHOT should not be separated from its following updating query. --- mysql-test/r/rpl_charset.result | 8 ++++++++ mysql-test/t/rpl_charset.test | 18 ++++++++++++++++++ sql/log_event.cc | 10 +++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index a60c9269625..54cce23b301 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -198,4 +198,12 @@ CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 select hex(c1), hex(c2) from t1; hex(c1) hex(c2) CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 +stop slave; +delete from t1; +change master to master_log_pos=5801; +start slave until master_log_file='master-bin.000001', master_log_pos=5937; +start slave; +select hex(c1), hex(c2) from t1; +hex(c1) hex(c2) +CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 drop table t1; diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index 83e7d95e28c..9b9f53a94de 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -148,6 +148,24 @@ INSERT INTO t1 (c1, c2) VALUES (' select hex(c1), hex(c2) from t1; sync_slave_with_master; select hex(c1), hex(c2) from t1; + +# Now test for BUG##5705: SET CHARATER_SET_SERVERetc will be lost if +# STOP SLAVE before following query + +stop slave; +delete from t1; +change master to master_log_pos=5801; +start slave until master_log_file='master-bin.000001', master_log_pos=5937; +# Slave is supposed to stop _after_ the INSERT, even though 5937 is +# the position of the beginning of the INSERT; after SET slave is not +# supposed to increment position. +wait_for_slave_to_stop; +# When you merge this into 5.0 you will have to adjust positions +# above; the first master_log_pos above should be the one of the SET, +# the second should be the one of the INSERT. +start slave; +sync_with_master; +select hex(c1), hex(c2) from t1; connection master; drop table t1; sync_slave_with_master; diff --git a/sql/log_event.cc b/sql/log_event.cc index 1f30e932c01..326f2fc5c59 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1091,7 +1091,15 @@ end: VOID(pthread_mutex_unlock(&LOCK_thread_count)); close_thread_tables(thd); free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); - return (thd->query_error ? thd->query_error : Log_event::exec_event(rli)); + /* + If there was an error we stop. Otherwise we increment positions. Note that + we will not increment group* positions if we are just after a SET + ONE_SHOT, because SET ONE_SHOT should not be separated from its following + updating query. + */ + return (thd->query_error ? thd->query_error : + (thd->one_shot_set ? (rli->inc_event_relay_log_pos(get_event_len()),0) : + Log_event::exec_event(rli))); } #endif From edcccfbc4b71152af849f53fc3760a05e1e0d4bb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 18:01:55 +0400 Subject: [PATCH 16/34] A fix and test case for bug#5688 "Upgraded 4.1.5 Server seg faults" mysql-test/r/ps.result: Test results fixed: the test case for bug#5688 "Upgraded 4.1.5 Server seg faults" mysql-test/t/ps.test: Test case for bug#5688 "Upgraded 4.1.5 Server seg faults" sql/item_cmpfunc.cc: A fix for bug#5688 "Upgraded 4.1.5 Server seg faults": fix just another place where we use wrong memory root for an Item in statement prepare. In addition, make the check for charsets in Item_bool_func2 more generic (fixes the test case when we use LIKE to compare BLOBs with TEXT data). --- mysql-test/r/ps.result | 8 ++++++++ mysql-test/t/ps.test | 10 ++++++++++ sql/item_cmpfunc.cc | 26 ++++++++++++++------------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 8742ac29989..12337d358e1 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -289,3 +289,11 @@ execute stmt using @var; select * from t1; deallocate prepare stmt; drop table t1; +prepare stmt from "select 'abc' like convert('abc' using utf8)"; +execute stmt; +'abc' like convert('abc' using utf8) +1 +execute stmt; +'abc' like convert('abc' using utf8) +1 +deallocate prepare stmt; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index af356ca2a09..4b63a7db95f 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -304,3 +304,13 @@ select * from t1; deallocate prepare stmt; drop table t1; +# +# BUG#5688 "Upgraded 4.1.5 Server seg faults" # (prepared statements) +# The test case speaks for itself. +# Just another place where we used wrong memory root for Items created +# during statement prepare. +# +prepare stmt from "select 'abc' like convert('abc' using utf8)"; +execute stmt; +execute stmt; +deallocate prepare stmt; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 85b22d1eddd..8950ad0c594 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -188,17 +188,27 @@ void Item_bool_func2::fix_length_and_dec() { uint strong= 0; uint weak= 0; + uint32 dummy_offset; DTCollation coll; if (args[0]->result_type() == STRING_RESULT && args[1]->result_type() == STRING_RESULT && - !my_charset_same(args[0]->collation.collation, - args[1]->collation.collation) && + String::needs_conversion(0, args[0]->collation.collation, + args[1]->collation.collation, + &dummy_offset) && !coll.set(args[0]->collation, args[1]->collation, TRUE)) { Item* conv= 0; + THD *thd= current_thd; + Item_arena *arena= thd->current_arena, backup; strong= coll.strong; weak= strong ? 0 : 1; + /* + In case we're in statement prepare, create conversion item + in its memory: it will be reused on each execute. + */ + if (arena->is_stmt_prepare()) + thd->set_n_backup_item_arena(arena, &backup); if (args[weak]->type() == STRING_ITEM) { String tmp, cstr; @@ -211,21 +221,13 @@ void Item_bool_func2::fix_length_and_dec() } else { - THD *thd= current_thd; - /* - In case we're in statement prepare, create conversion item - in its memory: it will be reused on each execute. - */ - Item_arena *arena= thd->current_arena, backup; - if (arena->is_stmt_prepare()) - thd->set_n_backup_item_arena(arena, &backup); conv= new Item_func_conv_charset(args[weak], args[strong]->collation.collation); - if (arena->is_stmt_prepare()) - thd->restore_backup_item_arena(arena, &backup); conv->collation.set(args[weak]->collation.derivation); conv->fix_fields(thd, 0, &conv); } + if (arena->is_stmt_prepare()) + thd->restore_backup_item_arena(arena, &backup); args[weak]= conv ? conv : args[weak]; } } From f2821fa13ced6fe7946c806fbfea887675fe6e2f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2004 20:38:18 +0400 Subject: [PATCH 17/34] fix client_test to be a bit faster under valgrind. --- tests/client_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client_test.c b/tests/client_test.c index accefb668a8..a2b0791baa2 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10251,7 +10251,7 @@ static void test_bug5194() /* Number of columns per row */ const int COLUMN_COUNT= sizeof(float_array)/sizeof(*float_array); /* Number of rows per bulk insert to start with */ - const int MIN_ROWS_PER_INSERT= 260; + const int MIN_ROWS_PER_INSERT= 262; /* Max number of rows per bulk insert to end with */ const int MAX_ROWS_PER_INSERT= 300; const int MAX_PARAM_COUNT= COLUMN_COUNT*MAX_ROWS_PER_INSERT; From c9a03e1781d5ffb6640f270caa53386819726be5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 13:14:44 +0500 Subject: [PATCH 18/34] logging_ok: Logging to logging@openlogging.org accepted sql_show.cc, type_enum.test, type_enum.result: Bug #5628 German characters in field-defs will be '?' with some table definitions mysql-test/r/type_enum.result: Bug #5628 German characters in field-defs will be '?' with some table definitions mysql-test/t/type_enum.test: Bug #5628 German characters in field-defs will be '?' with some table definitions sql/sql_show.cc: Bug #5628 German characters in field-defs will be '?' with some table definitions BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/type_enum.result | 16 ++++++++++++++++ mysql-test/t/type_enum.test | 14 ++++++++++++++ sql/sql_show.cc | 2 ++ 4 files changed, 33 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index b0c0a611033..da85ed6391f 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -24,6 +24,7 @@ bar@bar.udmsearch.izhnet.ru bar@deer.(none) bar@gw.udmsearch.izhnet.ru bar@mysql.com +bar@noter.intranet.mysql.r18.ru bell@laptop.sanja.is.com.ua bell@sanja.is.com.ua bk@admin.bk diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 976c484dabf..a94e90885db 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1661,3 +1661,19 @@ t1 CREATE TABLE `t1` ( `a` enum('ä','1','2') NOT NULL default 'ä' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +set names latin1; +CREATE TABLE t1 ( +a INT default 1, +b ENUM('value','öäü_value','ÊÃÕ') character set latin1 NOT NULL +); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) default '1', + `b` enum('value','öäü_value','ÊÃÕ') NOT NULL default 'value' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES 1 +b enum('value','öäü_value','ÊÃÕ') value +drop table t1; diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index b8f32107892..2f1e11810af 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -45,3 +45,17 @@ create table t1 (a enum(0xE4, '1', '2') not null default 0xE4); show columns from t1; show create table t1; drop table t1; + + +# +# Bug #5628 German characters in field-defs will be '?' +# with some table definitions +# +set names latin1; +CREATE TABLE t1 ( + a INT default 1, + b ENUM('value','öäü_value','ÊÃÕ') character set latin1 NOT NULL +); +show create table t1; +show columns from t1; +drop table t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 57c5f01d0bf..fbb45ce2484 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1265,6 +1265,8 @@ store_create_info(THD *thd, TABLE *table, String *packet) // check for surprises from the previous call to Field::sql_type() if (type.ptr() != tmp) type.set(tmp, sizeof(tmp), system_charset_info); + else + type.set_charset(system_charset_info); field->sql_type(type); packet->append(type.ptr(), type.length(), system_charset_info); From a366d6eefc1a52dc3c4097faff18787c91363d5e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 08:47:46 +0000 Subject: [PATCH 19/34] bug, releaseTableObject called twice bug, whole bucket removed if delete first element in bucket ndb/src/kernel/blocks/dbdict/Dbdict.cpp: bug, releaseTableObject called twice ndb/src/ndbapi/NdbLinHash.hpp: bug, whole bucket removed if delete first element in bucket --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 2 -- ndb/src/ndbapi/NdbLinHash.hpp | 11 ++++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index b214538bce0..1de5cd08a01 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -2868,7 +2868,6 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal) jam(); c_opCreateTable.release(alterTabPtr); parseRecord.tablePtr.p->tabState = TableRecord::NOT_DEFINED; - releaseTableObject(parseRecord.tablePtr.i, false); alterTableRef(signal, req, (AlterTableRef::ErrorCode) parseRecord.errorCode, aParseRecord); @@ -3054,7 +3053,6 @@ Dbdict::execALTER_TAB_REQ(Signal * signal) jam(); c_opCreateTable.release(alterTabPtr); parseRecord.tablePtr.p->tabState = TableRecord::NOT_DEFINED; - releaseTableObject(parseRecord.tablePtr.i, false); alterTabRef(signal, req, (AlterTableRef::ErrorCode) parseRecord.errorCode, aParseRecord); diff --git a/ndb/src/ndbapi/NdbLinHash.hpp b/ndb/src/ndbapi/NdbLinHash.hpp index f786600607f..f245a261a04 100644 --- a/ndb/src/ndbapi/NdbLinHash.hpp +++ b/ndb/src/ndbapi/NdbLinHash.hpp @@ -287,17 +287,14 @@ NdbLinHash::deleteKey ( const char* str, Uint32 len){ NdbElement_t **chainp = &directory[dir]->elements[seg]; for(NdbElement_t * chain = *chainp; chain != 0; chain = chain->next){ if(chain->len == len && !memcmp(chain->str, str, len)){ + C *data= chain->theData; if (oldChain == 0) { - C *data= chain->theData; - delete chain; - * chainp = 0; - return data; + * chainp = chain->next; } else { - C *data= chain->theData; oldChain->next = chain->next; - delete chain; - return data; } + delete chain; + return data; } else { oldChain = chain; } From 2917d9fdbbe24969002098f38605f9c67be8cff7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 12:38:38 +0200 Subject: [PATCH 20/34] Dbdict - set table state in releaseTableObject - make handleTabInfoInit release object if parsing fails - make sure table is not accessed is parsing fails --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 1de5cd08a01..115a94a2b5c 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -2867,7 +2867,6 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal) if(parseRecord.errorCode != 0){ jam(); c_opCreateTable.release(alterTabPtr); - parseRecord.tablePtr.p->tabState = TableRecord::NOT_DEFINED; alterTableRef(signal, req, (AlterTableRef::ErrorCode) parseRecord.errorCode, aParseRecord); @@ -3052,7 +3051,6 @@ Dbdict::execALTER_TAB_REQ(Signal * signal) if(parseRecord.errorCode != 0){ jam(); c_opCreateTable.release(alterTabPtr); - parseRecord.tablePtr.p->tabState = TableRecord::NOT_DEFINED; alterTabRef(signal, req, (AlterTableRef::ErrorCode) parseRecord.errorCode, aParseRecord); @@ -3437,7 +3435,6 @@ Dbdict::execALTER_TAB_CONF(Signal * signal){ // Release resources TableRecordPtr tabPtr; c_tableRecordPool.getPtr(tabPtr, regAlterTabPtr->m_tablePtrI); - tabPtr.p->tabState = TableRecord::NOT_DEFINED; releaseTableObject(tabPtr.i, false); c_opCreateTable.release(alterTabPtr); c_blockState = BS_IDLE; @@ -3571,7 +3568,6 @@ Dbdict::alterTab_writeTableConf(Signal* signal, jam(); // Release resources c_tableRecordPool.getPtr(tabPtr, regAlterTabPtr->m_tablePtrI); - tabPtr.p->tabState = TableRecord::NOT_DEFINED; releaseTableObject(tabPtr.i, false); c_opCreateTable.release(alterTabPtr); c_blockState = BS_IDLE; @@ -4459,7 +4455,6 @@ Dbdict::createTab_dropComplete(Signal* signal, TableRecordPtr tabPtr; c_tableRecordPool.getPtr(tabPtr, createTabPtr.p->m_tablePtrI); - tabPtr.p->tabState = TableRecord::NOT_DEFINED; releaseTableObject(tabPtr.i); PageRecordPtr pagePtr; @@ -5497,6 +5492,8 @@ void Dbdict::releaseTableObject(Uint32 tableId, bool removeFromHash) c_tableRecordPool.getPtr(tablePtr, tableId); if (removeFromHash) c_tableRecordHash.remove(tablePtr); + + tablePtr.p->tabState = TableRecord::NOT_DEFINED; Uint32 nextAttrRecord = tablePtr.p->firstAttribute; while (nextAttrRecord != RNIL) { From 99a020db026e0739d3281a3639261a28f6862654 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 13:40:38 +0200 Subject: [PATCH 21/34] Extra jam broken if --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 115a94a2b5c..fa263760b7c 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -4553,13 +4553,14 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, TableRecordPtr tablePtr; c_tableRecordHash.find(tablePtr, keyRecord); - if (checkExist) + if (checkExist){ jam(); /* ---------------------------------------------------------------- */ // Check if table already existed. /* ---------------------------------------------------------------- */ tabRequire(tablePtr.i == RNIL, CreateTableRef::TableAlreadyExist); - + } + switch (parseP->requestType) { case DictTabInfo::CreateTableFromAPI: { jam(); From d6c1a39a1523999ec0bc170a54257104f2ad5528 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Sep 2004 16:58:25 +0000 Subject: [PATCH 22/34] fix for invalidating table if mismatch with frm removed debug printout new test in alter table for dictionay update test with multiple connections added coice of setting MaxNoOfOrderedIndexes added option to run "--small-bench" mysql-test/mysql-test-run.sh: added option to run "--small-bench" mysql-test/ndb/ndb_config_2_node.ini: added coice of setting MaxNoOfOrderedIndexes mysql-test/ndb/ndbcluster.sh: added coice of setting MaxNoOfOrderedIndexes mysql-test/r/ndb_alter_table.result: new test in alter table for dictionay update test with multiple connections mysql-test/t/ndb_alter_table.test: new test in alter table for dictionay update test with multiple connections ndb/src/ndbapi/DictCache.cpp: removed debug printout sql/ha_ndbcluster.cc: fix for invalidating table if mismatch with frm --- mysql-test/mysql-test-run.sh | 22 ++++++- mysql-test/ndb/ndb_config_2_node.ini | 1 + mysql-test/ndb/ndbcluster.sh | 5 +- mysql-test/r/ndb_alter_table.result | 19 ++++++ mysql-test/t/ndb_alter_table.test | 31 +++++++++ ndb/src/ndbapi/DictCache.cpp | 21 ------ sql/ha_ndbcluster.cc | 96 ++++++++++++++-------------- 7 files changed, 123 insertions(+), 72 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 41dc3c419f0..1765bf4504b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -295,6 +295,11 @@ while test $# -gt 0; do --record) RECORD=1; EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; + --small-bench) + DO_SMALL_BENCH=1 + DO_BENCH=1 + NO_SLAVE=1 + ;; --bench) DO_BENCH=1 NO_SLAVE=1 @@ -1451,7 +1456,13 @@ then if [ -z "$USE_RUNNING_NDBCLUSTER" ] then echo "Starting ndbcluster" - ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 + if [ "$DO_BENCH" = 1 ] + then + NDBCLUSTER_OPTS="" + else + NDBCLUSTER_OPTS="--small" + fi + ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT $NDBCLUSTER_OPTS --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"host=localhost:$NDBCLUSTER_PORT\"" else USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$USE_RUNNING_NDBCLUSTER\"" @@ -1485,9 +1496,14 @@ if [ "$DO_BENCH" = 1 ] then start_master + if [ "$DO_SMALL_BENCH" = 1 ] + then + EXTRA_BENCH_ARGS="--small-test --small-tables" + fi + if [ ! -z "$USE_NDBCLUSTER" ] then - EXTRA_BENCH_ARGS="--create-options=TYPE=ndb" + EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS" fi BENCHDIR=$BASEDIR/sql-bench/ @@ -1495,7 +1511,7 @@ then cd $BENCHDIR if [ -z "$1" ] then - ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS + ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log else if [ -x "./$1" ] then diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini index cc0f940efe3..8c89d2aa2cc 100644 --- a/mysql-test/ndb/ndb_config_2_node.ini +++ b/mysql-test/ndb/ndb_config_2_node.ini @@ -6,6 +6,7 @@ IndexMemory= CHOOSE_IndexMemory Diskless= CHOOSE_Diskless TimeBetweenWatchDogCheck= 30000 DataDir= CHOOSE_FILESYSTEM +MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes [ndbd] HostName= CHOOSE_HOSTNAME_1 diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index f143242371f..a1b6400d753 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -44,7 +44,8 @@ initial_ndb= status_ndb= ndb_diskless=0 -ndb_con_op=100000 +ndb_no_ord=512 +ndb_con_op=10000 ndb_dmem=80M ndb_imem=24M @@ -65,6 +66,7 @@ while test $# -gt 0; do status_ndb=1 ;; --small) + ndb_no_ord=128 ndb_con_op=10000 ndb_dmem=40M ndb_imem=12M @@ -128,6 +130,7 @@ port_transporter=`expr $ndb_mgmd_port + 2` if [ $initial_ndb ] ; then sed \ + -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ -e s,"CHOOSE_DataMemory","$ndb_dmem",g \ -e s,"CHOOSE_IndexMemory","$ndb_imem",g \ diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 8143e34ecc2..a36536b878d 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -73,3 +73,22 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 101 3 4 5 PENDING 0000-00-00 00:00:00 2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00 drop table t1; +CREATE TABLE t1 ( +a INT NOT NULL, +b INT NOT NULL +) ENGINE=ndbcluster; +INSERT INTO t1 VALUES (9410,9412); +ALTER TABLE t1 ADD COLUMN c int not null; +select * from t1; +a b c +9410 9412 0 +select * from t1; +a b c +9410 9412 0 +alter table t1 drop c; +select * from t1; +a b +9410 9412 +drop table t1; +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index 3cdddfa8dce..96270d94dcb 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -49,6 +49,37 @@ show table status; select * from t1 order by col1; drop table t1; + +# +# Check that invalidating dictionary cache works +# + +CREATE TABLE t1 ( + a INT NOT NULL, + b INT NOT NULL +) ENGINE=ndbcluster; + +INSERT INTO t1 VALUES (9410,9412); + +connect (con1,localhost,,,test); +connect (con2,localhost,,,test); + +connection con1; +ALTER TABLE t1 ADD COLUMN c int not null; +select * from t1; + +connection con2; +select * from t1; +alter table t1 drop c; + +connection con1; +select * from t1; +drop table t1; + +connection con2; +--error 1146 +select * from t1; + #--disable_warnings #DROP TABLE IF EXISTS t2; #--enable_warnings diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index d395e3c9847..12300ce216f 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -70,27 +70,6 @@ LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){ void LocalDictCache::drop(const char * name){ Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); - -#ifndef DBUG_OFF - if (info == 0) { - ndbout_c("LocalDictCache::drop(%s) info==0", name); - ndbout_c("dump begin"); - NdbElement_t * curr = m_tableHash.getNext(0); - while(curr != 0){ - Ndb_local_table_info *tmp = curr->theData; - if (tmp) { - ndbout_c("m_table_impl=0x%x, id=%d, name=%s", - tmp->m_table_impl, - tmp->m_table_impl->m_tableId, - tmp->m_table_impl->getName()); - } else { - ndbout_c("NULL"); - } - curr = m_tableHash.getNext(curr); - } - ndbout_c("dump end"); - } -#endif DBUG_ASSERT(info != 0); Ndb_local_table_info::destroy(info); } diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index d5ba6d725eb..2c330fae84d 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -611,58 +611,60 @@ int ha_ndbcluster::get_metadata(const char *path) { NDBDICT *dict= m_ndb->getDictionary(); const NDBTAB *tab; - const void *data, *pack_data; - const char **key_name; - uint ndb_columns, mysql_columns, length, pack_length; int error; + bool invalidating_ndb_table= false; + DBUG_ENTER("get_metadata"); DBUG_PRINT("enter", ("m_tabname: %s, path: %s", m_tabname, path)); - if (!(tab= dict->getTable(m_tabname))) - ERR_RETURN(dict->getNdbError()); - DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion())); - - /* - This is the place to check that the table we got from NDB - is equal to the one on local disk - */ - ndb_columns= (uint) tab->getNoOfColumns(); - mysql_columns= table->fields; - if (table->primary_key == MAX_KEY) - ndb_columns--; - if (ndb_columns != mysql_columns) - { - DBUG_PRINT("error", - ("Wrong number of columns, ndb: %d mysql: %d", - ndb_columns, mysql_columns)); - DBUG_RETURN(HA_ERR_OLD_METADATA); - } - - /* - Compare FrmData in NDB with frm file from disk. - */ - error= 0; - if (readfrm(path, &data, &length) || - packfrm(data, length, &pack_data, &pack_length)) - { - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); - DBUG_RETURN(1); - } + do { + const void *data, *pack_data; + uint length, pack_length; + + if (!(tab= dict->getTable(m_tabname))) + ERR_RETURN(dict->getNdbError()); + DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion())); + /* + Compare FrmData in NDB with frm file from disk. + */ + error= 0; + if (readfrm(path, &data, &length) || + packfrm(data, length, &pack_data, &pack_length)) + { + my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); + my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + DBUG_RETURN(1); + } - if ((pack_length != tab->getFrmLength()) || - (memcmp(pack_data, tab->getFrmData(), pack_length))) - { - DBUG_PRINT("error", - ("metadata, pack_length: %d getFrmLength: %d memcmp: %d", - pack_length, tab->getFrmLength(), - memcmp(pack_data, tab->getFrmData(), pack_length))); - DBUG_DUMP("pack_data", (char*)pack_data, pack_length); - DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength()); - error= HA_ERR_OLD_METADATA; - } - my_free((char*)data, MYF(0)); - my_free((char*)pack_data, MYF(0)); + if ((pack_length != tab->getFrmLength()) || + (memcmp(pack_data, tab->getFrmData(), pack_length))) + { + if (!invalidating_ndb_table) + { + DBUG_PRINT("info", ("Invalidating table")); + dict->invalidateTable(m_tabname); + invalidating_ndb_table= true; + } + else + { + DBUG_PRINT("error", + ("metadata, pack_length: %d getFrmLength: %d memcmp: %d", + pack_length, tab->getFrmLength(), + memcmp(pack_data, tab->getFrmData(), pack_length))); + DBUG_DUMP("pack_data", (char*)pack_data, pack_length); + DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength()); + error= HA_ERR_OLD_METADATA; + invalidating_ndb_table= false; + } + } + else + { + invalidating_ndb_table= false; + } + my_free((char*)data, MYF(0)); + my_free((char*)pack_data, MYF(0)); + } while (invalidating_ndb_table); + if (error) DBUG_RETURN(error); From 892b5c9bcacd1507e1b6c1090103f3dd6a6438a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 10:16:37 +0200 Subject: [PATCH 23/34] Fix memory leak BitKeeper/deleted/.del-NdbScanReceiver.hpp~5c295814a47e7bb4: Delete: ndb/src/ndbapi/NdbScanReceiver.hpp BitKeeper/deleted/.del-NdbScanReceiver.cpp~b8a7472e4a7c424f: Delete: ndb/src/ndbapi/NdbScanReceiver.cpp ndb/include/ndb_global.h: Added ndb_end (corresponding to ndb_init) ndb/src/common/util/ndb_init.c: Added ndb_end (corresponding to ndb_init) ndb/src/ndbapi/NdbScanOperation.cpp: Release SCAN_TABREQ and make sure to call NdbOperation::release (that releases other stuff) ndb/src/ndbapi/Ndbinit.cpp: Reorder free-ing so that signal are release last (so that operations holding signals can release the first) --- ndb/include/ndb_global.h | 1 + ndb/src/common/util/ndb_init.c | 6 + ndb/src/ndbapi/NdbScanOperation.cpp | 9 +- ndb/src/ndbapi/NdbScanReceiver.cpp | 187 ------------------------- ndb/src/ndbapi/NdbScanReceiver.hpp | 210 ---------------------------- ndb/src/ndbapi/Ndbinit.cpp | 8 +- 6 files changed, 19 insertions(+), 402 deletions(-) delete mode 100644 ndb/src/ndbapi/NdbScanReceiver.cpp delete mode 100644 ndb/src/ndbapi/NdbScanReceiver.hpp diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index 19bd387c457..3ce37a2edee 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -78,6 +78,7 @@ extern "C" { /* call in main() - does not return on error */ extern int ndb_init(void); +extern void ndb_end(int); #ifndef HAVE_STRDUP extern char * strdup(const char *s); diff --git a/ndb/src/common/util/ndb_init.c b/ndb/src/common/util/ndb_init.c index b160ed3636b..f3aa734d7f9 100644 --- a/ndb/src/common/util/ndb_init.c +++ b/ndb/src/common/util/ndb_init.c @@ -27,3 +27,9 @@ ndb_init() } return 0; } + +void +ndb_end(int flags) +{ + my_end(flags); +} diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index ac5f4268386..8db4778f2b9 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -52,6 +52,7 @@ NdbScanOperation::NdbScanOperation(Ndb* aNdb) : NdbScanOperation::~NdbScanOperation() { for(Uint32 i = 0; irelease(); theNdb->releaseNdbScanRec(m_receivers[i]); } delete[] m_array; @@ -191,7 +192,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, return 0; } - theSCAN_TABREQ = theNdb->getSignal(); + theSCAN_TABREQ = (!theSCAN_TABREQ ? theNdb->getSignal() : theSCAN_TABREQ); if (theSCAN_TABREQ == NULL) { setErrorCodeAbort(4000); return 0; @@ -719,6 +720,12 @@ void NdbScanOperation::release() for(Uint32 i = 0; irelease(); } + if(theSCAN_TABREQ) + { + theNdb->releaseSignal(theSCAN_TABREQ); + theSCAN_TABREQ = 0; + } + NdbOperation::release(); } /*************************************************************************** diff --git a/ndb/src/ndbapi/NdbScanReceiver.cpp b/ndb/src/ndbapi/NdbScanReceiver.cpp deleted file mode 100644 index 6c8c16c3ecf..00000000000 --- a/ndb/src/ndbapi/NdbScanReceiver.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include "NdbScanReceiver.hpp" -#include - -#include - -#include - - -/*************************************************************************** - * int receiveKEYINFO20( NdbApiSignal* aSignal) - * - * Remark: Handles the reception of the KEYINFO20 signal. - * Save a copy of the signal in list - * - ***************************************************************************/ -int -NdbScanReceiver::receiveKEYINFO20( NdbApiSignal* aSignal){ - const KeyInfo20 * const keyInfo = CAST_CONSTPTR(KeyInfo20, aSignal->getDataPtr()); - if (theStatus != Waiting){ - //ndbout << "Dropping KEYINFO20, theStatus="<getLength() < 5){ - //ndbout << "Dropping KEYINFO20, length="<getLength() << endl; - } - Uint64 tCurrTransId = theNdbOp->theNdbCon->getTransactionId(); - Uint64 tRecTransId = (Uint64)keyInfo->transId1 + ((Uint64)keyInfo->transId2 << 32); - if ((tRecTransId - tCurrTransId) != (Uint64)0){ - //ndbout << "Dropping KEYINFO20 wrong transid" << endl; - return -1; - } - - NdbApiSignal * tCopy = new NdbApiSignal(0);//getSignal(); - if (tCopy == NULL) { - theNdbOp->setErrorCode(4000); - return 2; // theWaitState = NO_WAIT - } - // Put copy last in list of KEYINFO20 signals - tCopy->copyFrom(aSignal); - tCopy->next(NULL); - if (theFirstKEYINFO20_Recv == NULL) - theFirstKEYINFO20_Recv = tCopy; - else - theLastKEYINFO20_Recv->next(tCopy); - theLastKEYINFO20_Recv = tCopy; - - theTotalKI_Len = keyInfo->keyLen; // This is the total length of all signals - theTotalRecKI_Len += aSignal->getLength() - 5; - return theNdbOp->theNdbCon->checkNextScanResultComplete(); -} - -/*************************************************************************** - * int receiveTRANSID_AI_SCAN( NdbApiSignal* aSignal) - * - * Remark: Handles the reception of the TRANSID_AI_signal with - * 22 signal data words. - * Save a copy of the signal in list and check if all - * signals belonging to this resultset is receieved. - * - ***************************************************************************/ -int -NdbScanReceiver::receiveTRANSID_AI_SCAN( NdbApiSignal* aSignal) -{ - const Uint32* aDataPtr = aSignal->getDataPtr(); - if (theStatus != Waiting){ - //ndbout << "Dropping TRANSID_AI, theStatus="<getLength() < 3){ - //ndbout << "Dropping TRANSID_AI, length="<getLength() << endl; - return -1; - } - if (theNdbOp == NULL){ - //ndbout << "Dropping TRANSID_AI, theNdbOp == NULL" << endl; - return -1; - } - if (theNdbOp->theNdbCon == NULL){ - //ndbout << "Dropping TRANSID_AI, theNdbOp->theNdbCon == NULL" << endl; - return -1; - } - Uint64 tCurrTransId = theNdbOp->theNdbCon->getTransactionId(); - Uint64 tRecTransId = (Uint64)aDataPtr[1] + ((Uint64)aDataPtr[2] << 32); - if ((tRecTransId - tCurrTransId) != (Uint64)0){ - //ndbout << "Dropping TRANSID_AI wrong transid" << endl; - return -1; - } - - NdbApiSignal * tCopy = new NdbApiSignal(0);//getSignal(); - if (tCopy == NULL){ - theNdbOp->setErrorCode(4000); - return 2; // theWaitState = NO_WAIT - } - tCopy->copyFrom(aSignal); - tCopy->next(NULL); - if (theFirstTRANSID_AI_Recv == NULL) - theFirstTRANSID_AI_Recv = tCopy; - else - theLastTRANSID_AI_Recv->next(tCopy); - theLastTRANSID_AI_Recv = tCopy; - theTotalRecAI_Len += aSignal->getLength() - 3; - - return theNdbOp->theNdbCon->checkNextScanResultComplete(); -} - -/*************************************************************************** - * int executeSavedSignals() - * - * Remark: Execute all saved TRANSID_AI signals into the parent NdbOperation - * - * - ***************************************************************************/ -int -NdbScanReceiver::executeSavedSignals(){ - - NdbApiSignal* tSignal = theFirstTRANSID_AI_Recv; - while (tSignal != NULL) { - const Uint32* tDataPtr = tSignal->getDataPtr(); - - int tRet = theNdbOp->receiveREAD_AI((Uint32*)&tDataPtr[3], - tSignal->getLength() - 3); - if (tRet != -1){ - // -1 means that more signals are wanted ? - // Make sure there are no more signals in the list - assert(tSignal->next() == NULL); - } - tSignal = tSignal->next(); - } - // receiveREAD_AI may not copy to application buffers - NdbRecAttr* tRecAttr = theNdbOp->theFirstRecAttr; - while (tRecAttr != NULL) { - if (tRecAttr->copyoutRequired()) // copy to application buffer - tRecAttr->copyout(); - tRecAttr = tRecAttr->next(); - } - // Release TRANSID_AI signals for this receiver - while(theFirstTRANSID_AI_Recv != NULL){ - NdbApiSignal* tmp = theFirstTRANSID_AI_Recv; - theFirstTRANSID_AI_Recv = tmp->next(); - delete tmp; - } - - // theNdbOp->theNdb->releaseSignalsInList(&theFirstTRANSID_AI_Recv); - theFirstTRANSID_AI_Recv = NULL; - theLastTRANSID_AI_Recv = NULL; - theStatus = Executed; - - return 0; -} - - -void -NdbScanReceiver::prepareNextScanResult(){ - if(theStatus == Executed){ - - // theNdbOp->theNdb->releaseSignalsInList(&theFirstKEYINFO20_Recv); - while(theFirstKEYINFO20_Recv != NULL){ - NdbApiSignal* tmp = theFirstKEYINFO20_Recv; - theFirstKEYINFO20_Recv = tmp->next(); - delete tmp; - } - theFirstKEYINFO20_Recv = NULL; - theLastKEYINFO20_Recv = NULL; - theTotalRecAI_Len = 0; - theTotalRecKI_Len = 0; - if (theLockMode == true) - theTotalKI_Len = 0xFFFFFFFF; - else - theTotalKI_Len = 0; - theStatus = Waiting; - } -} diff --git a/ndb/src/ndbapi/NdbScanReceiver.hpp b/ndb/src/ndbapi/NdbScanReceiver.hpp deleted file mode 100644 index 72f9e48f02c..00000000000 --- a/ndb/src/ndbapi/NdbScanReceiver.hpp +++ /dev/null @@ -1,210 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef NdbScanReceiver_H -#define NdbScanReceiver_H - -#include "Ndb.hpp" -#include "NdbConnection.hpp" -#include "NdbOperation.hpp" -#include "NdbApiSignal.hpp" -#include "NdbReceiver.hpp" -#include - - -class NdbScanReceiver -{ - enum ReceiverStatus { Init, - Waiting, - Completed, - Executed, - Released }; - - friend class Ndb; - friend class NdbOperation; -public: - NdbScanReceiver(Ndb *aNdb) : - theReceiver(aNdb), - theNdbOp(NULL), - theFirstTRANSID_AI_Recv(NULL), - theLastTRANSID_AI_Recv(NULL), - theFirstKEYINFO20_Recv(NULL), - theLastKEYINFO20_Recv(NULL), - theTotalRecAI_Len(0), - theTotalKI_Len(0xFFFFFFFF), - theTotalRecKI_Len(0), - theStatus(Init), - theNextScanRec(NULL) - { - theReceiver.init(NdbReceiver::NDB_SCANRECEIVER, this); - } - - int checkMagicNumber(); - int receiveTRANSID_AI_SCAN(NdbApiSignal*); - int receiveKEYINFO20(NdbApiSignal*); - int executeSavedSignals(); - void prepareNextScanResult(); - - NdbScanReceiver* next(); - void next(NdbScanReceiver*); - - bool isCompleted(Uint32 aiLenToReceive); - void setCompleted(); - - void init(NdbOperation* aNdbOp, bool lockMode); - - Uint32 ptr2int() { return theReceiver.getId(); }; -private: - NdbScanReceiver(); - void release(); - - NdbReceiver theReceiver; - - NdbOperation* theNdbOp; - NdbApiSignal* theFirstTRANSID_AI_Recv; - NdbApiSignal* theLastTRANSID_AI_Recv; - NdbApiSignal* theFirstKEYINFO20_Recv; - NdbApiSignal* theLastKEYINFO20_Recv; - - Uint32 theTotalRecAI_Len; - Uint32 theTotalKI_Len; - Uint32 theTotalRecKI_Len; - ReceiverStatus theStatus; - Uint32 theMagicNumber; - NdbScanReceiver* theNextScanRec; - bool theLockMode; - -}; - -inline -void -NdbScanReceiver::init(NdbOperation* aNdbOp, bool lockMode){ - assert(theStatus == Init || theStatus == Released); - theNdbOp = aNdbOp; - theMagicNumber = 0xA0B1C2D3; - theTotalRecAI_Len = 0; - - /* If we are locking the records for take over - * KI_len to receive is at least 1, since we don't know yet - * how much KI we are expecting(this is written in the first KI signal) - * set theTotalKI_Len to FFFFFFFF, this will make the ScanReciever wait for - * at least the first KI, and when that is received we will know if - * we are expecting another one - */ - theLockMode = lockMode; - if (theLockMode == true) - theTotalKI_Len = 0xFFFFFFFF; - else - theTotalKI_Len = 0; - theTotalRecKI_Len = 0; - - assert(theNextScanRec == NULL); - theNextScanRec = NULL; - assert(theFirstTRANSID_AI_Recv == NULL); - theFirstTRANSID_AI_Recv = NULL; - assert(theLastTRANSID_AI_Recv == NULL); - theLastTRANSID_AI_Recv = NULL; - assert(theFirstKEYINFO20_Recv == NULL); - theFirstKEYINFO20_Recv = NULL; - theLastKEYINFO20_Recv = NULL; - - theStatus = Waiting; -}; - - -inline -void -NdbScanReceiver::release(){ - theStatus = Released; - // theNdbOp->theNdb->releaseSignalsInList(&theFirstTRANSID_AI_Recv); - while(theFirstTRANSID_AI_Recv != NULL){ - NdbApiSignal* tmp = theFirstTRANSID_AI_Recv; - theFirstTRANSID_AI_Recv = tmp->next(); - delete tmp; - } - theFirstTRANSID_AI_Recv = NULL; - theLastTRANSID_AI_Recv = NULL; - // theNdbOp->theNdb->releaseSignalsInList(&theFirstKEYINFO20_Recv); - while(theFirstKEYINFO20_Recv != NULL){ - NdbApiSignal* tmp = theFirstKEYINFO20_Recv; - theFirstKEYINFO20_Recv = tmp->next(); - delete tmp; - } - theFirstKEYINFO20_Recv = NULL; - theLastKEYINFO20_Recv = NULL; - theNdbOp = NULL; - theTotalRecAI_Len = 0; - theTotalRecKI_Len = 0; - theTotalKI_Len = 0xFFFFFFFF; -}; - -inline -int -NdbScanReceiver::checkMagicNumber() -{ - if (theMagicNumber != 0xA0B1C2D3) - return -1; - return 0; -} - -inline -NdbScanReceiver* -NdbScanReceiver::next(){ - return theNextScanRec; -} - -inline -void -NdbScanReceiver::next(NdbScanReceiver* aScanRec){ - theNextScanRec = aScanRec; -} - -inline -bool -NdbScanReceiver::isCompleted(Uint32 aiLenToReceive){ - assert(theStatus == Waiting || theStatus == Completed); -#if 0 - ndbout << "NdbScanReceiver::isCompleted"< Date: Sat, 25 Sep 2004 14:10:06 +0000 Subject: [PATCH 26/34] moved LocalConfig out of config retriver --- ndb/include/mgmcommon/ConfigRetriever.hpp | 17 ++--------- ndb/include/ndbapi/ndb_cluster_connection.hpp | 2 ++ ndb/src/common/mgmcommon/ConfigRetriever.cpp | 25 +++------------- ndb/src/kernel/main.cpp | 14 +++++++-- ndb/src/kernel/vm/Configuration.cpp | 11 +++++-- ndb/src/kernel/vm/Configuration.hpp | 4 ++- ndb/src/mgmsrv/MgmtSrvr.cpp | 9 +++--- ndb/src/mgmsrv/MgmtSrvr.hpp | 4 +-- ndb/src/mgmsrv/MgmtSrvrConfig.cpp | 3 +- ndb/src/mgmsrv/main.cpp | 29 +++++-------------- ndb/src/ndbapi/TransporterFacade.hpp | 1 - ndb/src/ndbapi/ndb_cluster_connection.cpp | 27 +++++++++++++---- 12 files changed, 67 insertions(+), 79 deletions(-) diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp index f9f8904b65c..a584c394f45 100644 --- a/ndb/include/mgmcommon/ConfigRetriever.hpp +++ b/ndb/include/mgmcommon/ConfigRetriever.hpp @@ -28,7 +28,7 @@ */ class ConfigRetriever { public: - ConfigRetriever(Uint32 version, Uint32 nodeType); + ConfigRetriever(LocalConfig &local_config, Uint32 version, Uint32 nodeType); ~ConfigRetriever(); /** @@ -54,16 +54,6 @@ public: const char * getErrorString(); - /** - * Sets connectstring which can be used instead of local config file - */ - void setConnectString(const char * connectString); - - /** - * Sets name of local config file (usually not needed) - */ - void setLocalConfigFileName(const char * connectString); - /** * @return Node id of this node (as stated in local config or connectString) */ @@ -93,12 +83,9 @@ private: void setError(ErrorType, const char * errorMsg); - BaseString _localConfigFileName; - struct LocalConfig _localConfig; + struct LocalConfig& _localConfig; Uint32 _ownNodeId; - BaseString m_connectString; - Uint32 m_version; Uint32 m_node_type; NdbMgmHandle m_handle; diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp index 59d5a038844..f8e6f25ce73 100644 --- a/ndb/include/ndbapi/ndb_cluster_connection.hpp +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -19,6 +19,7 @@ #define CLUSTER_CONNECTION_HPP class TransporterFacade; +class LocalConfig; class ConfigRetriever; class NdbThread; @@ -37,6 +38,7 @@ private: void connect_thread(); char *m_connect_string; TransporterFacade *m_facade; + LocalConfig *m_local_config; ConfigRetriever *m_config_retriever; NdbThread *m_connect_thread; int (*m_connect_callback)(void); diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 40325fbae99..44b41956d33 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -45,8 +45,10 @@ //**************************************************************************** //**************************************************************************** -ConfigRetriever::ConfigRetriever(Uint32 version, Uint32 node_type) { - +ConfigRetriever::ConfigRetriever(LocalConfig &local_config, + Uint32 version, Uint32 node_type) + : _localConfig(local_config) +{ m_handle= 0; m_version = version; m_node_type = node_type; @@ -66,15 +68,6 @@ ConfigRetriever::~ConfigRetriever(){ int ConfigRetriever::init() { - if (!_localConfig.init(m_connectString.c_str(), - _localConfigFileName.c_str())){ - - setError(CR_ERROR, "error in retrieving contact info for mgmtsrvr"); - _localConfig.printError(); - _localConfig.printUsage(); - return -1; - } - return _ownNodeId = _localConfig._ownNodeId; } @@ -230,16 +223,6 @@ ConfigRetriever::getErrorString(){ return errorString.c_str(); } -void -ConfigRetriever::setLocalConfigFileName(const char * localConfigFileName) { - _localConfigFileName.assign(localConfigFileName ? localConfigFileName : ""); -} - -void -ConfigRetriever::setConnectString(const char * connectString) { - m_connectString.assign(connectString ? connectString : ""); -} - bool ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 nodeid){ diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 20844db75b6..035dfff8d01 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -19,6 +19,7 @@ #include #include "Configuration.hpp" +#include #include #include "vm/SimBlockList.hpp" @@ -67,12 +68,19 @@ NDB_MAIN(ndb_kernel){ // Parse command line options Configuration* theConfig = globalEmulatorData.theConfiguration; if(!theConfig->init(argc, argv)){ - return 0; + return NRT_Default; } + LocalConfig local_config; + if (!local_config.init(theConfig->getConnectString(),0)){ + local_config.printError(); + local_config.printUsage(); + return NRT_Default; + } + { // Do configuration signal(SIGPIPE, SIG_IGN); - theConfig->fetch_configuration(); + theConfig->fetch_configuration(local_config); } chdir(NdbConfig_get_path(0)); @@ -135,7 +143,7 @@ NDB_MAIN(ndb_kernel){ exit(0); } g_eventLogger.info("Ndb has terminated (pid %d) restarting", child); - theConfig->fetch_configuration(); + theConfig->fetch_configuration(local_config); } g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid()); diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index b7054a1bf22..0c4e24129df 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -16,6 +16,7 @@ #include +#include #include "Configuration.hpp" #include #include "GlobalData.hpp" @@ -184,7 +185,7 @@ Configuration::closeConfiguration(){ } void -Configuration::fetch_configuration(){ +Configuration::fetch_configuration(LocalConfig &local_config){ /** * Fetch configuration from management server */ @@ -192,8 +193,7 @@ Configuration::fetch_configuration(){ delete m_config_retriever; } - m_config_retriever= new ConfigRetriever(NDB_VERSION, NODE_TYPE_DB); - m_config_retriever->setConnectString(_connectString ? _connectString : ""); + m_config_retriever= new ConfigRetriever(local_config, NDB_VERSION, NODE_TYPE_DB); if(m_config_retriever->init() == -1 || m_config_retriever->do_connect() == -1){ @@ -416,6 +416,11 @@ Configuration::setRestartOnErrorInsert(int i){ m_restartOnErrorInsert = i; } +const char * +Configuration::getConnectString() const { + return _connectString; +} + char * Configuration::getConnectStringCopy() const { if(_connectString != 0) diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp index e84ff8d9193..7ac171c4a70 100644 --- a/ndb/src/kernel/vm/Configuration.hpp +++ b/ndb/src/kernel/vm/Configuration.hpp @@ -21,6 +21,7 @@ #include class ConfigRetriever; +class LocalConfig; class Configuration { public: @@ -32,7 +33,7 @@ public: */ bool init(int argc, const char** argv); - void fetch_configuration(); + void fetch_configuration(LocalConfig &local_config); void setupConfiguration(); void closeConfiguration(); @@ -54,6 +55,7 @@ public: const char * programName() const; const char * fileSystemPath() const; const char * backupFilePath() const; + const char * getConnectString() const; char * getConnectStringCopy() const; /** diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index d45953503ee..4c09805ba12 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -401,7 +401,7 @@ MgmtSrvr::getPort() const { /* Constructor */ MgmtSrvr::MgmtSrvr(NodeId nodeId, const BaseString &configFilename, - const BaseString &ndb_config_filename, + LocalConfig &local_config, Config * config): _blockNumber(1), // Hard coded block number since it makes it easy to send // signals to other management servers. @@ -409,7 +409,9 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, m_allocated_resources(*this), theSignalIdleList(NULL), theWaitState(WAIT_SUBSCRIBE_CONF), - m_statisticsListner(this){ + m_statisticsListner(this), + m_local_config(local_config) +{ DBUG_ENTER("MgmtSrvr::MgmtSrvr"); @@ -424,7 +426,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, m_newConfig = NULL; m_configFilename = configFilename; - m_localNdbConfigFilename = ndb_config_filename; m_nextConfigGenerationNumber = 0; @@ -514,7 +515,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, { DBUG_PRINT("info", ("verifyConfig")); - ConfigRetriever cr(NDB_VERSION, NDB_MGM_NODE_TYPE_MGM); + ConfigRetriever cr(m_local_config, NDB_VERSION, NDB_MGM_NODE_TYPE_MGM); if (!cr.verifyConfig(config->m_configValues, _ownNodeId)) { ndbout << cr.getErrorString() << endl; exit(-1); diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 3f3e98dbcc1..c6157db489a 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -173,7 +173,7 @@ public: MgmtSrvr(NodeId nodeId, /* Local nodeid */ const BaseString &config_filename, /* Where to save config */ - const BaseString &ndb_config_filename, /* Ndb.cfg filename */ + LocalConfig &local_config, /* Ndb.cfg filename */ Config * config); NodeId getOwnNodeId() const {return _ownNodeId;}; @@ -528,8 +528,8 @@ private: NdbMutex *m_configMutex; const Config * _config; Config * m_newConfig; + LocalConfig &m_local_config; BaseString m_configFilename; - BaseString m_localNdbConfigFilename; Uint32 m_nextConfigGenerationNumber; NodeBitmask m_reserved_nodes; diff --git a/ndb/src/mgmsrv/MgmtSrvrConfig.cpp b/ndb/src/mgmsrv/MgmtSrvrConfig.cpp index 44c2aadd1e2..1d51061e909 100644 --- a/ndb/src/mgmsrv/MgmtSrvrConfig.cpp +++ b/ndb/src/mgmsrv/MgmtSrvrConfig.cpp @@ -288,8 +288,7 @@ MgmtSrvr::readConfig() { Config * MgmtSrvr::fetchConfig() { - ConfigRetriever cr(NDB_VERSION, NODE_TYPE_MGM); - cr.setLocalConfigFileName(m_localNdbConfigFilename.c_str()); + ConfigRetriever cr(m_local_config, NDB_VERSION, NODE_TYPE_MGM); struct ndb_mgm_configuration * tmp = cr.getConfig(); if(tmp != 0){ Config * conf = new Config(); diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index a582d082312..1a2b95391a9 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -173,15 +173,19 @@ NDB_MAIN(mgmsrv){ /**************************** * Read configuration files * ****************************/ - if (!readLocalConfig()) + LocalConfig local_config; + if(!local_config.init(0,glob.local_config_filename)){ + local_config.printError(); goto error_end; + } + glob.localNodeId = local_config._ownNodeId; + if (!readGlobalConfig()) goto error_end; glob.mgmObject = new MgmtSrvr(glob.localNodeId, BaseString(glob.config_filename), - BaseString(glob.local_config_filename == 0 ? - "" : glob.local_config_filename), + local_config, glob.cluster_config); chdir(NdbConfig_get_path(0)); @@ -320,25 +324,6 @@ MgmGlobals::~MgmGlobals(){ free(interface_name); } -/** - * @fn readLocalConfig - * @param glob : Global variables - * @return true if success, false otherwise. - */ -static bool -readLocalConfig(){ - // Read local config file - LocalConfig lc; - if(!lc.init(0,glob.local_config_filename)){ - lc.printError(); - return false; - } - - glob.localNodeId = lc._ownNodeId; - return true; -} - - /** * @fn readGlobalConfig * @param glob : Global variables diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 76beaa708f1..8b6e38a0611 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -236,7 +236,6 @@ public: NdbMutex* theMutexPtr; private: static TransporterFacade* theFacadeInstance; - static ConfigRetriever *s_config_retriever; public: GlobalDictCache m_globalDictCache; diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index 27695cec187..174d2c314af 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -30,14 +31,18 @@ static int g_run_connect_thread= 0; Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string) { + DBUG_ENTER("Ndb_cluster_connection"); + DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this)); m_facade= TransporterFacade::theFacadeInstance= new TransporterFacade(); if (connect_string) - m_connect_string= strdup(connect_string); + m_connect_string= my_strdup(connect_string,MYF(MY_WME)); else m_connect_string= 0; m_config_retriever= 0; + m_local_config= 0; m_connect_thread= 0; m_connect_callback= 0; + DBUG_VOID_RETURN; } extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) @@ -99,8 +104,16 @@ int Ndb_cluster_connection::connect(int reconnect) do { if (m_config_retriever == 0) { - m_config_retriever= new ConfigRetriever(NDB_VERSION, NODE_TYPE_API); - m_config_retriever->setConnectString(m_connect_string); + if (m_local_config == 0) { + m_local_config= new LocalConfig(); + if (m_local_config->init(m_connect_string,0)) { + ndbout << "Configuration error: Unable to retrieve local config" << endl; + m_local_config->printError(); + m_local_config->printUsage(); + DBUG_RETURN(-1); + } + } + m_config_retriever= new ConfigRetriever(*m_local_config, NDB_VERSION, NODE_TYPE_API); if(m_config_retriever->init() == -1) break; } @@ -145,6 +158,8 @@ int Ndb_cluster_connection::connect(int reconnect) Ndb_cluster_connection::~Ndb_cluster_connection() { + DBUG_ENTER("~Ndb_cluster_connection"); + DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this)); TransporterFacade::stop_instance(); if (m_connect_thread) { @@ -161,10 +176,12 @@ Ndb_cluster_connection::~Ndb_cluster_connection() abort(); TransporterFacade::theFacadeInstance= 0; } - if (m_connect_string) - free(m_connect_string); + my_free(m_connect_string,MYF(MY_ALLOW_ZERO_PTR)); if (m_config_retriever) delete m_config_retriever; + if (m_local_config == 0) + delete m_local_config; + DBUG_VOID_RETURN; } From 339d362dd7c3284aa6537a5df04c80790381741b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 16:47:51 +0200 Subject: [PATCH 27/34] bug#5702 more bug fixes. ndb/src/kernel/blocks/dbdict/Dbdict.cpp: DropIndex - 1) return Invalid version 2) Mark as IS_DROPPING so that 2 simulatainious threads can't drop it ndb/src/ndbapi/NdbDictionary.cpp: Changed listIndex from taking table name to taking table id (should be index version aswell) ndb/src/ndbapi/NdbDictionaryImpl.cpp: List indexes using id Fix log towards m_globalHash ndb/src/ndbapi/NdbDictionaryImpl.hpp: List indexes using tableid (indexid) --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 38 +++++++++++++++++++------ ndb/src/ndbapi/NdbDictionary.cpp | 7 ++++- ndb/src/ndbapi/NdbDictionaryImpl.cpp | 35 ++++++++++++----------- ndb/src/ndbapi/NdbDictionaryImpl.hpp | 2 +- 4 files changed, 56 insertions(+), 26 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index fa263760b7c..821c847d5b9 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -4538,6 +4538,15 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, parseP->errorLine = __LINE__; return; } + + if(parseP->requestType == DictTabInfo::AlterTableFromAPI) + { + ndbrequire(!checkExist); + } + if(!checkExist) + { + ndbrequire(parseP->requestType == DictTabInfo::AlterTableFromAPI); + } /* ---------------------------------------------------------------- */ // Verify that table name is an allowed table name. @@ -4633,12 +4642,10 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, strcpy(tablePtr.p->tableName, keyRecord.tableName); if (parseP->requestType != DictTabInfo::AlterTableFromAPI) { jam(); - c_tableRecordHash.add(tablePtr); - } - #ifdef VM_TRACE - ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i); + ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i); #endif + } //tablePtr.p->noOfPrimkey = tableDesc.NoOfKeyAttr; //tablePtr.p->noOfNullAttr = tableDesc.NoOfNullable; @@ -4677,11 +4684,12 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, handleTabInfo(it, parseP); - if(parseP->errorCode != 0){ + if(parseP->errorCode != 0) + { /** * Release table */ - releaseTableObject(tablePtr.i); + releaseTableObject(tablePtr.i, !checkExist); } }//handleTabInfoInit() @@ -6563,14 +6571,28 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) int res = getMetaTablePtr(tmp, indexId, indexVersion); switch(res){ case MetaData::InvalidArgument: - case MetaData::TableNotFound: - err = DropTableRef::NoSuchTable; + err = DropIndxRef::IndexNotFound; goto error; + case MetaData::TableNotFound: case MetaData::InvalidTableVersion: err = DropIndxRef::InvalidIndexVersion; goto error; } + if (! tmp.p->isIndex()) { + jam(); + err = DropIndxRef::NotAnIndex; + goto error; + } + + if (tmp.p->indexState == TableRecord::IS_DROPPING){ + jam(); + err = DropIndxRef::IndexNotFound; + goto error; + } + + tmp.p->indexState = TableRecord::IS_DROPPING; + req->setOpKey(++c_opRecordSequence); NodeReceiverGroup rg(DBDICT, c_aliveNodes); sendSignal(rg, GSN_DROP_INDX_REQ, diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index 6cfacc2c340..c8414ec16a3 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -856,7 +856,12 @@ NdbDictionary::Dictionary::listObjects(List& list, Object::Type type) int NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName) { - return m_impl.listIndexes(list, tableName); + const NdbDictionary::Table* tab= getTable(tableName); + if(tab == 0) + { + return -1; + } + return m_impl.listIndexes(list, tab->getTableId()); } const struct NdbError & diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 0b2a0386a6b..9abe52fb030 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -1407,16 +1407,15 @@ int NdbDictionaryImpl::alterTable(NdbTableImpl &impl) // Remove cached information and let it be refreshed at next access if (m_localHash.get(originalInternalName) != NULL) { m_localHash.drop(originalInternalName); + m_globalHash->lock(); NdbTableImpl * cachedImpl = m_globalHash->get(originalInternalName); // If in local cache it must be in global if (!cachedImpl) abort(); - m_globalHash->lock(); m_globalHash->drop(cachedImpl); m_globalHash->unlock(); } } - return ret; } @@ -1714,6 +1713,7 @@ NdbDictionaryImpl::dropTable(const char * name) int NdbDictionaryImpl::dropTable(NdbTableImpl & impl) { + int res; const char * name = impl.getName(); if(impl.m_status == NdbDictionary::Object::New){ return dropTable(name); @@ -1725,28 +1725,34 @@ NdbDictionaryImpl::dropTable(NdbTableImpl & impl) } List list; - if (listIndexes(list, name) == -1) + if ((res = listIndexes(list, impl.m_tableId)) == -1){ return -1; + } for (unsigned i = 0; i < list.count; i++) { const List::Element& element = list.elements[i]; - if (dropIndex(element.name, name) == -1) + if ((res = dropIndex(element.name, name)) == -1) + { return -1; + } } - + if (impl.m_noOfBlobs != 0) { - if (dropBlobTables(impl) != 0) + if (dropBlobTables(impl) != 0){ return -1; + } } - + int ret = m_receiver.dropTable(impl); - if(ret == 0){ + if(ret == 0 || m_error.code == 709){ const char * internalTableName = impl.m_internalName.c_str(); - + m_localHash.drop(internalTableName); m_globalHash->lock(); m_globalHash->drop(&impl); m_globalHash->unlock(); + + return 0; } return ret; @@ -1762,8 +1768,9 @@ NdbDictionaryImpl::dropBlobTables(NdbTableImpl & t) char btname[NdbBlob::BlobTableNameSize]; NdbBlob::getBlobTableName(btname, &t, &c); if (dropTable(btname) != 0) { - if (m_error.code != 709) + if (m_error.code != 709){ return -1; + } } } return 0; @@ -2132,7 +2139,6 @@ NdbDictionaryImpl::dropIndex(NdbIndexImpl & impl, const char * tableName) m_globalHash->drop(impl.m_table); m_globalHash->unlock(); } - return ret; } @@ -2816,14 +2822,11 @@ NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type) } int -NdbDictionaryImpl::listIndexes(List& list, const char * tableName) +NdbDictionaryImpl::listIndexes(List& list, Uint32 indexId) { ListTablesReq req; - NdbTableImpl* impl = getTable(tableName); - if (impl == 0) - return -1; req.requestData = 0; - req.setTableId(impl->m_tableId); + req.setTableId(indexId); req.setListNames(true); req.setListIndexes(true); return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames()); diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index cf659c71397..1fe92db94ed 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -390,7 +390,7 @@ public: int stopSubscribeEvent(NdbEventImpl &); int listObjects(List& list, NdbDictionary::Object::Type type); - int listIndexes(List& list, const char * tableName); + int listIndexes(List& list, Uint32 indexId); NdbTableImpl * getTable(const char * tableName, void **data= 0); Ndb_local_table_info * get_local_table_info(const char * internalName); From 7a2cb204ed0427d3e13c1fa4633cd62d97487f71 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 16:06:30 +0000 Subject: [PATCH 28/34] added printout for where configuration is fetched debug printouts mysql-test/ndb/ndbcluster.sh: . ndb/include/mgmcommon/ConfigRetriever.hpp: added printout for where configuration is fetched ndb/src/common/mgmcommon/ConfigRetriever.cpp: added printout for where configuration is fetched ndb/src/kernel/main.cpp: added printout for where configuration is fetched ndb/src/kernel/vm/Configuration.cpp: added printout for where configuration is fetched ndb/src/kernel/vm/Configuration.hpp: added printout for where configuration is fetched ndb/src/ndbapi/Ndb.cpp: debug printouts --- mysql-test/ndb/ndbcluster.sh | 2 +- ndb/include/mgmcommon/ConfigRetriever.hpp | 7 ++++++- ndb/src/common/mgmcommon/ConfigRetriever.cpp | 7 +++++++ ndb/src/kernel/main.cpp | 3 +++ ndb/src/kernel/vm/Configuration.cpp | 5 +++++ ndb/src/kernel/vm/Configuration.hpp | 5 +++++ ndb/src/ndbapi/Ndb.cpp | 10 ++++++++-- 7 files changed, 35 insertions(+), 4 deletions(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index a1b6400d753..7485e42923e 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -45,7 +45,7 @@ status_ndb= ndb_diskless=0 ndb_no_ord=512 -ndb_con_op=10000 +ndb_con_op=105000 ndb_dmem=80M ndb_imem=24M diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp index a584c394f45..938f4c19071 100644 --- a/ndb/include/mgmcommon/ConfigRetriever.hpp +++ b/ndb/include/mgmcommon/ConfigRetriever.hpp @@ -73,6 +73,9 @@ public: * Verify config */ bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid); + + Uint32 get_mgmd_port() const {return m_mgmd_port;}; + const char *get_mgmd_host() const {return m_mgmd_host;}; private: BaseString errorString; enum ErrorType { @@ -85,7 +88,9 @@ private: struct LocalConfig& _localConfig; Uint32 _ownNodeId; - + Uint32 m_mgmd_port; + const char *m_mgmd_host; + Uint32 m_version; Uint32 m_node_type; NdbMgmHandle m_handle; diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 44b41956d33..c4957ffdbf1 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -74,6 +74,9 @@ ConfigRetriever::init() { int ConfigRetriever::do_connect(int exit_on_connect_failure){ + m_mgmd_port= 0; + m_mgmd_host= 0; + if(!m_handle) m_handle= ndb_mgm_create_handle(); @@ -94,6 +97,8 @@ ConfigRetriever::do_connect(int exit_on_connect_failure){ case MgmId_TCP: tmp.assfmt("%s:%d", m->name.c_str(), m->port); if (ndb_mgm_connect(m_handle, tmp.c_str()) == 0) { + m_mgmd_port= m->port; + m_mgmd_host= m->name.c_str(); return 0; } setError(CR_RETRY, ndb_mgm_get_latest_error_desc(m_handle)); @@ -118,6 +123,8 @@ ConfigRetriever::do_connect(int exit_on_connect_failure){ ndb_mgm_destroy_handle(&m_handle); m_handle= 0; + m_mgmd_port= 0; + m_mgmd_host= 0; return -1; } diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 035dfff8d01..9c25da79065 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -252,6 +252,9 @@ systemInfo(const Configuration & config, const LogLevel & logLevel){ if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){ g_eventLogger.info("NDB Cluster -- DB node %d", globalData.ownId); g_eventLogger.info("%s --", NDB_VERSION_STRING); + if (config.get_mgmd_host()) + g_eventLogger.info("Configuration fetched at %s port %d", + config.get_mgmd_host(), config.get_mgmd_port()); #ifdef NDB_SOLARIS // ok g_eventLogger.info("NDB is running on a machine with %d processor(s) at %d MHz", processor, speed); diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 0c4e24129df..600e6f67910 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -193,6 +193,8 @@ Configuration::fetch_configuration(LocalConfig &local_config){ delete m_config_retriever; } + m_mgmd_port= 0; + m_mgmd_host= 0; m_config_retriever= new ConfigRetriever(local_config, NDB_VERSION, NODE_TYPE_DB); if(m_config_retriever->init() == -1 || m_config_retriever->do_connect() == -1){ @@ -207,6 +209,9 @@ Configuration::fetch_configuration(LocalConfig &local_config){ ERROR_SET(fatal, ERR_INVALID_CONFIG, "Could connect to ndb_mgmd", s); } + m_mgmd_port= m_config_retriever->get_mgmd_port(); + m_mgmd_host= m_config_retriever->get_mgmd_host(); + ConfigRetriever &cr= *m_config_retriever; if((globalData.ownId = cr.allocNodeId()) == 0){ diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp index 7ac171c4a70..2ea32ffea37 100644 --- a/ndb/src/kernel/vm/Configuration.hpp +++ b/ndb/src/kernel/vm/Configuration.hpp @@ -67,6 +67,9 @@ public: const ndb_mgm_configuration_iterator * getOwnConfigIterator() const; + Uint32 get_mgmd_port() const {return m_mgmd_port;}; + const char *get_mgmd_host() const {return m_mgmd_host;}; + class LogLevel * m_logLevel; private: friend class Cmvmi; @@ -95,6 +98,8 @@ private: char * _backupPath; bool _initialStart; char * _connectString; + Uint32 m_mgmd_port; + const char *m_mgmd_host; bool _daemonMode; void calcSizeAlt(class ConfigValues * ); diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 7312eafb2f5..cb126a221a8 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -327,7 +327,11 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen) } else { nodeId = 0; }//if - DBUG_RETURN(startTransactionLocal(aPriority, nodeId)); + { + NdbConnection *trans= startTransactionLocal(aPriority, nodeId); + DBUG_PRINT("exit",("start trans= 0x%x", trans)); + DBUG_RETURN(trans); + } } else { DBUG_RETURN(NULL); }//if @@ -451,7 +455,7 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId) abort(); } #endif - DBUG_PRINT("exit", ("transaction id: %d", tConnection->getTransactionId())); + DBUG_PRINT("exit", ("transid= %lld", tConnection->getTransactionId())); DBUG_RETURN(tConnection); }//Ndb::startTransactionLocal() @@ -465,6 +469,8 @@ void Ndb::closeTransaction(NdbConnection* aConnection) { DBUG_ENTER("Ndb::closeTransaction"); + DBUG_PRINT("enter",("close trans= 0x%x, transid= %lld", + aConnection, aConnection->getTransactionId())); NdbConnection* tCon; NdbConnection* tPreviousCon; From 45a7efa3e8726cc4bcabc7d3abbd74868c5921e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 16:36:54 +0000 Subject: [PATCH 29/34] corrected small :) mistake --- ndb/src/ndbapi/ndb_cluster_connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index 174d2c314af..688445125f3 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -106,7 +106,7 @@ int Ndb_cluster_connection::connect(int reconnect) { if (m_local_config == 0) { m_local_config= new LocalConfig(); - if (m_local_config->init(m_connect_string,0)) { + if (!m_local_config->init(m_connect_string,0)) { ndbout << "Configuration error: Unable to retrieve local config" << endl; m_local_config->printError(); m_local_config->printUsage(); @@ -179,7 +179,7 @@ Ndb_cluster_connection::~Ndb_cluster_connection() my_free(m_connect_string,MYF(MY_ALLOW_ZERO_PTR)); if (m_config_retriever) delete m_config_retriever; - if (m_local_config == 0) + if (m_local_config) delete m_local_config; DBUG_VOID_RETURN; } From ea29015d6fb6e70e8ce7a310450581241643c1c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 18:36:56 +0200 Subject: [PATCH 30/34] Ops forgott to put table in hash --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 821c847d5b9..97270b65132 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -4561,7 +4561,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, TableRecordPtr tablePtr; c_tableRecordHash.find(tablePtr, keyRecord); - + if (checkExist){ jam(); /* ---------------------------------------------------------------- */ @@ -4645,6 +4645,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, #ifdef VM_TRACE ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i); #endif + c_tableRecordHash.add(tablePtr); } //tablePtr.p->noOfPrimkey = tableDesc.NoOfKeyAttr; From 01eca8f8307bffb4db15de0ed10aa1c5c3cbcfa0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 17:30:51 +0000 Subject: [PATCH 31/34] local config now outside config retriever --- ndb/test/src/NdbBackup.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 71b4b49b3a6..ad26dbeab16 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -69,7 +69,11 @@ NdbBackup::getBackupDataDirForNode(int _node_id){ /** * Fetch configuration from management server */ - ConfigRetriever cr(0, NODE_TYPE_API); + LocalConfig lc; + if (!lc.init(0,0)) { + abort(); + } + ConfigRetriever cr(lc, 0, NODE_TYPE_API); ndb_mgm_configuration * p = 0; BaseString tmp; tmp.assfmt("%s:%d", host.c_str(), port); From 0ef58d54886429896a6146803a7cf21822ad075b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Sep 2004 19:31:36 +0200 Subject: [PATCH 32/34] testBackup ndb/src/mgmsrv/MgmtSrvr.cpp: Fix so that start backup can be blocking ndb/test/run-test/daily-devel-tests.txt: Use atrt-testBackup (which setups env) --- ndb/src/mgmsrv/MgmtSrvr.cpp | 12 +++++++++++- ndb/test/run-test/daily-devel-tests.txt | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 4c09805ba12..92a8025295f 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -2420,7 +2420,17 @@ void MgmtSrvr::backupCallback(BackupEvent & event) { m_lastBackupEvent = event; - theWaitState = NO_WAIT; + switch(event.Event){ + case BackupEvent::BackupFailedToStart: + case BackupEvent::BackupAborted: + case BackupEvent::BackupCompleted: + theWaitState = NO_WAIT; + break; + case BackupEvent::BackupStarted: + if(theWaitState == WAIT_BACKUP_STARTED) + theWaitState = NO_WAIT; + } + return; } diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 2497fa7d038..f2abc961807 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -27,7 +27,7 @@ cmd: atrt-testBackup args: -n BackupOne T1 T6 T3 I3 max-time: 1000 -cmd: testBackup +cmd: atrt-testBackup args: -n BackupBank T6 # From 2de9ef17262a87c2b4d28c301387fcb26bba9b05 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 26 Sep 2004 10:03:57 +0200 Subject: [PATCH 33/34] testDict -n InvalidTables ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Add more require's in VM_TRACE Fix release of invalid tables testDict -n InvalidTables --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 97270b65132..d1a8128ea7f 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -3475,12 +3475,19 @@ int Dbdict::handleAlterTab(AlterTabReq * req, jam(); // Table rename // Remove from hashtable +#ifdef VM_TRACE + TableRecordPtr tmp; + ndbrequire(c_tableRecordHash.find(tmp, *origTablePtr.p)); +#endif c_tableRecordHash.remove(origTablePtr); strcpy(regAlterTabPtr->previousTableName, origTablePtr.p->tableName); strcpy(origTablePtr.p->tableName, newTablePtr.p->tableName); // Set new schema version origTablePtr.p->tableVersion = newTablePtr.p->tableVersion; // Put it back +#ifdef VM_TRACE + ndbrequire(!c_tableRecordHash.find(tmp, *origTablePtr.p)); +#endif c_tableRecordHash.add(origTablePtr); return 0; @@ -3501,12 +3508,19 @@ void Dbdict::revertAlterTable(Signal * signal, TableRecordPtr tablePtr; c_tableRecordPool.getPtr(tablePtr, tableId); // Remove from hashtable +#ifdef VM_TRACE + TableRecordPtr tmp; + ndbrequire(c_tableRecordHash.find(tmp, * tablePtr.p)); +#endif c_tableRecordHash.remove(tablePtr); // Restore name strcpy(tablePtr.p->tableName, regAlterTabPtr->previousTableName); // Revert schema version tablePtr.p->tableVersion = tablePtr.p->tableVersion - 1; // Put it back +#ifdef VM_TRACE + ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p)); +#endif c_tableRecordHash.add(tablePtr); return; @@ -4644,6 +4658,8 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, jam(); #ifdef VM_TRACE ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i); + TableRecordPtr tmp; + ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p)); #endif c_tableRecordHash.add(tablePtr); } @@ -4690,7 +4706,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, /** * Release table */ - releaseTableObject(tablePtr.i, !checkExist); + releaseTableObject(tablePtr.i, checkExist); } }//handleTabInfoInit() @@ -5501,8 +5517,13 @@ void Dbdict::releaseTableObject(Uint32 tableId, bool removeFromHash) AttributeRecordPtr attrPtr; c_tableRecordPool.getPtr(tablePtr, tableId); if (removeFromHash) + { +#ifdef VM_TRACE + TableRecordPtr tmp; + ndbrequire(c_tableRecordHash.find(tmp, * tablePtr.p)); +#endif c_tableRecordHash.remove(tablePtr); - + } tablePtr.p->tabState = TableRecord::NOT_DEFINED; Uint32 nextAttrRecord = tablePtr.p->firstAttribute; From a64953ed3f469e3efdff4dd6462a1756675459b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 26 Sep 2004 10:51:14 +0200 Subject: [PATCH 34/34] testBasic -n MassiveRollback Make sure to not receive more that buffer can fit currently ndb/src/common/transporter/TCP_Transporter.cpp: Make sure to not receive more that buffer can fit currently --- .../common/transporter/TCP_Transporter.cpp | 80 ++++++++++--------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp index b44afc7c136..7cfdc224b34 100644 --- a/ndb/src/common/transporter/TCP_Transporter.cpp +++ b/ndb/src/common/transporter/TCP_Transporter.cpp @@ -362,50 +362,56 @@ TCP_Transporter::doReceive() { // Select-function must return the socket for read // before this method is called // It reads the external TCP/IP interface once - - const int nBytesRead = recv(theSocket, - receiveBuffer.insertPtr, maxReceiveSize, 0); - - if (nBytesRead > 0) { - receiveBuffer.sizeOfData += nBytesRead; - receiveBuffer.insertPtr += nBytesRead; + int size = receiveBuffer.sizeOfBuffer - receiveBuffer.sizeOfData; + if(size > 0){ + const int nBytesRead = recv(theSocket, + receiveBuffer.insertPtr, + size < maxReceiveSize ? size : maxReceiveSize, + 0); - if(receiveBuffer.sizeOfData > receiveBuffer.sizeOfBuffer){ + if (nBytesRead > 0) { + receiveBuffer.sizeOfData += nBytesRead; + receiveBuffer.insertPtr += nBytesRead; + + if(receiveBuffer.sizeOfData > receiveBuffer.sizeOfBuffer){ #ifdef DEBUG_TRANSPORTER - ndbout_c("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)", - receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer); - ndbout_c("nBytesRead = %d", nBytesRead); + ndbout_c("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)", + receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer); + ndbout_c("nBytesRead = %d", nBytesRead); #endif - ndbout_c("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)", - receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer); - report_error(TE_INVALID_MESSAGE_LENGTH); - return 0; - } - - receiveCount ++; - receiveSize += nBytesRead; - - if(receiveCount == reportFreq){ - reportReceiveLen(get_callback_obj(), remoteNodeId, receiveCount, receiveSize); - receiveCount = 0; - receiveSize = 0; + ndbout_c("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)", + receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer); + report_error(TE_INVALID_MESSAGE_LENGTH); + return 0; + } + + receiveCount ++; + receiveSize += nBytesRead; + + if(receiveCount == reportFreq){ + reportReceiveLen(get_callback_obj(), remoteNodeId, receiveCount, receiveSize); + receiveCount = 0; + receiveSize = 0; + } + return nBytesRead; + } else { +#if defined DEBUG_TRANSPORTER + ndbout_c("Receive Failure(disconnect==%d) to node = %d nBytesSent = %d " + "errno = %d strerror = %s", + DISCONNECT_ERRNO(InetErrno, nBytesRead), + remoteNodeId, nBytesRead, InetErrno, + (char*)ndbstrerror(InetErrno)); +#endif + if(DISCONNECT_ERRNO(InetErrno, nBytesRead)){ + // The remote node has closed down + doDisconnect(); + report_disconnect(InetErrno); + } } return nBytesRead; } else { -#if defined DEBUG_TRANSPORTER - ndbout_c("Receive Failure(disconnect==%d) to node = %d nBytesSent = %d " - "errno = %d strerror = %s", - DISCONNECT_ERRNO(InetErrno, nBytesRead), - remoteNodeId, nBytesRead, InetErrno, - (char*)ndbstrerror(InetErrno)); -#endif - if(DISCONNECT_ERRNO(InetErrno, nBytesRead)){ - // The remote node has closed down - doDisconnect(); - report_disconnect(InetErrno); - } + return 0; } - return nBytesRead; } void