On Sun, Aug 4, 2013 at 7:56 PM, lars hofhansl <la...@apache.org> wrote:
> Let's do a little quiz: > > HTable t1 = new HTable(conf); > t1.close(); > > // 1. Will the next line create a new HConnection behind the scenes (along > with re-creating all the caches)? > // (If so, it will be expensive, if not, when is the first HConnection > actually released?) > HTable t2 = new HTable(conf); > > // 2. how about this one? > HTable t2 = new HTable(new Configuration(conf)); > > // 3. or now? > conf.setInt(HConstants.HBASE_CLIENT_PAUSE, 2000); > HTable t3 = new HTable(conf); > > // 4. and now? > conf.setInt(HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, 1024000); > HTable t4 = new HTable(conf); > > // 5. how many connections are opened now? > t4.close(); > > This stuff is convoluted and needlessly complicated. And this is not > because the code is bad, but because the abstraction is simply inadequate. > A client wants to connect to a cluster and then do some action on that > cluster (via HTable as a convenience). > If the cluster connection is implicit it leads to all of the above > considerations. > > Love the quiz. +1 on your redo of our connection model (HConnection is a "cluster connection". I like that you have to get one of these first...) St.Ack