This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new eba512abfac [branch-2.0](tablet invert) fix tablet invert index thread
trace (#29580)
eba512abfac is described below
commit eba512abfacfe6d78ff251fc06fa6ece673e5a79
Author: yujun <[email protected]>
AuthorDate: Tue Jan 9 19:33:16 2024 +0800
[branch-2.0](tablet invert) fix tablet invert index thread trace (#29580)
* fix tablet invert index thread trace
* fix fe ut
---
.../apache/doris/catalog/TabletInvertedIndex.java | 28 ++++++++++++++++++----
.../doris/clone/TabletRepairAndBalanceTest.java | 4 ++--
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
index 2d51c2a89a5..8187bba3fa2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
@@ -809,22 +809,42 @@ public class TabletInvertedIndex {
// just for ut
public Table<Long, Long, Replica> getReplicaMetaTable() {
- return replicaMetaTable;
+ long stamp = readLock();
+ try {
+ return HashBasedTable.create(replicaMetaTable);
+ } finally {
+ readUnlock(stamp);
+ }
}
// just for ut
public Table<Long, Long, Replica> getBackingReplicaMetaTable() {
- return backingReplicaMetaTable;
+ long stamp = readLock();
+ try {
+ return HashBasedTable.create(backingReplicaMetaTable);
+ } finally {
+ readUnlock(stamp);
+ }
}
// just for ut
public Table<Long, Long, TabletMeta> getTabletMetaTable() {
- return tabletMetaTable;
+ long stamp = readLock();
+ try {
+ return HashBasedTable.create(tabletMetaTable);
+ } finally {
+ readUnlock(stamp);
+ }
}
// just for ut
public Map<Long, TabletMeta> getTabletMetaMap() {
- return tabletMetaMap;
+ long stamp = readLock();
+ try {
+ return new HashMap(tabletMetaMap);
+ } finally {
+ readUnlock(stamp);
+ }
}
private boolean isLocal(TStorageMedium storageMedium) {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
b/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
index da38a5f30a7..2f04034f763 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
@@ -321,7 +321,7 @@ public class TabletRepairAndBalanceTest {
Assert.assertEquals(tag2, be.getLocationTag());
ExceptionChecker.expectThrows(UserException.class, () ->
tbl.checkReplicaAllocation());
checkTableReplicaAllocation(tbl);
- Assert.assertEquals(90, replicaMetaTable.cellSet().size());
+ Assert.assertEquals(90,
invertedIndex.getReplicaMetaTable().cellSet().size());
// For now, Backends:
// [0, 1]: zone1
@@ -417,7 +417,7 @@ public class TabletRepairAndBalanceTest {
ExceptionChecker.expectThrowsNoException(() -> dropTable(dropStmt1));
ExceptionChecker.expectThrowsNoException(() -> dropTable(dropStmt2));
ExceptionChecker.expectThrowsNoException(() -> dropTable(dropStmt3));
- Assert.assertEquals(0, replicaMetaTable.size());
+ Assert.assertEquals(0, invertedIndex.getReplicaMetaTable().size());
// set all backends' tag to default
for (int i = 0; i < backends.size(); ++i) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]