HAWQ-1061. Bugfix for specific eof is zeor and check greater than zeor(thanks @wcl14).
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/06412f3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/06412f3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/06412f3e Branch: refs/heads/master Commit: 06412f3eb8e6c2cb4a6a8411e0126b70e90014ca Parents: 5a152dc Author: xunzhang <xunzhang...@gmail.com> Authored: Thu Sep 22 23:31:21 2016 +0800 Committer: Lili Ma <ictmal...@gmail.com> Committed: Fri Sep 23 10:36:39 2016 +0800 ---------------------------------------------------------------------- tools/bin/hawqregister | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/06412f3e/tools/bin/hawqregister ---------------------------------------------------------------------- diff --git a/tools/bin/hawqregister b/tools/bin/hawqregister index 2e945a6..65a5e44 100755 --- a/tools/bin/hawqregister +++ b/tools/bin/hawqregister @@ -51,7 +51,7 @@ def option_parser(): parser.add_option('-U', '--user', help='username of the target DB') parser.add_option('-d', '--database', default='postgres', dest='database', help='database name') parser.add_option('-f', '--filepath', dest='filepath', help='file name in HDFS') - parser.add_option('-e', '--eof', dest='filesize', type='int', default=0, help='eof of the file to be registered') + parser.add_option('-e', '--eof', dest='filesize', type='int', default=None, help='eof of the file to be registered') parser.add_option('-c', '--config', dest='yml_config', default='', help='configuration file in YAML format') parser.add_option('-F', '--force', dest='force', action='store_true', default=False) parser.add_option('-R', '--repair', dest='repair', action='store_true', default=False) @@ -469,6 +469,10 @@ class HawqRegister(object): sys.exit(1) def check_sizes_valid(): + for sz in self.sizes: + if sz < 0: + logger.error('File size(%s) in yaml configuration file should not be less than 0.' % sz) + sys.exit(1) for k, fn in enumerate(self.files): hdfscmd = 'hdfs dfs -du %s' % fn _, out, _ = local_ssh_output(hdfscmd) @@ -563,7 +567,7 @@ class HawqRegister(object): if self.files_update: print 'Catalog info need to be updated for these files: ', self.files_update - if self.filesize: + if self.filesize is not None: if len(self.files) != 1: logger.error('-e option is only supported with single file case.') sys.exit(1)