Merge pull request #5978 from ryanpetrello/firehose-start-end-fix

fix start/end line incrementing behavior

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-02-19 18:54:41 +00:00 committed by GitHub
commit d271a8c9fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,14 +209,17 @@ def generate_events(events, job):
print('generating unique start/end line counts')
cursor.execute('CREATE SEQUENCE IF NOT EXISTS firehose_seq;')
cursor.execute('CREATE SEQUENCE IF NOT EXISTS firehose_line_seq;')
cursor.execute('CREATE SEQUENCE IF NOT EXISTS firehose_line_seq MINVALUE 0;')
cursor.execute('ALTER SEQUENCE firehose_seq RESTART WITH 1;')
cursor.execute('ALTER SEQUENCE firehose_line_seq RESTART WITH 0;')
cursor.execute("SELECT nextval('firehose_line_seq')")
conn.commit()
cursor.execute(
"UPDATE main_jobevent SET "
"counter=nextval('firehose_seq')::integer,"
"start_line=nextval('firehose_seq')::integer,"
"end_line=currval('firehose_seq')::integer + 2"
"start_line=nextval('firehose_line_seq')::integer,"
"end_line=currval('firehose_line_seq')::integer + 2"
)
conn.commit()
finally: