Bug 973905 - [broker_50]oo-admin-chk can not recognize broken usage records which miss event field, or the value of event filed is not begin/continue
[broker_50]oo-admin-chk can not recognize broken usage records which miss eve...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-13 01:49 EDT by Xiaoli Tian
Modified: 2015-05-14 20:17 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-24 10:53:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Xiaoli Tian 2013-06-13 01:49:54 EDT
Description of problem:
After modifying the event filed to non begin/continue or remove the even field for any usage type in mongo, and run oo-admin-chk -l 2 to check, it can not recognize the broken field.

After updating these fields are like:
db.usage_records.find({app_name:"sjbosseapapp2"},{event:1, usage_type:2})
{ "_id" : ObjectId("51b938f4c9c6fe945b000039"), "usage_type" : "PREMIUM_CART" }
{ "_id" : ObjectId("51b938f7c9c6fe945b00003d"), "usage_type" : "GEAR_USAGE" }
{ "_id" : ObjectId("51b939fdc9c6fe945b000054"), "event" : "begin", "usage_type" : "GEAR_USAGE" }
{ "_id" : ObjectId("51b93a05c9c6fe945b000056"), "event" : "begin", "usage_type" : "PREMIUM_CART" }

 db.usage_records.find({app_name:"jbosseapapp1"},{event:1, usage_type:2})
{ "_id" : ObjectId("51b93820c9c6fe945b00001b"), "event" : "null", "usage_type" : "PREMIUM_CART" }
{ "_id" : ObjectId("51b93825c9c6fe945b00001f"), "event" : "begin", "usage_type" : "GEAR_USAGE" }


After running oo-admin-chk -l 2 --verbose, the result is as following, but it does not recognize the broken event records:

Checking gears available in applications collection but not in usage_records and viceversa: OK
Checking gears with additional storage in applications collection but not in usage_records and viceversa: FAIL
Re-checking for gear '51b938f3c9c6fe945b000021'...	FAIL
Re-checking for gear '51b939f9c9c6fe945b000045'...	FAIL
Checking gears with premium cartridge in applications collection but not in usage_records and viceversa: OK
Checking un-ended records in usage_records collection but not in usage collection and viceversa: OK
Checking usage_account_id validity for all billing users: OK
Checking plan_id validity for all billing users: OK
Checking plan_state validity for all billing users: OK
Check failed.
Found addtl storage for gear Id '51b938f3c9c6fe945b000021' but could not find corresponding usage record.
Found addtl storage for gear Id '51b939f9c9c6fe945b000045' but could not find corresponding usage record.

Version-Release number of selected component (if applicable):
devenv_3353

How reproducible:
Always

Steps to Reproduce:
1. Update event field to other values than begin/continue or remove the event field:
 db.usage_records.update({app_name:"sjbosseapapp2", usage_type:"GEAR_USAGE"},{$unset:{event:""}})
 db.usage_records.update({app_name: "phpapp1"},{$set:{event:"unkown"}})


2. run oo-admin-chk -l 2 --verbose

Actual results:

It does not recognize the broken event field:

Checking gears available in applications collection but not in usage_records and viceversa: OK
Checking gears with additional storage in applications collection but not in usage_records and viceversa: FAIL
Re-checking for gear '51b938f3c9c6fe945b000021'...	FAIL
Re-checking for gear '51b939f9c9c6fe945b000045'...	FAIL
Checking gears with premium cartridge in applications collection but not in usage_records and viceversa: OK
Checking un-ended records in usage_records collection but not in usage collection and viceversa: OK
Checking usage_account_id validity for all billing users: OK
Checking plan_id validity for all billing users: OK
Checking plan_state validity for all billing users: OK
Check failed.
Found addtl storage for gear Id '51b938f3c9c6fe945b000021' but could not find corresponding usage record.
Found addtl storage for gear Id '51b939f9c9c6fe945b000045' but could not find corresponding usage record.

Expected results:
It should recognize the non begin/continue event filed or there's no event field. 


Additional info:
Comment 1 Ravi Sankar 2013-06-14 01:01:08 EDT
Fixed in devenv_3360.
Comment 2 zhaozhanqi 2013-06-14 01:24:53 EDT
Tested this issue on devenv_3360, it has been fixed.

[root@ip-10-196-79-9 ~]# oo-admin-chk -l 1
Started at: 2013-06-14 01:18:49 -0400
Time to fetch mongo data: 0.027s
Total gears found in mongo: 1
Time to get all gears from nodes: 20.447s
Total gears found on the nodes: 1
Total nodes that responded : 1
Time to get all sshkeys for all gears from nodes: 20.056s
Total gears found on the nodes: 1
Total nodes that responded : 1
Checking un-ended records in usage_records collection but not in usage collection and viceversa: FAIL
Check failed.
Found record in usage_records collection with invalid event 'unkown' for gear Id '51baa68d8dc97ccbd1000003'.
Found application with gear Id '51baa68d8dc97ccbd1000003' but could not find corresponding usage record.
Found 1 un-ended records in usage collection for gear Id '51baa68d8dc97ccbd1000003' but could not find corresponding records in usage_records.
Please refer to the oo-admin-repair tool to resolve some of these inconsistencies.
Total time: 40.685s
Finished at: 2013-06-14 01:19:30 -0400
[root@ip-10-196-79-9 ~]# oo-admin-chk -l 1
Started at: 2013-06-14 01:22:14 -0400
Time to fetch mongo data: 0.025s
Total gears found in mongo: 1
Time to get all gears from nodes: 20.45s
Total gears found on the nodes: 1
Total nodes that responded : 1
Time to get all sshkeys for all gears from nodes: 20.058s
Total gears found on the nodes: 1
Total nodes that responded : 1
Checking un-ended records in usage_records collection but not in usage collection and viceversa: FAIL
Check failed.
Found record in usage_records collection with invalid event '' for gear Id '51baa68d8dc97ccbd1000003'.
Found application with gear Id '51baa68d8dc97ccbd1000003' but could not find corresponding usage record.
Found 1 un-ended records in usage collection for gear Id '51baa68d8dc97ccbd1000003' but could not find corresponding records in usage_records.
Please refer to the oo-admin-repair tool to resolve some of these inconsistencies.
Total time: 40.619s
Finished at: 2013-06-14 01:22:55 -0400

Note You need to log in before you can comment on or make changes to this bug.