Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Fix Stale Influx Entries #2373

Merged
merged 2 commits into from
Nov 13, 2020
Merged

Fix Stale Influx Entries #2373

merged 2 commits into from
Nov 13, 2020

Conversation

johnsonw
Copy link
Contributor

@johnsonw johnsonw commented Nov 10, 2020

There is currently a case in which a stale entries are being left in the
influx db. This takes place when a filesystem is mounted, data is pulled
into influx, and then another filesystem is mounted, and both
filesystems use the same mgs. For example:

time n:
mgs_fs: "fs"

time n+1:
mgs_fs: "fs2"

time n+2:
mgs_fs: "fs,fs2"

Currently, only items matching "fs,fs2" will be removed, since that's
the current input. This results in entries in the target table showing
that the filesystems are: "fs, fs2, fs,fs2".

This patch ensures that all subsets of the input filesystems are deleted
and all but the last of the current subset is deleted.

Signed-off-by: johnsonw wjohnson@whamcloud.com


This change is Reviewable

@johnsonw johnsonw added the bug label Nov 10, 2020
@johnsonw johnsonw requested a review from jgrund November 10, 2020 21:44
@johnsonw johnsonw self-assigned this Nov 10, 2020
There is currently a case in which a stale entries are being left in the
influx db. This takes place when a filesystem is mounted, data is pulled
into influx, and then another filesystem is mounted, and both
filesystems use the same mgs. For example:

time n:
mgs_fs: "fs"

time n+1:
mgs_fs: "fs2"

time n+2:
mgs_fs: "fs,fs2"

Currently, only items matching "fs,fs2" will be removed, since that's
the current input. This results in entries in the target table showing
that the filesystems are: "fs, fs2, fs,fs2".

This patch ensures that all subsets of the input filesystems are deleted
and all but the last of the current subset is deleted.

Signed-off-by: johnsonw <wjohnson@whamcloud.com>
iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
let mgs_fs = record.mgs_fs.to_string();
let mut entry = acc.entry(mgs_fs).or_insert((0, 0));

if record.time > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

In what case will this be <= 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SELECT mgs_fs, mgs_fs_count FROM (SELECT count(is_mgs_fs) AS mgs_fs_count FROM target WHERE is_mgs_fs=true GROUP BY mgs_fs),(SELECT LAST(is_mgs_fs) as last_time FROM target GROUP BY mgs_fs) group by mgs_fs
name: target
tags: mgs_fs=6463788d,fs,fs2
time                mgs_fs          mgs_fs_count
----                ------          ------------
0                   6463788d,fs,fs2 408
1604958244843905323 6463788d,fs,fs2
name: target
tags: mgs_fs=fs
time                mgs_fs mgs_fs_count
----                ------ ------------
0                   fs     105
1604970477758642988 fs
name: target
tags: mgs_fs=fs,fs2
time                mgs_fs mgs_fs_count
----                ------ ------------
0                   fs,fs2 417
1604975047786615296 fs,fs2

iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
iml-services/iml-stats/src/main.rs Outdated Show resolved Hide resolved
Signed-off-by: johnsonw <wjohnson@whamcloud.com>
@johnsonw johnsonw requested a review from jgrund November 11, 2020 15:59
@jgrund jgrund requested review from jgrund and a team November 11, 2020 17:36
@jgrund jgrund requested a review from a team November 11, 2020 22:07
@jgrund jgrund requested a review from a team November 12, 2020 16:03
@jgrund jgrund merged commit ca78cca into master Nov 13, 2020
@jgrund jgrund deleted the fix-fs-in-target-table branch November 13, 2020 19:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants