{"id":658,"date":"2006-04-19T15:14:09","date_gmt":"2006-04-19T05:14:09","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/2006\/04\/19\/rusty-on-floating-point-and-keeping-neat-code\/"},"modified":"2006-04-19T15:14:09","modified_gmt":"2006-04-19T05:14:09","slug":"rusty-on-floating-point-and-keeping-neat-code","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2006\/04\/19\/rusty-on-floating-point-and-keeping-neat-code\/","title":{"rendered":"Rusty on floating point (and keeping neat code)"},"content":{"rendered":"<p><a href=\"http:\/\/ozlabs.org\/~rusty\/index.cgi\/2006\/04\/17#2006-04-17\">Rusty talks about the &#8220;fun&#8221; of floating point<\/a> and how this all ties into <a href=\"http:\/\/www.wesnoth.org\">Wesnoth<\/a>.<\/p>\n<p>Platform consistency is certainly a good thing &#8211; so I&#8217;m guessing the attack_prediction code isn&#8217;t run by each node in a network game in a way where machines could disagree on the outcome.<\/p>\n<p>This does however bring up an interesting thing. What if, in the future, it was going to be on a per-node basis and people wanted it to be consistent. How do you warn that this isn&#8217;t the case (to somebody who is really just reading the docs on this function)?<\/p>\n<p>Is it easy (or is there even a good way) to separate code that&#8217;s on one machine versus every one? In NDB we have some protocols where some things are done on a master and others on the slaves (and sometimes, when we go back to refactor the code, we move some of this stuff around &#8211; e.g. some work on the BACKUP block that I did a while ago).<\/p>\n<p>In NDB we rely on separate documentation (a diagram showing what signals go where and from who) and keep the code for executing the signals together in the code. We require the coder to think when they&#8217;re changing things about where the code is going to be executed (on the master, the slave or both).<\/p>\n<p>We&#8217;ve also started to get some better habits in naming structures that are only going to be filled out on the master (or slave) or both. Writing code that looks at the wrong thing has been a source of bugs (especially while hacking on something) that are annoying to track down.<\/p>\n<p>So how do we have these functions that in some cases shouldn&#8217;t be used (e.g. when consistency across platforms is important, or should only be used on the slave side of a distributed protocol)? Or rather, how do we warn others (and ourselves) from getting it wrong in the future?<\/p>\n<p>Is the ultimate answer just that &#8220;you should read the code and understand it before you use it&#8221;? Probably, because any comments are going to be out of date anyway&#8230;.<\/p>\n<p>i now look forward to some sort of discussion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rusty talks about the &#8220;fun&#8221; of floating point and how this all ties into Wesnoth. Platform consistency is certainly a good thing &#8211; so I&#8217;m guessing the attack_prediction code isn&#8217;t run by each node in a network game in a &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2006\/04\/19\/rusty-on-floating-point-and-keeping-neat-code\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[14,7],"tags":[],"class_list":["post-658","post","type-post","status-publish","format-standard","hentry","category-mysql","category-work-et-al"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-aC","jetpack-related-posts":[{"id":549,"url":"https:\/\/www.flamingspork.com\/blog\/2006\/01\/11\/bug-15695-and-ndb-initial-start\/","url_meta":{"origin":658,"position":0},"title":"Bug 15695 and NDB initial start","author":"Stewart Smith","date":"2006-01-11","format":false,"excerpt":"The process for starting up a cluster is pretty interesting. Where, of course, \"interesting\" is translated to \"complex\". There's a lot of things you have to watch out for (namely you want one cluster, not two or ten or anything). You also want to actually start a cluster, not just\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":805,"url":"https:\/\/www.flamingspork.com\/blog\/2007\/03\/17\/ndb-online-add-node-progress-or-rather-testing-it\/","url_meta":{"origin":658,"position":1},"title":"NDB Online Add Node Progress (or rather, testing it)","author":"Stewart Smith","date":"2007-03-17","format":false,"excerpt":"So, the sitch as of today: Added ndb_mgm_set_configuration() call to the mgmapi - which is not-so-casually evil API call that sends a packed ndb_mgm_configuration object (like what you get from ndb_mgm_get_configuration) to the management server, who then resets its lists of nodes for event reporting and for ClusterMgr and starts\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":800,"url":"https:\/\/www.flamingspork.com\/blog\/2007\/03\/10\/code-size-of-an-engine-versus-test-suite\/","url_meta":{"origin":658,"position":2},"title":"Code size of an engine versus test suite","author":"Stewart Smith","date":"2007-03-10","format":false,"excerpt":"If you count the lines of code in the MySQL Cluster (NDB) test suite (mysql-5.1\/storage\/ndb\/test - and exclude the old ODBC stuff) you come up with about 104000 lines of code. This is in contrast to the approximate other 350,000 lines of code for the NDB engine (excluding the handler,\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":828,"url":"https:\/\/www.flamingspork.com\/blog\/2007\/04\/27\/experimental-ndb-patches\/","url_meta":{"origin":658,"position":3},"title":"Experimental NDB Patches","author":"Stewart Smith","date":"2007-04-27","format":false,"excerpt":"I've just put up the current \"add node\" patch... which is like, totally experimental and kills kittens... but could be interesting for people to have a look at as it progresses. Still lots of work before production ready - but people here at the MySQL Conf have said they're interested\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3304,"url":"https:\/\/www.flamingspork.com\/blog\/2013\/05\/13\/the-mysql-cluster-storage-engine\/","url_meta":{"origin":658,"position":4},"title":"The MySQL Cluster storage engine","author":"Stewart Smith","date":"2013-05-13","format":false,"excerpt":"This is one close to my heart. I've recently written on other storage engines:\u00c2\u00a0Where are they now: MySQL Storage Engines,\u00c2\u00a0The MERGE storage engine: not dead, just resting\u00e2\u20ac\u00a6. or forgotten\u00c2\u00a0and The MEMORY storage engine. Today, it's the turn of MySQL Cluster. Like InnoDB, MySQL Cluster started outside of MySQL. Those of\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":447,"url":"https:\/\/www.flamingspork.com\/blog\/2005\/08\/08\/ndb_mgmd-restart\/","url_meta":{"origin":658,"position":5},"title":"ndb_mgmd restart","author":"Stewart Smith","date":"2005-08-08","format":false,"excerpt":"One of the things I'm working on is adding the ability to use ndb_mgm to issue a restart command to ndb_mgmd (i.e. from a management client, get management servers to restart). At the moment, you have to go and shut it down then start it yourself. So why would you\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=658"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/658\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}