forked from oceanbase/obkv-table-client-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request oceanbase#204 from oceanbase/retry_batchops_merge_…
…master Enhance Client Support for Partition Splitting
- Loading branch information
Showing
19 changed files
with
1,297 additions
and
370 deletions.
There are no files selected for viewing
270 changes: 189 additions & 81 deletions
270
src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
399 changes: 283 additions & 116 deletions
399
src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObPartitionLocationInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*- | ||
* #%L | ||
* com.oceanbase:obkv-table-client | ||
* %% | ||
* Copyright (C) 2021 - 2024 OceanBase | ||
* %% | ||
* OBKV Table Client Framework is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
* #L% | ||
*/ | ||
|
||
package com.alipay.oceanbase.rpc.location.model.partition; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.concurrent.locks.ReentrantReadWriteLock; | ||
|
||
import static com.alipay.oceanbase.rpc.protocol.payload.Constants.OB_INVALID_ID; | ||
|
||
public class ObPartitionLocationInfo { | ||
private ObPartitionLocation partitionLocation = null; | ||
private Long tabletLsId = OB_INVALID_ID; | ||
private Long lastUpdateTime = 0L; | ||
public ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); | ||
public AtomicBoolean initialized = new AtomicBoolean(false); | ||
public final CountDownLatch initializationLatch = new CountDownLatch(1); | ||
|
||
public ObPartitionLocation getPartitionLocation() { | ||
rwLock.readLock().lock(); | ||
try { | ||
return partitionLocation; | ||
} finally { | ||
rwLock.readLock().unlock(); | ||
} | ||
} | ||
|
||
public void updateLocation(ObPartitionLocation newLocation) { | ||
this.partitionLocation = newLocation; | ||
this.lastUpdateTime = System.currentTimeMillis(); | ||
} | ||
|
||
public Long getTabletLsId() { | ||
return tabletLsId; | ||
} | ||
|
||
public void setTabletLsId(Long tabletLsId) { | ||
this.tabletLsId = tabletLsId; | ||
} | ||
|
||
public Long getLastUpdateTime() { | ||
rwLock.readLock().lock(); | ||
try { | ||
return lastUpdateTime; | ||
} finally { | ||
rwLock.readLock().unlock(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.