Search in sources :

Example 1 with LockConfiguration

use of org.apache.hudi.common.config.LockConfiguration in project hudi by apache.

the class TestHiveMetastoreBasedLockProvider method init.

@BeforeEach
public void init() throws Exception {
    TypedProperties properties = new TypedProperties();
    properties.setProperty(HIVE_DATABASE_NAME_PROP_KEY, TEST_DB_NAME);
    properties.setProperty(HIVE_TABLE_NAME_PROP_KEY, TEST_TABLE_NAME);
    properties.setProperty(LOCK_ACQUIRE_NUM_RETRIES_PROP_KEY, DEFAULT_LOCK_ACQUIRE_NUM_RETRIES);
    properties.setProperty(LOCK_ACQUIRE_RETRY_WAIT_TIME_IN_MILLIS_PROP_KEY, DEFAULT_LOCK_ACQUIRE_RETRY_WAIT_TIME_IN_MILLIS);
    properties.setProperty(ZK_CONNECT_URL_PROP_KEY, zkService().connectString());
    properties.setProperty(ZK_PORT_PROP_KEY, hiveConf().get("hive.zookeeper.client.port"));
    properties.setProperty(ZK_SESSION_TIMEOUT_MS_PROP_KEY, hiveConf().get("hive.zookeeper.session.timeout"));
    properties.setProperty(ZK_CONNECTION_TIMEOUT_MS_PROP_KEY, String.valueOf(DEFAULT_ZK_CONNECTION_TIMEOUT_MS));
    properties.setProperty(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY, String.valueOf(1000));
    lockConfiguration = new LockConfiguration(properties);
    lockComponent.setTablename(TEST_TABLE_NAME);
}
Also used : LockConfiguration(org.apache.hudi.common.config.LockConfiguration) TypedProperties(org.apache.hudi.common.config.TypedProperties) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with LockConfiguration

use of org.apache.hudi.common.config.LockConfiguration in project hudi by apache.

the class ITTestDynamoDBBasedLockProvider method setup.

@BeforeAll
public static void setup() throws InterruptedException {
    Properties properties = new Properties();
    properties.setProperty(DynamoDbBasedLockConfig.DYNAMODB_LOCK_BILLING_MODE.key(), BillingMode.PAY_PER_REQUEST.name());
    // properties.setProperty(AWSLockConfig.DYNAMODB_LOCK_TABLE_NAME.key(), TABLE_NAME_PREFIX);
    properties.setProperty(DynamoDbBasedLockConfig.DYNAMODB_LOCK_PARTITION_KEY.key(), "testKey");
    properties.setProperty(DynamoDbBasedLockConfig.DYNAMODB_LOCK_REGION.key(), REGION);
    properties.setProperty(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY, "1000");
    properties.setProperty(DynamoDbBasedLockConfig.DYNAMODB_LOCK_READ_CAPACITY.key(), "0");
    properties.setProperty(DynamoDbBasedLockConfig.DYNAMODB_LOCK_WRITE_CAPACITY.key(), "0");
    lockConfiguration = new LockConfiguration(properties);
    dynamoDb = getDynamoClientWithLocalEndpoint();
}
Also used : LockConfiguration(org.apache.hudi.common.config.LockConfiguration) Properties(java.util.Properties) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with LockConfiguration

use of org.apache.hudi.common.config.LockConfiguration in project hudi by apache.

the class TestZookeeperBasedLockProvider method setup.

@BeforeAll
public static void setup() {
    while (server == null) {
        try {
            server = new TestingServer();
            CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
            client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1000)).build();
        } catch (Exception e) {
            LOG.error("Getting bind exception - retrying to allocate server");
            server = null;
        }
    }
    Properties properties = new Properties();
    properties.setProperty(ZK_BASE_PATH_PROP_KEY, basePath);
    properties.setProperty(ZK_LOCK_KEY_PROP_KEY, key);
    properties.setProperty(ZK_CONNECT_URL_PROP_KEY, server.getConnectString());
    properties.setProperty(ZK_BASE_PATH_PROP_KEY, server.getTempDirectory().getAbsolutePath());
    properties.setProperty(ZK_SESSION_TIMEOUT_MS_PROP_KEY, "10000");
    properties.setProperty(ZK_CONNECTION_TIMEOUT_MS_PROP_KEY, "10000");
    properties.setProperty(ZK_LOCK_KEY_PROP_KEY, "key");
    properties.setProperty(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY, "1000");
    lockConfiguration = new LockConfiguration(properties);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) RetryOneTime(org.apache.curator.retry.RetryOneTime) CuratorFrameworkFactory(org.apache.curator.framework.CuratorFrameworkFactory) LockConfiguration(org.apache.hudi.common.config.LockConfiguration) Properties(java.util.Properties) HoodieLockException(org.apache.hudi.exception.HoodieLockException) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

LockConfiguration (org.apache.hudi.common.config.LockConfiguration)3 Properties (java.util.Properties)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)1 RetryOneTime (org.apache.curator.retry.RetryOneTime)1 TestingServer (org.apache.curator.test.TestingServer)1 TypedProperties (org.apache.hudi.common.config.TypedProperties)1 HoodieLockException (org.apache.hudi.exception.HoodieLockException)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1