Skip to content

Commit eb63e1f

Browse files
wombatu-kunVova Kolmakov
and
Vova Kolmakov
authored
[HUDI-7782] Task not serializable due to DynamoDBBasedLockProvider and HiveMetastoreBasedLockProvider in clean action (apache#11389)
Co-authored-by: Vova Kolmakov <[email protected]>
1 parent 9246fd7 commit eb63e1f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

hudi-aws/src/main/java/org/apache/hudi/aws/transaction/lock/DynamoDBBasedLockProvider.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
import javax.annotation.concurrent.NotThreadSafe;
4949

50+
import java.io.Serializable;
5051
import java.net.URI;
5152
import java.util.ArrayList;
5253
import java.util.Collection;
@@ -58,13 +59,13 @@
5859
* using DynamoDB. Users need to have access to AWS DynamoDB to be able to use this lock.
5960
*/
6061
@NotThreadSafe
61-
public class DynamoDBBasedLockProvider implements LockProvider<LockItem> {
62+
public class DynamoDBBasedLockProvider implements LockProvider<LockItem>, Serializable {
6263

6364
private static final Logger LOG = LoggerFactory.getLogger(DynamoDBBasedLockProvider.class);
6465

6566
private static final String DYNAMODB_ATTRIBUTE_NAME = "key";
6667

67-
private final AmazonDynamoDBLockClient client;
68+
private final transient AmazonDynamoDBLockClient client;
6869
private final String tableName;
6970
private final String dynamoDBPartitionKey;
7071
protected final DynamoDbBasedLockConfig dynamoDBLockConfiguration;

hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.slf4j.Logger;
4545
import org.slf4j.LoggerFactory;
4646

47+
import java.io.Serializable;
4748
import java.util.concurrent.ExecutionException;
4849
import java.util.concurrent.Executors;
4950
import java.util.concurrent.ScheduledExecutorService;
@@ -75,18 +76,18 @@
7576
* using hive metastore APIs. Users need to have a HiveMetastore & Zookeeper cluster deployed to be able to use this lock.
7677
*
7778
*/
78-
public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse> {
79+
public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse>, Serializable {
7980

8081
private static final Logger LOG = LoggerFactory.getLogger(HiveMetastoreBasedLockProvider.class);
8182

8283
private final String databaseName;
8384
private final String tableName;
8485
private final String hiveMetastoreUris;
85-
private IMetaStoreClient hiveClient;
86+
private transient IMetaStoreClient hiveClient;
8687
private volatile LockResponse lock = null;
8788
protected LockConfiguration lockConfiguration;
88-
private ScheduledFuture<?> future = null;
89-
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
89+
private transient ScheduledFuture<?> future = null;
90+
private final transient ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
9091

9192
public HiveMetastoreBasedLockProvider(final LockConfiguration lockConfiguration, final StorageConfiguration<?> conf) {
9293
this(lockConfiguration);

0 commit comments

Comments
 (0)