Call Function::eraseFromParent() when codegen fails

Aborting codegen mid-function without erasing the function can result
in a corrupt module.

Change-Id: I64b518c8286195d78e68c2df5397a8843f6badc3
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4632
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
IMPALA-1210: Log Java version at impalad/catalogd startup

Change-Id: I4ab39231996522decce043482fcdd860fd02ada3
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4611
Reviewed-by: Juan Yu <jyu@cloudera.com>
Tested-by: jenkins
IMPALA-1087: Fix error handling loading libraries in LibCache

If an error occurred loading a library in LibCache (e.g. by using
CREATE FUNCTION) an error is returned but a cache entry may still
exist which may result in strange errors later when the cache
entry is accessed by subsequent queries.

This changes LibCache::GetCacheEntry to ensure cache entries do
not exist if errors occur. Because GetCacheEntry needs to take
the global lock and then the cache entry lock, but needs to
unlock the global lock before performing slow HDFS operations,
we set the error status on the cache entry so that all locks
can be released when an error occurs. Other threads that attempt
to access the cache entry check the status and return if it is
not OK. The first thread (the thread that got the error) can
then remove the cache entry whenever it is able to again acquire
the global lock_.

Change-Id: I00fd0e2a4611b06fa72ffe0aaaa7d077b7a0c36e
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4642
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins