Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B08A10A5D for ; Mon, 16 Mar 2015 18:01:34 +0000 (UTC) Received: (qmail 7050 invoked by uid 500); 16 Mar 2015 18:01:33 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 6962 invoked by uid 500); 16 Mar 2015 18:01:33 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 6939 invoked by uid 99); 16 Mar 2015 18:01:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2015 18:01:33 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of octo47@gmail.com designates 209.85.214.169 as permitted sender) Received: from [209.85.214.169] (HELO mail-ob0-f169.google.com) (209.85.214.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2015 18:01:07 +0000 Received: by obfv9 with SMTP id v9so41685398obf.2 for ; Mon, 16 Mar 2015 10:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=EszBX1b51EV/sLeBPgg1UQo8NRcRS1q3/O2omuQVRjM=; b=Djlah6ZRVgr7IgOdj9kmClS/pPgylCg02Z3xpbJTzgWpsQjDQRtSNhVGYc3hgc4Tas 7UKvsJ3SnXFfl/xuELJJQAGkszxw0kq0/xDC4+pU29ANHfz9p91DoBHBQ56iw1HJBAfR Q0gJzhdjYcKr/OdDIUTGhhCxVprG/u8X0tbavLBLjZ7m8r+KpkkgGKf2dfZ8ryuhqzsS ePhWzuNV88z3nhoWDlULqmPZa5wW+uIX3MISX/zhXI2X5mfMN4jAKVwJfnovZEh7zmId ZrO8luPB+nLBXhfjBGDgg1XToXqvT5ys0poJUbucjKAgE7GgpPMc2FWmRlp0elpW2vZw gKJw== X-Received: by 10.202.223.6 with SMTP id w6mr46090869oig.89.1426528730283; Mon, 16 Mar 2015 10:58:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.86.38 with HTTP; Mon, 16 Mar 2015 10:58:30 -0700 (PDT) In-Reply-To: References: From: Andrey Stepachev Date: Mon, 16 Mar 2015 17:58:30 +0000 Message-ID: Subject: Re: Question on EnableTableHandler code To: dev@hbase.apache.org Content-Type: multipart/alternative; boundary=001a113d631e3b056305116b9ab6 X-Virus-Checked: Checked by ClamAV on apache.org --001a113d631e3b056305116b9ab6 Content-Type: text/plain; charset=UTF-8 Thanks Stephen. Looks like you are right. For (1) case we really don't need there state cleanup. That is a bug. Should throw TableNotFoundException. As for (2) in case of no online region servers available we could leave table enabled, but no regions would be assigned. Actually that rises good question what enable table means, i.e. do we really need to guarantee that on table enable absolutely all regions are online, or that could be done in Admin on client side. So for now it seems that Enable handler do what is best, and leave table enabled but unassigned to be later assigned by Balancer. On Mon, Mar 16, 2015 at 5:34 PM, Stephen Jiang wrote: > I want to make sure that the following logic in EnableTableHandler is > correct: > > (1). In EnableTableHandler#prepare - if the table is not existed, it marked > the table as deleted and not throw exception. The result is the table lock > is released and the caller has no knowledge that the table not exist or > already deleted, it would continue the next step. > > Currently, this would happen during recovery (the caller is > AssignmentManager#recoverTableInEnablingState()) - however, looking at > recovery code, it expects TableNotFoundException Should we always throw > exception - if the table not exist? I want to make sure that I don't break > recovery logic by modifying. > > public EnableTableHandler prepare() { > > ... > > // Check if table exists > > if (!MetaTableAccessor.tableExists(this.server.getConnection(), > tableName)) { > > // retainAssignment is true only during recovery. In normal case > it is false > > if (!this.skipTableStateCheck) { > > throw new TableNotFoundException(tableName); > > } > > this.assignmentManager.getTableStateManager().setDeletedTable( > tableName); > > } > > ... > > } > (2). In EnableTableHandler#handleEnableTable() - if the bulk assign plan > could not be find, it would leave regions to be offline and declare enable > table succeed - i think this is a bug and we should retry or fail - but I > want to make sure that there are some merit behind this logic > > private void handleEnableTable() { > > Map> bulkPlan = > > this.assignmentManager.getBalancer().retainAssignment( > regionsToAssign, onlineServers); > > if (bulkPlan != null) { > > ... > > } else { > > LOG.info("Balancer was unable to find suitable servers for table " + > tableName > > + ", leaving unassigned"); > > done = true; > > } > > if (done) { > > // Flip the table to enabled. > > this.assignmentManager.getTableStateManager().setTableState( > > this.tableName, TableState.State.ENABLED); > > LOG.info("Table '" + this.tableName > > + "' was successfully enabled. Status: done=" + done); > > } > > ... > > } > > > thanks > Stephen > -- Andrey. --001a113d631e3b056305116b9ab6--