Comment 14 for bug 1451619

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/14697
Committed: http://github.org/Juniper/contrail-controller/commit/377827c56dc70d15f862079585a01ca10c3b1164
Submitter: Zuul
Branch: R2.20

commit 377827c56dc70d15f862079585a01ca10c3b1164
Author: Chandan Mishra <email address hidden>
Date: Tue May 26 14:12:48 2015 -0700

This commit does two things:
a) Modifies database purge uve to include error/warning strings related to the
last purge operation.

b) Make sure all analytics start time are same when the system first gets started.

Closes-Bug: 1451619
Change-Id: I68a78f6c8e120fafd771bfb84e89b06b49f3bbfd
(cherry picked from commit 2015613e0543fc023e9f58c486d594baa316d0cd)

Fix database purge code in analytics-api

This patch fixes the following issues in db_purge() method.

1) The key type for MESSAGE_TABLE_TIMESTAMP is different from the
other message index tables.

pycassaShell output:

>>> MESSAGETABLETIMESTAMP.key_validation_class
'IntegerType'

>>> MESSAGETABLESOURCE.key_validation_class
'CompositeType(IntegerType, UTF8Type)'

>>> MESSAGETABLEMESSAGETYPE.key_validation_class
'CompositeType(IntegerType, UTF8Type)'

The purge function always expects composite key and tries to extract
the first element (timestamp) from the key.
But for MESSAGE_TABLE_TIMESTAMP, the key is of type integer
and hence it raises exception. Side-effect of this exception:
data from the table MESSAGE_TABLE_TIMESTAMP not purged.

2) object identity check fails for table.
=> if (table is MESSAGE_TABLE_SOURCE):
The above check always fails due to object id mismatch.
Therefore, data is not purged from the MessageTable.
Replaced object identity check with equality check.

Change-Id: I51d619ac5275acf737094b7cdf36bb3d462fcf81
Closes-Bug: #1487966
(cherry picked from commit 95077da002c6a7d4d6908cf5fc92d68d97baa0b7)