{"id":29,"date":"2012-08-23T10:13:04","date_gmt":"2012-08-23T13:13:04","guid":{"rendered":"http:\/\/monitor.infracoop.com.ar\/blog2\/?p=29"},"modified":"2012-08-22T21:01:44","modified_gmt":"2012-08-23T00:01:44","slug":"cuando-exclusive-no-es-tan-exclusivo","status":"publish","type":"post","link":"https:\/\/www.infracoop.com.ar\/?p=29","title":{"rendered":"Cuando &#8216;EXCLUSIVE&#8217; no es tan exclusivo&#8230;"},"content":{"rendered":"<p>Cualquier DBA que se precie necesit\u00f3 en alg\u00fan momento crear un \u00edndice (antes del advenimiento del \u2018online\u2019) o cambiar una tabla en un sistema productivo.<\/p>\n<p>Y en general, sistema productivo suele traducirse en NO HAY TIEMPO PARA DOWNTIME!<\/p>\n<p>Una pr\u00e1ctica poco conocida en informix es poner un lock exclusivo en la tabla a modificar, intentar el alter table y cruzar los dedos.<\/p>\n<p>Pero hay alternativas en sistemas OLTP (donde las conexiones entran y salen todo el tiempo): decirle a informix que no acepte nuevas lecturas sobre esa tabla (dirty reads), hasta que pueda aplicar el cambio.<\/p>\n<p>R\u00e1pidamente, se hace as\u00ed:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\nIFX_DIRTY_WAIT=300\r\nexport IFX_DIRTY_WAIT\r\ndbaccess blah &amp;lt;&amp;lt;\r\nSET LOCK MODE TO WAIT;\r\nBEGIN WORK;\r\nLOCK TABLE IN EXCLUSIVE MODE;\r\nALTER TABLE ...;\r\nCOMMIT WORK;\r\nEOF\r\n<\/pre>\n<p>O sea, le pido que durante 300 segundos mantenga (gracias al lock) afuera a los nuevos dirty readers (haci\u00e9ndolos esperar hasta 300 segundos antes de dar error), esperando que las sesiones actuales finalicen (o d\u00e1ndome tiempo a matarlas!) para poder aplicar el cambio.<\/p>\n<p>Si quieren una explicaci\u00f3n profunda y detallada, lean esto:<br \/>\n<a href=\"http:\/\/informix-technology.blogspot.com.ar\/2006\/10\/when-exclusive-is-not-really-exclusive.html\" target=\"_blank\">http:\/\/informix-technology.blogspot.com.ar\/2006\/10\/when-exclusive-is-not-really-exclusive.html<\/a> de Fernando Nunes, que no solo lo cuenta mejor, sino con ejemplos y demases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cualquier DBA que se precie necesit\u00f3 en alg\u00fan momento crear un \u00edndice (antes del advenimiento del \u2018online\u2019) o cambiar una tabla en un sistema productivo. Y en&hellip; <span class=\"read-more\"><a class=\"more-link\" href=\"https:\/\/www.infracoop.com.ar\/?p=29\" rel=\"bookmark\">Read more <span class=\"screen-reader-text\">&#8220;Cuando &#8216;EXCLUSIVE&#8217; no es tan exclusivo&#8230;&#8221;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[11,13,12],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-informix","tag-alter","tag-dirty-reads","tag-lock-mode"],"_links":{"self":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":8,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":148,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/148"}],"wp:attachment":[{"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infracoop.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}