Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D2E8A200CB6 for ; Wed, 14 Jun 2017 12:00:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D16ED160BC0; Wed, 14 Jun 2017 10:00:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EEA1B160BDB for ; Wed, 14 Jun 2017 12:00:04 +0200 (CEST) Received: (qmail 55165 invoked by uid 500); 14 Jun 2017 10:00:04 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 55074 invoked by uid 99); 14 Jun 2017 10:00:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jun 2017 10:00:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A6367CF7BD for ; Wed, 14 Jun 2017 10:00:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id jW1kleu5FjN3 for ; Wed, 14 Jun 2017 10:00:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 8E36C5FB17 for ; Wed, 14 Jun 2017 10:00:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 081CCE05BF for ; Wed, 14 Jun 2017 10:00:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B4EF420DF1 for ; Wed, 14 Jun 2017 10:00:00 +0000 (UTC) Date: Wed, 14 Jun 2017 10:00:00 +0000 (UTC) From: "anishek (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HIVE-16865) Handle replication bootstrap of large databases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 14 Jun 2017 10:00:06 -0000 [ https://issues.apache.org/jira/browse/HIVE-16865?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1604= 8991#comment-16048991 ]=20 anishek edited comment on HIVE-16865 at 6/14/17 9:59 AM: --------------------------------------------------------- h4. Bootstrap Replication Dump * db metadata one at a time * function metadata one at a time * get all tableNames =E2=80=94 which should not be overwhelming =09 * tables is also requested one a time. =E2=80=94 all partition definitions = are loaded in one go for a table and we dont expect a table with more than = 5-10 partition definition columns * the partition object themselves will be done in batches via the Partitio= nIteratable * only problem seems to be when writing data to _files where in we load all= the file status objects per partition ( for partitioned tables) and per ta= ble otherwise , in memory. this might lead OOM cases :: decision : this is= not a problem as for split computation we will do the same, where we have = not faced this issue. * we create replCopyTask that will create the _files for all tables / parti= tions etc during analysis time and then go to execution engine, this will = lead to lot of objects stored in memory given the above scale targets. *pos= sibly*=20 ** move the dump enclosed in a task itself which manage its own thread pool= s to subsequently analyze/dump tables in execution phase, this will lead to= possible blurring of demarcation of execution vs analysis phase within hiv= e.=20 ** Another mode might be to provide lazy incremental task, from analysis to= execution phase, such that both phases run simultaneously rather than one = completing before another is started, this will lead to significant change = in code to allow the same and currently only seems to be required only for = replication. ** we might have to do the same for _incremental replication dump_ too as t= he _*from*_ and _*to*_ event ids might have millions of events will all of = them being inserts, though the creation of _files is handled differently he= re where in we write the files along with metadata, we should be able to do= the same for bootstrap replication also rather than creating replcopy task= . this would mean the replCopyTask should effectively be only used during = load time. The only problem using this approach is that since the process i= s single threaded we are going to dump data sequentially and it might take = long time, unless we do some threading in ReplicationSemanticAnalyzer to du= mp tables with some parallel since there is no dependency between tables wh= en dumping them, a similar approach might be required for partitions also w= ithin tables.=20 h4.Bootstrap Replication Load * list all the table metadata files per db. For massive databases we will l= oad a per above on the order of a million filestatus objects in memory. Thi= s seems to significant higher order of objects loaded than probably during = split computation and hence might need to look at it. most probably move t= o {code}org.apache.hadoop.fs.RemoteIterator=09listFiles(= Path f, boolean recursive){code} * a task will be created for each type of operation, in case of bootstrap o= ne task per table / partition / function /database, hence we will encounter= the last problem in _*Bootstrap Replication Dump*_=20 h4. Additional thoughts * Since there can be multiple instance of metastores, from an integration w= .r.t beacon for replication, would it be better to have a dedicated metasto= re instance for replication related workload(at least for bootstrap), since= the execution of tasks will take place on the metastore instance it might = be better served for the customer to have one metastore for replication and= others to handle normal workloads. This can be achieved, I think, based on= how the URL's are configured on HS2 client/orchestration engine of replica= tion .=20 * On calling distcp in replcopytask can we log the sourcepath to destpath e= lse if there are problems during copying we wont know the actual paths. * On replica warehouse since replication tasks will run alongside normal ex= ecution of other hive tasks assuming there are multiple db's on replica, ho= w do we constraint resource allocation for replication vs normal task ? how= do we manage this such that we dont lag behind replication significantly ?= =20 was (Author: anishek): h4. Bootstrap Replication Dump * db metadata one at a time * function metadata one at a time * get all tableNames =E2=80=94 which should not be overwhelming =09 * tables is also requested one a time. =E2=80=94 all partition definitions = are loaded in one go for a table and we dont expect a table with more than = 5-10 partition definition columns * the partition object themselves will be done in batches via the Partitio= nIteratable * only problem seems to be when writing data to _files where in we load all= the file status objects per partition ( for partitioned tables) and per ta= ble otherwise , in memory. this might lead OOM cases :: decision : this is= not a problem as for split computation we will do the same, where we have = not faced this issue. * we create replCopyTask that will create the _files for all tables / parti= tions etc during analysis time and then go to execution engine, this will = lead to lot of objects stored in memory given the above scale targets. *pos= sibly*=20 ** move the dump enclosed in a task itself which manage its own thread pool= s to subsequently analyze/dump tables in execution phase, this will lead to= possible blurring of demarcation of execution vs analysis phase within hiv= e.=20 ** Another mode might be to provide lazy incremental task, from analysis to= execution phase, such that both phases run simultaneously rather than one = completing before another is started, this will lead to significant change = in code to allow the same and currently only seems to be required only for = replication. ** we might have to do the same for _incremental replication dump_ too as t= he _*from*_ and _*to*_ event ids might have millions of events will all of = them being inserts, though the creation of _files is handled differently he= re where in we write the files along with metadata, we should be able to do= the same for bootstrap replication also rather than creating replcopy task= . this would mean the replCopyTask should effectively be only used during = load time. The only problem using this approach is that since the process i= s single threaded we are going to dump data sequentially and it might take = long time, unless we do some threading in ReplicationSemanticAnalyzer to du= mp tables with some parallel since there is no dependency between tables wh= en dumping them, a similar approach might be required for partitions also w= ithin tables.=20 h4.Bootstrap Replication Load * list all the table metadata files per db. For massive databases we will l= oad a per above on the order of a million filestatus objects in memory. Thi= s seems to significant higher order of objects loaded than probably during = split computation and hence might need to look at it. most probably move t= o {code}org.apache.hadoop.fs.RemoteIterator=09listFiles(= Path f, boolean recursive){code} * a task will be created for each type of operation, in case of bootstrap o= ne task per table / partition / function /database, hence we will encounter= the last problem in _*Bootstrap Replication Dump*_=20 h4. Additional thoughts * Since there can be multiple instance of metastores, from an integration w= .r.t beacon for replication, would it be better to have a dedicated metasto= re instance for replication related workload(at least for bootstrap), since= the execution of tasks will take place on the metastore instance it might = be better served for the customer to have one metastore for replication and= others to handle normal workloads. This can be achieved, I think, based on= how the URL's are configured on HS2/beacon side.=20 * On calling distcp in replcopytask can we log the sourcepath to destpath e= lse if there are problems during copying we wont know the actual paths. * On replica warehouse since replication tasks will run alongside normal ex= ecution of other hive tasks assuming there are multiple db's on replica, ho= w do we constraint resource allocation for replication vs normal task ? how= do we manage this such that we dont lag behind replication significantly ?= =20 > Handle replication bootstrap of large databases > ----------------------------------------------- > > Key: HIVE-16865 > URL: https://issues.apache.org/jira/browse/HIVE-16865 > Project: Hive > Issue Type: Improvement > Components: HiveServer2 > Affects Versions: 3.0.0 > Reporter: anishek > Assignee: anishek > Fix For: 3.0.0 > > > for larger databases make sure that we can handle replication bootstrap. > * Assuming large database can have close to million tables or a few table= s with few hundred thousand partitions.=20 > * for function replication if a primary warehouse has large number of cu= stom functions defined such that the same binary file in corporates most of= these functions then on the replica warehouse there might be a problem in = loading all these functions as we will have the same jar on primary copied = over for each function such that each function will have a local copy of th= e jar, loading all these jars might lead to excessive memory usage.=20 > =20 -- This message was sent by Atlassian JIRA (v6.4.14#64029)