久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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 查詢?cè)O(shè)置超時(shí)

        How to set a timeout for MySQL query using C API(如何使用 C API 為 MySQL 查詢?cè)O(shè)置超時(shí))
            • <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="qwawimqqmiuu" 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 查詢?cè)O(shè)置超時(shí)的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我知道這里有很多類似的問題,也有很多結(jié)果,當(dāng)我用谷歌搜索時(shí),但沒有一個(gè)能回答我的問題.我讀了這個(gè),這個(gè),這個(gè) 和 this 但它們都不適合我.我不談?wù)撊魏捂i,我不想使用 MySQL C++ 連接器來做到這一點(diǎn),只是 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 上執(zhí)行此操作.為什么我提到這個(gè)?因?yàn)樵?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 之前的版本設(shè)置查詢超時(shí)?

                  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

                  至少,有沒有辦法取消查詢?我可以作為不同的線程啟動(dòng)一個(gè)計(jì)時(shí)器,但是當(dāng)它到期時(shí)..我可以以某種方式取消查詢嗎?

                  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 ).

                  無法在每個(gè)查詢上啟動(dòng)一個(gè)新線程,因?yàn)檫@是一個(gè)實(shí)時(shí)應(yīng)用程序,應(yīng)該每秒處理 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).

                  此外,無法通過庫(kù)終止連接,也無法取消/終止查詢,因?yàn)閱栴}出在數(shù)據(jù)庫(kù)服務(wù)器上..

                  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..

                  這是一個(gè)蠻力解決方案,但比 _EXIT( FAILURE ) 更好:這是相關(guān)問題:如何在 Linux 上強(qiáng)制關(guān)閉套接字?" - 所以,我只是使用系統(tǒng)調(diào)用關(guān)閉了套接字.

                  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) - 事實(shí)證明,我們的 MySQL 庫(kù)包裝器具有故障安全"標(biāo)志,因此在關(guān)閉的套接字(或其他嚴(yán)重錯(cuò)誤)上,它會(huì)嘗試以解決"問題,因此在我的情況下,它會(huì)自行重新打開套接字.所以,我剛剛關(guān)閉了這個(gè)選項(xiàng),現(xiàn)在一切都很好 - 執(zhí)行因異常而終止 - 這是執(zhí)行此操作的最軟"方式.
                  這當(dāng)然應(yīng)該通過另一個(gè)線程來完成 - 例如一個(gè)計(jì)時(shí)器.

                  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.

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

                  這篇關(guān)于如何使用 C API 為 MySQL 查詢?cè)O(shè)置超時(shí)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

                    <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="qwawimqqmiuu" 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>
                          • 主站蜘蛛池模板: 国产最新网址 | 国产成人精品一区 | 国产成人精品一区二区三区 | 日本精品视频 | 天天视频成人 | 精品久久久久久久人人人人传媒 | 国产乱肥老妇国产一区二 | 国产精品一区二区三区四区 | 91色在线| 久久久国产精品 | 精品国产一区二区三区久久狼黑人 | 亚洲欧洲小视频 | 免费成人高清在线视频 | 中文字幕国产日韩 | 色综合99 | 欧美三级电影在线播放 | 国产一级大片 | 欧美www在线| 亚洲国产日本 | 99精品久久久久久久 | 久久久做 | 天天干天天色 | 欧美激情一区二区三区 | 欧美精品日韩精品国产精品 | 操操日| 欧美综合视频在线 | 国产综合在线视频 | 亚洲天堂中文字幕 | 欧美一级毛片免费观看 | 一区二区在线 | 日韩视频中文字幕 | 欧美日韩电影一区二区 | 亚州成人| 欧美精品成人一区二区三区四区 | 一区二区三区精品在线 | 亚洲a网| 国产精品激情 | 日韩av在线一区二区 | 欧美日韩综合精品 | 亚洲国产91 | 日韩综合一区 |