Skip to content

SQL: queries: fix sql queries to handle negative job duration value#1198

Merged
joergsteffens merged 3 commits intobareos:masterfrom
HediBenFraj:dev/HediBenFraj/master/avoid-negative-duration-values
Jul 7, 2022
Merged

SQL: queries: fix sql queries to handle negative job duration value#1198
joergsteffens merged 3 commits intobareos:masterfrom
HediBenFraj:dev/HediBenFraj/master/avoid-negative-duration-values

Conversation

@HediBenFraj
Copy link
Contributor

@HediBenFraj HediBenFraj commented Jun 29, 2022

Description

This PR aims to solve the negative duration value shown for rescheduled jobs, the fix will always shown a duration to 0.

The job duration is calculated between the start end the end time. When jobs are rescheduled, the start time is set to the future which makes the duration negative.

image

*list jobs
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+
| jobid | name             | client    | starttime           | duration  | type | level | jobfiles | jobbytes | jobstatus |
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+
|     1 | backup-bareos-fd | bareos-fd | 2022-06-27 17:16:57 | 00:00:01  | B    | F     |        0 |        0 | t         |
|     6 | backup-bareos-fd | bareos-fd | 2022-06-28 10:55:53 | 00:00:00  | B    | F     |        0 |        0 | t         |
|     3 | backup-bareos-fd | bareos-fd | 2022-06-28 10:55:58 | -00:00:11 | B    | F     |        0 |        0 | R         |
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+

After the fix

*list jobs
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+
| jobid | name             | client    | starttime           | duration  | type | level | jobfiles | jobbytes | jobstatus |
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+
|     1 | backup-bareos-fd | bareos-fd | 2022-06-27 17:16:57 | 00:00:01  | B    | F     |        0 |        0 | t         |
|     6 | backup-bareos-fd | bareos-fd | 2022-06-28 10:55:53 | 00:00:00  | B    | F     |        0 |        0 | t         |
|     3 | backup-bareos-fd | bareos-fd | 2022-06-28 10:55:58 | 00:00:00  | B    | F     |        0 |        0 | R         |
+-------+------------------+-----------+---------------------+-----------+------+-------+----------+----------+-----------+

Reference internal task 5118.

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

General
  • PR name is meaningful
  • Purpose of the PR is understood
  • Separate commit for this PR in the CHANGELOG.md, PR number referenced is same
  • Commit descriptions are understandable and well formatted
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
  • bareos-check-sources --since-merge does not report any problems
  • git status should not report modifications in the source tree after building and testing

@HediBenFraj HediBenFraj changed the title Dev/hedi ben fraj/master/avoid negative duration values SQL: queries : fixed sql queries to handle negative job duration value Jun 29, 2022
@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/avoid-negative-duration-values branch from 01f3e37 to 70c0079 Compare June 29, 2022 13:57
@bruno-at-bareos bruno-at-bareos changed the title SQL: queries : fixed sql queries to handle negative job duration value SQL: queries: fix sql queries to handle negative job duration value Jul 4, 2022
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start.
Please check and apply changes requested.

@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/avoid-negative-duration-values branch from 70c0079 to bb43fba Compare July 4, 2022 11:53
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still one fix to commit into CHANGELOG.

Keep empty line before title
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ready to be merged.

@joergsteffens joergsteffens merged commit 8888eb1 into bareos:master Jul 7, 2022
bruno-at-bareos added a commit to bruno-at-bareos/bareos that referenced this pull request Jul 7, 2022
- Fix adding # in front of PR bareos#1198 and PR bareos#1188

Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
bruno-at-bareos added a commit to bruno-at-bareos/bareos that referenced this pull request Jul 7, 2022
- Fix adding # in front of PR bareos#1198 and PR bareos#1188

Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
bruno-at-bareos added a commit to bruno-at-bareos/bareos that referenced this pull request Jul 11, 2022
- Fix adding # in front of PR bareos#1198 and PR bareos#1188

Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants