Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extensions and Rate limiting options #314

Merged
merged 28 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d9c6d9c
Added extensions and Rate limiting options
patduin Apr 12, 2024
7e5138f
New feature release version
patduin Apr 12, 2024
20fce13
typo
patduin Apr 12, 2024
87122cd
typo
patduin Apr 12, 2024
e3aedf6
Update waggle-dance-extensions/README.md
Apr 12, 2024
f486588
typo
patduin Apr 12, 2024
9d0cd46
Update waggle-dance-extensions/README.md
Apr 12, 2024
35422f7
Update waggle-dance-extensions/README.md
Apr 12, 2024
729ce5d
Update README.md
Apr 12, 2024
56a4117
Update README.md
Apr 12, 2024
afb47be
Update waggle-dance-extensions/src/main/java/com/hotels/bdp/waggledan…
Apr 12, 2024
2bf08a7
Update waggle-dance-extensions/src/main/java/com/hotels/bdp/waggledan…
Apr 12, 2024
e9d0886
Update waggle-dance-extensions/src/main/java/com/hotels/bdp/waggledan…
Apr 12, 2024
45470a1
Update waggle-dance-extensions/src/main/java/com/hotels/bdp/waggledan…
Apr 12, 2024
91fa874
Update waggle-dance-integration-tests/src/test/java/com/hotels/bdp/wa…
Apr 12, 2024
070ce28
renamed and aded test
patduin Apr 12, 2024
fec5715
Adding optional prefix
patduin Apr 16, 2024
2f3e301
Adding format fix
patduin Apr 16, 2024
9648fa2
refactoring/cleanup
patduin Apr 16, 2024
d92cec7
Added rate limit metrics
patduin Apr 17, 2024
533bd23
renamed
patduin Apr 17, 2024
b2a8502
changed metrics a bit
patduin Apr 17, 2024
1f3f6bd
format
patduin Apr 17, 2024
8fa3cde
check new ubununtu for openssl dependency:
patduin Apr 18, 2024
0d9d7fb
new ubuntu
patduin Apr 18, 2024
98744c3
trying to fix flaky test
patduin Apr 18, 2024
c8d7e5e
ignore graphite test as it fails often
patduin Apr 18, 2024
0121c58
Update CHANGELOG.md
Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@

## [3.12.0] - 2023-02-08
## [3.13.0] - TBD
### Added
- Added `waggle-dance-extensions` module. See [extensions README](waggle-dance-extensions/README.md.)
- Added support to enable Rate Limiting in Waggle Dance.
### Changed
- Changed and added some log messages for better tracking of calls.
- Changed Integration Test WaggleDanceRunner to allow for reuse.

## [3.12.0] - 2024-02-08
### Added
- Added optional `primary-meta-store.read-only-remote-meta-store-uris` config to allow traffic to be diverted based on calls made. See README.md.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ The table below describes all the available configuration values for Waggle Danc
| `configuration-properties` | No | Map of Hive properties that will be added to the HiveConf used when creating the Thrift clients (they will be shared among all the clients). |
| `queryFunctionsAcrossAllMetastores` | No | Controls if the Thrift `getAllFunctions` should be fired to all configured metastores or only the primary metastore. The advice is to set this to false. Executing `getAllFunctions` can have an unwanted performance impact when a metastore is slow to respond. The function call is typically only called when a client is initialized and is largely irrelevant. Default is `true` (to be backward compatible) |

Extensions (for instance Rate Limiting) are described here: [waggle-dance-extensions/README.md](waggle-dance-extensions/README.md)

### Federation

Federation config is by default located in: `$WAGGLE_DANCE_HOME/conf/waggle-dance-federation.yml`.
Expand Down Expand Up @@ -611,4 +613,4 @@ The Waggle Dance logo uses the [Beetype Filled font](http://www.1001fonts.com/be
## Legal
This project is available under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html).

Copyright 2016-2019 Expedia, Inc.
Copyright 2016-2024 Expedia, Inc.
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>com.hotels</groupId>
<artifactId>waggle-dance-parent</artifactId>
<version>3.12.1-SNAPSHOT</version>
<version>3.13.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Waggle Dance Parent</name>
<description>Hive Metastore federation service.</description>
Expand All @@ -24,6 +24,7 @@
</scm>

<modules>
<module>waggle-dance-extensions</module>
<module>waggle-dance-core</module>
<module>waggle-dance-api</module>
<module>waggle-dance-rest</module>
Expand Down Expand Up @@ -275,6 +276,11 @@
<artifactId>jackson-dataformat-cbor</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion waggle-dance-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.hotels</groupId>
<artifactId>waggle-dance-parent</artifactId>
<version>3.12.1-SNAPSHOT</version>
<version>3.13.0-SNAPSHOT</version>
</parent>

<artifactId>waggle-dance-api</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion waggle-dance-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.hotels</groupId>
<artifactId>waggle-dance-parent</artifactId>
<version>3.12.1-SNAPSHOT</version>
<version>3.13.0-SNAPSHOT</version>
</parent>

<artifactId>waggle-dance-boot</artifactId>
Expand All @@ -25,6 +25,11 @@
<artifactId>waggle-dance-rest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.hotels</groupId>
<artifactId>waggle-dance-extensions</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
18 changes: 17 additions & 1 deletion waggle-dance-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.hotels</groupId>
<artifactId>waggle-dance-parent</artifactId>
<version>3.12.1-SNAPSHOT</version>
<version>3.13.0-SNAPSHOT</version>
</parent>

<artifactId>waggle-dance-core</artifactId>
Expand Down Expand Up @@ -158,6 +158,8 @@
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>${hive.version}</version>
<classifier>core</classifier>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
Expand All @@ -167,6 +169,10 @@
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-algorithm</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -194,6 +200,10 @@
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -346,6 +356,12 @@
<groupId>com.hotels</groupId>
<artifactId>beeju</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fm.last.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2023 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2019 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.hotels.hcommon.hive.metastore.conf.HiveConfFactory;
import com.hotels.hcommon.hive.metastore.util.MetaStoreUriNormaliser;

public class CloseableThriftHiveMetastoreIfaceClientFactory {
public class CloseableThriftHiveMetastoreIfaceClientFactory implements ThriftClientFactory {

private static final int DEFAULT_CLIENT_FACTORY_RECONNECTION_RETRY = 3;
private final TunnelingMetaStoreClientFactory tunnelingMetaStoreClientFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2023 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,11 @@
package com.hotels.bdp.waggledance.client;

import java.io.IOException;
import java.lang.reflect.*;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.List;

import org.apache.hadoop.hive.conf.HiveConf;
Expand Down Expand Up @@ -158,7 +162,6 @@ private SaslMetastoreClientHander(
this.clientManager = clientManager;
}

@SuppressWarnings("unchecked")
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hotels.bdp.waggledance.client;

import com.hotels.bdp.waggledance.api.model.AbstractMetaStore;

public interface ThriftClientFactory {

/**
* @param metaStore (configuration object)
* @return client that will be used to query the metaStore.
*/
public CloseableThriftHiveMetastoreIface newInstance(AbstractMetaStore metaStore);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2023 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -121,7 +121,7 @@ void open(HiveUgiArgs ugiArgs) {

for (int attempt = 0; !isConnected && (attempt < retries); ++attempt) {
for (URI store : metastoreUris) {
LOG.info("Trying to connect to metastore with URI " + store);
LOG.debug("Trying to connect to metastore with URI " + store);
try {
transport = new TSocket(store.getHost(), store.getPort(), clientSocketTimeout, connectionTimeout);
if (useSasl) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2019 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2021 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2023 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -145,5 +145,4 @@ public boolean isQueryFunctionsAcrossAllMetastores() {
public void setQueryFunctionsAcrossAllMetastores(boolean queryFunctionsAcrossAllMetastores) {
this.queryFunctionsAcrossAllMetastores = queryFunctionsAcrossAllMetastores;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

import com.hotels.bdp.waggledance.client.CloseableThriftHiveMetastoreIfaceClientFactory;
import com.hotels.bdp.waggledance.client.DefaultMetaStoreClientFactory;
import com.hotels.bdp.waggledance.client.GlueClientFactory;
import com.hotels.bdp.waggledance.client.SplitTrafficMetastoreClientFactory;
import com.hotels.bdp.waggledance.client.ThriftClientFactory;
import com.hotels.bdp.waggledance.client.tunnelling.TunnelingMetaStoreClientFactory;
import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration;
import com.hotels.bdp.waggledance.mapping.model.ASTQueryMapping;
Expand Down Expand Up @@ -59,13 +61,21 @@ public SplitTrafficMetastoreClientFactory splitTrafficMetaStoreClientFactory() {
return new SplitTrafficMetastoreClientFactory();
}


@Bean
public CloseableThriftHiveMetastoreIfaceClientFactory metaStoreClientFactory(
public ThriftClientFactory defaultWaggleDanceClientFactory(
WaggleDanceConfiguration waggleDanceConfiguration, SplitTrafficMetastoreClientFactory splitTrafficMetaStoreClientFactory) {
return new CloseableThriftHiveMetastoreIfaceClientFactory(new TunnelingMetaStoreClientFactory(),
new DefaultMetaStoreClientFactory(), new GlueClientFactory(), waggleDanceConfiguration, splitTrafficMetaStoreClientFactory);
}

//Only load when no other beans with this name can be found.
@ConditionalOnMissingBean
@Bean
public ThriftClientFactory thriftClientFactory(ThriftClientFactory defaultWaggleDanceClientFactory) {
return defaultWaggleDanceClientFactory;
}

@Bean
public QueryMapping queryMapping() {
return ASTQueryMapping.INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2022 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@
import com.hotels.bdp.waggledance.api.model.AbstractMetaStore;
import com.hotels.bdp.waggledance.api.model.DatabaseResolution;
import com.hotels.bdp.waggledance.client.CloseableThriftHiveMetastoreIface;
import com.hotels.bdp.waggledance.client.CloseableThriftHiveMetastoreIfaceClientFactory;
import com.hotels.bdp.waggledance.client.ThriftClientFactory;
import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration;
import com.hotels.bdp.waggledance.mapping.service.MetaStoreMappingFactory;
import com.hotels.bdp.waggledance.mapping.service.PrefixNamingStrategy;
Expand All @@ -46,24 +46,24 @@ public class MetaStoreMappingFactoryImpl implements MetaStoreMappingFactory {

private final WaggleDanceConfiguration waggleDanceConfiguration;
private final PrefixNamingStrategy prefixNamingStrategy;
private final CloseableThriftHiveMetastoreIfaceClientFactory metaStoreClientFactory;
private final ThriftClientFactory thriftClientFactory;
private final AccessControlHandlerFactory accessControlHandlerFactory;

@Autowired
public MetaStoreMappingFactoryImpl(
WaggleDanceConfiguration waggleDanceConfiguration,
PrefixNamingStrategy prefixNamingStrategy,
CloseableThriftHiveMetastoreIfaceClientFactory metaStoreClientFactory,
ThriftClientFactory thriftClientFactory,
AccessControlHandlerFactory accessControlHandlerFactory) {
this.waggleDanceConfiguration = waggleDanceConfiguration;
this.prefixNamingStrategy = prefixNamingStrategy;
this.metaStoreClientFactory = metaStoreClientFactory;
this.thriftClientFactory = thriftClientFactory;
this.accessControlHandlerFactory = accessControlHandlerFactory;
}

private CloseableThriftHiveMetastoreIface createClient(AbstractMetaStore metaStore) {
try {
return metaStoreClientFactory.newInstance(metaStore);
return thriftClientFactory.newInstance(metaStore);
} catch (Exception e) {
LOG.error("Can't create a client for metastore '{}':", metaStore.getName(), e);
return newUnreachableMetastoreClient(metaStore);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2023 Expedia, Inc.
* Copyright (C) 2016-2024 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,7 +99,7 @@ private void add(AbstractMetaStore metaStore) {
primaryDatabaseMapping = databaseMapping;
if (!metaStoreMapping.isAvailable()) {
throw new WaggleDanceException(
String.format("Primary metastore is unavailable {}", metaStore.getRemoteMetaStoreUris())
String.format("Primary metastore is unavailable %s", metaStore.getRemoteMetaStoreUris())
);
}
}
Expand Down
Loading
Loading