Class DynamoDbLockManager

java.lang.Object
org.apache.iceberg.util.LockManagers.BaseLockManager
org.apache.iceberg.aws.dynamodb.DynamoDbLockManager
All Implemented Interfaces:
AutoCloseable, LockManager

public class DynamoDbLockManager extends LockManagers.BaseLockManager
DynamoDB implementation for the lock manager.
  • 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 client
      lockTableName - lock table name
  • Method Details

    • initialize

      public void initialize(Map<String,String> properties)
      Description copied from interface: LockManager
      Initialize lock manager from catalog properties.
      Specified by:
      initialize in interface LockManager
      Overrides:
      initialize in class LockManagers.BaseLockManager
      Parameters:
      properties - catalog properties
    • acquire

      public boolean acquire(String entityId, String ownerId)
      Description copied from interface: LockManager
      Try to acquire a lock
      Parameters:
      entityId - ID of the entity to lock
      ownerId - ID of the owner if the lock
      Returns:
      if the lock for the entity is acquired by the owner
    • release

      public boolean release(String entityId, String ownerId)
      Description copied from interface: LockManager
      Release a lock

      exception must not be thrown for this method.

      Parameters:
      entityId - ID of the entity to lock
      ownerId - ID of the owner if the lock
      Returns:
      if the owner held the lock and successfully released it.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class LockManagers.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