久久久久久久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 查詢設置超時

        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="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 查詢設置超時的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我知道這里有很多類似的問題,也有很多結果,當我用谷歌搜索時,但沒有一個能回答我的問題.我讀了這個,這個,這個 和 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 上執(zhí)行此操作.為什么我提到這個?因為在 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).

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

                  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 上強制關閉套接字?" - 所以,我只是使用系統(tǒng)調用關閉了套接字.

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

                  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模板網(wǎng)!

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

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) 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 函數(shù)的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發(fā)生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫表作為 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>
                          • 主站蜘蛛池模板: 欧美久久一级 | 精品日韩一区二区三区av动图 | 日韩精品视频在线 | 午夜电影福利 | 亚洲精品一区二区三区蜜桃久 | 亚洲天天干 | 日韩视频―中文字幕 | 国产成人精品一区二区 | 国产精品毛片无码 | 91不卡 | 国产精品亚洲精品 | 91精品亚洲 | 亚洲精品视频观看 | 国产欧美一区二区久久性色99 | 日韩精品一区二区三区第95 | 99精品视频在线 | 婷婷综合五月天 | 中日韩毛片| 亚洲成人一区二区 | 欧美激情久久久 | 欧美成人自拍 | 国产亚洲精品久久午夜玫瑰园 | 成人免费视频网址 | 成人在线免费视频观看 | 国产精品久久久久久一区二区三区 | 成人精品一区二区三区四区 | 九九热最新视频 | 亚洲成人av在线 | 午夜精品影院 | 亚洲成人综合在线 | 亚洲视频 欧美视频 | 亚洲一区二区三区福利 | 亚洲电影免费 | www.一级片| 日韩成人免费视频 | 成人羞羞国产免费视频 | 午夜大片| 国产丝袜一区二区三区免费视频 | 欧美成人手机视频 | 久久久久久国产精品免费 | 国产亚洲www |