Return-Path: Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: (qmail 875 invoked from network); 17 Oct 2010 04:48:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Oct 2010 04:48:45 -0000 Received: (qmail 97586 invoked by uid 500); 17 Oct 2010 04:48:45 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 97500 invoked by uid 500); 17 Oct 2010 04:48:44 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 97491 invoked by uid 99); 17 Oct 2010 04:48:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Oct 2010 04:48:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Oct 2010 04:48:43 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9H4mNbM003251 for ; Sun, 17 Oct 2010 04:48:23 GMT Message-ID: <8941228.6511287290903134.JavaMail.jira@thor> Date: Sun, 17 Oct 2010 00:48:23 -0400 (EDT) From: "stack (JIRA)" To: issues@hbase.apache.org Subject: [jira] Assigned: (HBASE-2669) HCM.shutdownHook causes data loss with hbase.client.write.buffer != 0 In-Reply-To: <17479069.195621275704515222.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-2669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] stack reassigned HBASE-2669: ---------------------------- Assignee: stack (was: Benoit Sigoure) > HCM.shutdownHook causes data loss with hbase.client.write.buffer != 0 > --------------------------------------------------------------------- > > Key: HBASE-2669 > URL: https://issues.apache.org/jira/browse/HBASE-2669 > Project: HBase > Issue Type: Bug > Components: client > Reporter: Benoit Sigoure > Assignee: stack > Priority: Critical > Fix For: 0.90.0 > > Attachments: 2669.txt > > > In my application I set {{hbase.client.write.buffer}} to a reasonably small value (roughly 64 edits) in order to try to batch a few {{Put}} together before talking to HBase. When my application does a graceful shutdown, I call {{HTable#flushCommits}} in order to flush any pending change to HBase. I want to do the same thing when I get a {{SIGTERM}} by using {{Runtime#addShutdownHook}} but this is impossible since {{HConnectionManager}} already registers a shutdown hook that invokes {{HConnectionManager#deleteAllConnections}}. This static method closes all the connections to HBase and then all connections to ZooKeeper. Because all shutdown hooks run in parallel, my hook will attempt to flush edits while connections are getting closed. > There is no way to guarantee the order in which the hooks will execute, so I propose that we remove the hook in the HCM altogether and provide some user-visible API they call in their own hook after they're done flushing their stuff, if they really want to do a graceful shutdown. I expect that a lot of users won't use a hook though, otherwise this issue would have cropped up already. For those users, connections won't get "gracefully" terminated, but I don't think that would be a problem since the underlying TCP socket will get closed by the OS anyway, so things like ZooKeeper and such should realize that the connection has been terminated and assume the client is gone, and do the necessary clean-up on their side. > An alternate fix would be to leave the hook in place by default but keep a reference to it and add a user-visible API to be able to un-register the hook. I find this ugly. > Thoughts? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.