Fix planning issue when using DISTICT aggregations in HAVING clause

Planning fails with a "Multiple entries with same key" error
Add test for HAVING with DISTINCT aggregations
Fix division by zero in some aggregations

Fix both VarianceAggregation and ApproximateAverageAggregation
Remove potential deadlock with broken connectors

Replace synchronized lock with a custom lock with timeout support

For close and updateSource stage change and then attempt to acquire
lock.  If lock is acquired, process change; otherwise lock holder
will process change before releasing lock.

For close, if lock can not be acquired, interrupt lock holder.
Remove obsolete test logging configuration
Fix logging for S3 tests
Support write and retry in PrestoS3FileSystem
Add tests for S3 table creation