Package org.apache.iceberg.aws.dynamodb
Class DynamoDbLockManager
java.lang.Object
org.apache.iceberg.util.LockManagers.BaseLockManager
org.apache.iceberg.aws.dynamodb.DynamoDbLockManager
- All Implemented Interfaces:
AutoCloseable
,LockManager
DynamoDB implementation for the lock manager.
-
Constructor Summary
ConstructorDescriptionconstructor for dynamic initialization,initialize(Map)
must be called later.DynamoDbLockManager
(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamo, String lockTableName) constructor used for testing purpose -
Method Summary
Modifier and TypeMethodDescriptionboolean
Try to acquire a lockvoid
close()
void
initialize
(Map<String, String> properties) Initialize lock manager from catalog properties.static List
<software.amazon.awssdk.services.dynamodb.model.AttributeDefinition> The lock table column definition, for users who whould like to create the table separatelystatic List
<software.amazon.awssdk.services.dynamodb.model.KeySchemaElement> The lock table schema, for users who would like to create the table separatelyboolean
Release a lockMethods inherited from class org.apache.iceberg.util.LockManagers.BaseLockManager
acquireIntervalMs, acquireTimeoutMs, heartbeatIntervalMs, heartbeatThreads, heartbeatTimeoutMs, scheduler
-
Constructor Details
-
DynamoDbLockManager
public DynamoDbLockManager()constructor for dynamic initialization,initialize(Map)
must be called later. -
DynamoDbLockManager
public DynamoDbLockManager(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamo, String lockTableName) constructor used for testing purpose- Parameters:
dynamo
- dynamo clientlockTableName
- lock table name
-
-
Method Details
-
initialize
Description copied from interface:LockManager
Initialize lock manager from catalog properties.- Specified by:
initialize
in interfaceLockManager
- Overrides:
initialize
in classLockManagers.BaseLockManager
- Parameters:
properties
- catalog properties
-
acquire
Description copied from interface:LockManager
Try to acquire a lock- Parameters:
entityId
- ID of the entity to lockownerId
- ID of the owner if the lock- Returns:
- if the lock for the entity is acquired by the owner
-
release
Description copied from interface:LockManager
Release a lockexception must not be thrown for this method.
- Parameters:
entityId
- ID of the entity to lockownerId
- ID of the owner if the lock- Returns:
- if the owner held the lock and successfully released it.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classLockManagers.BaseLockManager
- Throws:
Exception
-
lockTableSchema
public static List<software.amazon.awssdk.services.dynamodb.model.KeySchemaElement> lockTableSchema()The lock table schema, for users who would like to create the table separately- Returns:
- lock table schema
-
lockTableColDefinitions
public static List<software.amazon.awssdk.services.dynamodb.model.AttributeDefinition> lockTableColDefinitions()The lock table column definition, for users who whould like to create the table separately- Returns:
- lock table column definition
-