IMPALA-800 / IMPALA-795: Check catalog version before removing entries from the lib cache

There was an issue with the lib cache cleanup code where if a function were dropped
then re-created we might incorrectly remove the new functions's library from the cache.

Consider these statements executed in quick succession:
1) create function fn()
2) drop function fn()
3) create function fn()
4) select fn() ...

Since we perform direct-DDL and immediately apply the result of a DDL operation to the
local impalad catalog, steps 1-4 may complete before a statestore catalog update with the
drop from step 2) is received. When the statestore heartbeat with the drop is received, we
incorrectly removed the new function's lib cache entry while the select statement was
executing, causing the crash.

The fix for this problem is to verify the catalog versions to ensure we only drop items
that have a catalog version <= the catalog version the drop corresponds to.

Change-Id: I7dd1886bf24740cb41f1315ecbb540e38d9ad363
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1552
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins