Github user ictmalili commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/885#discussion_r77564199 --- Diff: tools/bin/hawqregister --- @@ -336,8 +338,25 @@ def insert_metadata_into_database(dburl, databasename, tablename, seg_name, firs conn.commit() conn.close() except DatabaseError, ex: - logger.error('Failed to connect to database, this script can only be run when the database is up') - move_files_in_hdfs(database, tablename, files, firstsegno, tabledir, False) + logger.error('Failed to execute query "%s"' % query) + move_files_in_hdfs(databasename, tablename, files, firstsegno, tabledir, False) + sys.exit(1) + +def update_metadata_into_database(dburl, seg_name, files, eofs): + '''Update the catalog table in --force case''' + try: + query = "set allow_system_table_mods='dml';" + query += "begin transaction;" + segno_lst = [f.split('/')[-1] for f in files] + for i, eof in enumerate(eofs): + query += "update pg_aoseg.%s set eof = '%s' where segno = '%s';" % (seg_name, eof, segno_lst[i]) --- End diff -- Why use "update" instead of "delete" and re"insert"?? What if the new files are more than existing files??
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---