pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<tfoot id='no06G'></tfoot>
    <bdo id='no06G'></bdo><ul id='no06G'></ul>
    1. <i id='no06G'><tr id='no06G'><dt id='no06G'><q id='no06G'><span id='no06G'><b id='no06G'><form id='no06G'><ins id='no06G'></ins><ul id='no06G'></ul><sub id='no06G'></sub></form><legend id='no06G'></legend><bdo id='no06G'><pre id='no06G'><center id='no06G'></center></pre></bdo></b><th id='no06G'></th></span></q></dt></tr></i><div class="1zft77r" id='no06G'><tfoot id='no06G'></tfoot><dl id='no06G'><fieldset id='no06G'></fieldset></dl></div>
    2. <small id='no06G'></small><noframes id='no06G'>

        <legend id='no06G'><style id='no06G'><dir id='no06G'><q id='no06G'></q></dir></style></legend>

      1. 如何使用 C API 為 MySQL 查詢設置超時

        How to set a timeout for MySQL query using C API(如何使用 C API 為 MySQL 查詢設置超時)
            • <bdo id='8vqM4'></bdo><ul id='8vqM4'></ul>
              <legend id='8vqM4'><style id='8vqM4'><dir id='8vqM4'><q id='8vqM4'></q></dir></style></legend>
                <tfoot id='8vqM4'></tfoot>
                  <tbody id='8vqM4'></tbody>
                  <i id='8vqM4'><tr id='8vqM4'><dt id='8vqM4'><q id='8vqM4'><span id='8vqM4'><b id='8vqM4'><form id='8vqM4'><ins id='8vqM4'></ins><ul id='8vqM4'></ul><sub id='8vqM4'></sub></form><legend id='8vqM4'></legend><bdo id='8vqM4'><pre id='8vqM4'><center id='8vqM4'></center></pre></bdo></b><th id='8vqM4'></th></span></q></dt></tr></i><div class="j5nv3h7" id='8vqM4'><tfoot id='8vqM4'></tfoot><dl id='8vqM4'><fieldset id='8vqM4'></fieldset></dl></div>

                  <small id='8vqM4'></small><noframes id='8vqM4'>

                  本文介紹了如何使用 C API 為 MySQL 查詢設置超時的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我知道這里有很多類似的問題,也有很多結果,當我用谷歌搜索時,但沒有一個能回答我的問題.我讀了這個,這個,這個 和 this 但它們都不適合我.我不談論任何鎖,我不想使用 MySQL C++ 連接器來做到這一點,只是 C API.

                  I know there are lots of similar questions here, also there are lots of results, when I google it, but none of them answers my question. I read this, this, this and this but none of them works for me. I don't talk about any locks, I don't wanna do this using MySQL c++ connector, just the C API.

                  此外,這里非常重要的是:我在 LINUX 上執行此操作.為什么我提到這個?因為在 mysql_options 的文檔中:

                  Also, what is very important here: I do this on LINUX. Why I mention this? Because in the documentation for mysql_options:

                  MYSQL_OPT_READ_TIMEOUT - ...This option works only for 
                  TCP/IP connections and, prior to MySQL 5.0.25, only for Windows.
                  
                  MYSQL_OPT_WRITE_TIMEOUT- ... This option works only for 
                  TCP/IP connections and, prior to MySQL 5.0.25, only for Windows

                  那么,有沒有辦法為 5.0.25 之前的版本設置查詢超時?

                  So, is there any way to set a query timeout for versions, prior 5.0.25?

                  我的 MySQL 版本:

                  My MySQL version:

                  [root@xxx kiril]# mysql --version
                  mysql  Ver 14.12 Distrib 5.0.22, for redhat-linux-gnu (i686) using readline 5.0

                  至少,有沒有辦法取消查詢?我可以作為不同的線程啟動一個計時器,但是當它到期時..我可以以某種方式取消查詢嗎?

                  At least, is there any way to cancel a query? I can start a timer as different thread, but when it expires.. can I cancel the query somehow?

                  推薦答案

                  好的,我找到了解決方案.感謝 WillPRR(我的同事).

                  Okay, I found a solution.. Thanks to Will and PRR( my co-worker ).

                  無法在每個查詢上啟動一個新線程,因為這是一個實時應用程序,應該每秒處理 1000 多條消息..(無論如何,感謝 R.. 的想法).

                  I cannot start a new thread on each query, as this is a real-time application, that is supposed to process 1000+ messages per second..(anyway, thanks to R.. for the idea).

                  此外,無法通過庫終止連接,也無法取消/終止查詢,因為問題出在數據庫服務器上..

                  Also, it was not possible to terminate the connection through the library, nor to cancel/kill the query, as the problem was in the DB server..

                  這是一個蠻力解決方案,但比 _EXIT( FAILURE ) 更好:這是相關問題:如何在 Linux 上強制關閉套接字?" - 所以,我只是使用系統調用關閉了套接字.

                  And here's a brute-force solution, but still much better that _EXIT( FAILURE ): Here's the related question: "How to force closing socket on Linux?" - so, I just closed the socket using a system call.

                  重要提示:(感謝 Will) - 事實證明,我們的 MySQL 庫包裝器具有故障安全"標志,因此在關閉的套接字(或其他嚴重錯誤)上,它會嘗試以解決"問題,因此在我的情況下,它會自行重新打開套接字.所以,我剛剛關閉了這個選項,現在一切都很好 - 執行因異常而終止 - 這是執行此操作的最軟"方式.
                  這當然應該通過另一個線程來完成 - 例如一個計時器.

                  Important NOTE: (thanks Will) - It turned out, that our MySQL library wrapper has s "fail-safe" flag, so that on closed socket (or other critical error), it tries to "solve" the problem, so it reopens the socket, by itself, in my case. So, I just turned off this option and everything is fine now - the execute is terminated because of an exception - this is the "softest" way to do this.
                  This should be done through another thread, of course - a timer, for example.

                  超時對于 5.0.25 之后的版本確實有效.但是,至少在 RHEL4 和 RHEL5 上,由于某種原因,超時時間增加了三倍!例如,如果某些超時設置為 20 秒,則實際超時為 ~60 秒..
                  此外,另一件重要的事情是,這些超時(與任何其他選項一樣)必須設置 after mysql_initbefore> mysql_connectmysql_real_connect.

                  The timeouts are really working for versions after 5.0.25. But, at least on RHEL4 and RHEL5, the timeouts are tripled for some reason! For example, if some of the timeouts is set to 20sec, the real timeout is ~60sec..
                  Also, another important thing is, that these timeouts(as any other options) MUST be set after mysql_init and before mysql_connect or mysql_real_connect.

                  這篇關于如何使用 C API 為 MySQL 查詢設置超時的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)

                    <tfoot id='okOBi'></tfoot>

                    <small id='okOBi'></small><noframes id='okOBi'>

                            <tbody id='okOBi'></tbody>
                        1. <i id='okOBi'><tr id='okOBi'><dt id='okOBi'><q id='okOBi'><span id='okOBi'><b id='okOBi'><form id='okOBi'><ins id='okOBi'></ins><ul id='okOBi'></ul><sub id='okOBi'></sub></form><legend id='okOBi'></legend><bdo id='okOBi'><pre id='okOBi'><center id='okOBi'></center></pre></bdo></b><th id='okOBi'></th></span></q></dt></tr></i><div class="bv7th9p" id='okOBi'><tfoot id='okOBi'></tfoot><dl id='okOBi'><fieldset id='okOBi'></fieldset></dl></div>
                            <bdo id='okOBi'></bdo><ul id='okOBi'></ul>
                            <legend id='okOBi'><style id='okOBi'><dir id='okOBi'><q id='okOBi'></q></dir></style></legend>
                          • 主站蜘蛛池模板: UV固化机_UVLED光固化机_UV干燥机生产厂家-上海冠顶公司专业生产UV固化机设备 | 大型工业风扇_工业大风扇_大吊扇_厂房车间降温-合昌大风扇 | 德国进口电锅炉_商用电热水器_壁挂炉_电采暖器_电热锅炉[德国宝] | 帽子厂家_帽子工厂_帽子定做_义乌帽厂_帽厂_制帽厂 | 集装袋吨袋生产厂家-噸袋廠傢-塑料编织袋-纸塑复合袋-二手吨袋-太空袋-曹县建烨包装 | 智能终端_RTU_dcm_北斗星空自动化科技 | 电采暖锅炉_超低温空气源热泵_空气源热水器-鑫鲁禹电锅炉空气能热泵厂家 | 氧化铁红厂家-淄博宗昂化工| 蓝米云-专注于高性价比香港/美国VPS云服务器及海外公益型免费虚拟主机 | 西装定制/做厂家/公司_西装订做/制价格/费用-北京圣达信西装 | 上海防爆真空干燥箱-上海防爆冷库-上海防爆冷柜?-上海浦下防爆设备厂家? | 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 煤粉取样器-射油器-便携式等速飞灰取样器-连灵动 | 菲希尔X射线测厚仪-菲希尔库伦法测厚仪-无锡骏展仪器有限责任公司 | 海尔生物医疗四川代理商,海尔低温冰箱四川销售-成都壹科医疗器械有限公司 | 杭州高温泵_热水泵_高温油泵|昆山奥兰克泵业制造有限公司 | 品牌设计_VI设计_电影海报设计_包装设计_LOGO设计-Bacross新越品牌顾问 | 高压绝缘垫-红色配电房绝缘垫-绿色高压绝缘地毯-上海苏海电气 | 焊缝跟踪系统_激光位移传感器_激光焊缝跟踪传感器-创想智控 | GAST/BRIWATEC/CINCINNATI/KARL-KLEIN/ZIEHL-ABEGG风机|亚喜科技 | 新型锤式破碎机_新型圆锥式_新型颚式破碎机_反击式打沙机_锤式制砂机_青州建源机械 | 爱佩恒温恒湿测试箱|高低温实验箱|高低温冲击试验箱|冷热冲击试验箱-您身边的模拟环境试验设备技术专家-合作热线:400-6727-800-广东爱佩试验设备有限公司 | 中医中药治疗血小板减少-石家庄血液病肿瘤门诊部 | 碳纤维复合材料制品生产定制工厂订制厂家-凯夫拉凯芙拉碳纤维手机壳套-碳纤维雪茄盒外壳套-深圳市润大世纪新材料科技有限公司 | 生物制药洁净车间-GMP车间净化工程-食品净化厂房-杭州波涛净化设备工程有限公司 | 土壤墒情监测站_土壤墒情监测仪_土壤墒情监测系统_管式土壤墒情站-山东风途物联网 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 山东活动策划|济南活动公司|济南公关活动策划-济南锐嘉广告有限公司 | 电子元器件呆滞料_元器件临期库存清仓尾料_尾料优选现货采购处理交易商城 | 不锈钢轴流风机,不锈钢电机-许昌光维防爆电机有限公司(原许昌光维特种电机技术有限公司) | 订做不锈钢_不锈钢定做加工厂_不锈钢非标定制-重庆侨峰金属加工厂 | 作文导航网_作文之家_满分作文_优秀作文_作文大全_作文素材_最新作文分享发布平台 | TTCMS自助建站_网站建设_自助建站_免费网站_免费建站_天天向上旗下品牌 | 首页|成都尚玖保洁_家政保洁_开荒保洁_成都保洁 | 首页-浙江橙树网络技术有限公司 石磨面粉机|石磨面粉机械|石磨面粉机组|石磨面粉成套设备-河南成立粮油机械有限公司 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 河南空气能热水器-洛阳空气能采暖-洛阳太阳能热水工程-洛阳润达高科空气能商行 | 低合金板|安阳低合金板|河南低合金板|高强度板|桥梁板_安阳润兴 北京租车牌|京牌指标租赁|小客车指标出租 | 扬尘在线监测系统_工地噪声扬尘检测仪_扬尘监测系统_贝塔射线扬尘监测设备「风途物联网科技」 | 定制防伪标签_防伪标签印刷_防伪标签厂家-510品保防伪网 | 岛津二手液相色谱仪,岛津10A液相,安捷伦二手液相,安捷伦1100液相-杭州森尼欧科学仪器有限公司 |