Skip to content

Commit af579af

Browse files
committed
update pom.xml
1 parent e5e8687 commit af579af

31 files changed

+621
-368
lines changed

pom.xml

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,24 @@
5454
<dependencyManagement>
5555
<dependencies>
5656
<dependency>
57-
<groupId>org.testcontainers</groupId>
58-
<artifactId>testcontainers-bom</artifactId>
59-
<version>1.15.3</version>
60-
<type>pom</type>
61-
<scope>import</scope>
57+
<groupId>com.alipay.sofa.common</groupId>
58+
<artifactId>sofa-common-tools</artifactId>
59+
<version>1.3.12</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>slf4j-api</artifactId>
64+
<version>1.7.36</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>com.google.guava</groupId>
68+
<artifactId>guava</artifactId>
69+
<version>31.1-jre</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>junit</groupId>
73+
<artifactId>junit</artifactId>
74+
<version>4.13.2</version>
6275
</dependency>
6376
</dependencies>
6477
</dependencyManagement>
@@ -67,7 +80,6 @@
6780
<dependency>
6881
<groupId>com.alipay.sofa.common</groupId>
6982
<artifactId>sofa-common-tools</artifactId>
70-
<version>1.3.12</version>
7183
</dependency>
7284

7385
<dependency>
@@ -91,7 +103,6 @@
91103
<dependency>
92104
<groupId>com.google.guava</groupId>
93105
<artifactId>guava</artifactId>
94-
<version>31.1-jre</version>
95106
</dependency>
96107

97108
<dependency>
@@ -129,13 +140,18 @@
129140
<dependency>
130141
<groupId>org.slf4j</groupId>
131142
<artifactId>slf4j-api</artifactId>
132-
<version>1.7.36</version>
133143
</dependency>
134144

135145
<dependency>
136146
<groupId>junit</groupId>
137147
<artifactId>junit</artifactId>
138-
<version>4.13.2</version>
148+
<scope>test</scope>
149+
</dependency>
150+
151+
<dependency>
152+
<groupId>org.junit.jupiter</groupId>
153+
<artifactId>junit-jupiter</artifactId>
154+
<version>5.9.2</version>
139155
<scope>test</scope>
140156
</dependency>
141157

@@ -144,13 +160,25 @@
144160
<artifactId>powermock-api-mockito2</artifactId>
145161
<version>2.0.9</version>
146162
<scope>test</scope>
163+
<exclusions>
164+
<exclusion>
165+
<groupId>org.powermock</groupId>
166+
<artifactId>powermock-reflect</artifactId>
167+
</exclusion>
168+
</exclusions>
147169
</dependency>
148170

149171
<dependency>
150172
<groupId>org.powermock</groupId>
151173
<artifactId>powermock-module-junit4</artifactId>
152174
<version>2.0.9</version>
153175
<scope>test</scope>
176+
<exclusions>
177+
<exclusion>
178+
<groupId>org.powermock</groupId>
179+
<artifactId>powermock-reflect</artifactId>
180+
</exclusion>
181+
</exclusions>
154182
</dependency>
155183

156184
<dependency>
@@ -164,6 +192,13 @@
164192
<groupId>org.testcontainers</groupId>
165193
<artifactId>jdbc</artifactId>
166194
<scope>test</scope>
195+
<version>1.15.3</version>
196+
<exclusions>
197+
<exclusion>
198+
<groupId>org.rnorth.visible-assertions</groupId>
199+
<artifactId>visible-assertions</artifactId>
200+
</exclusion>
201+
</exclusions>
167202
</dependency>
168203
</dependencies>
169204

@@ -361,6 +396,24 @@
361396
</execution>
362397
</executions>
363398
</plugin>
399+
<plugin>
400+
<groupId>org.apache.maven.plugins</groupId>
401+
<artifactId>maven-enforcer-plugin</artifactId>
402+
<version>3.0.0-M3</version>
403+
<executions>
404+
<execution>
405+
<id>enforce-dependency-convergence</id>
406+
<goals>
407+
<goal>enforce</goal>
408+
</goals>
409+
<configuration>
410+
<rules>
411+
<DependencyConvergence/>
412+
</rules>
413+
</configuration>
414+
</execution>
415+
</executions>
416+
</plugin>
364417
</plugins>
365418
</build>
366419
</profile>

src/main/java/com/alipay/oceanbase/rpc/ObGlobal.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,14 @@ public static String getObVsnString(long version) {
8383

8484
public static boolean isLsOpSupport() {
8585
return OB_VERSION >= OB_VERSION_4_2_3_0 && OB_VERSION < OB_VERSION_4_3_0_0
86-
|| OB_VERSION >= OB_VERSION_4_3_4_0;
86+
|| OB_VERSION >= OB_VERSION_4_3_4_0;
8787
}
8888

8989
public static boolean isReturnOneResultSupport() {
9090
return OB_VERSION >= OB_VERSION_4_2_3_0 && OB_VERSION < OB_VERSION_4_3_0_0
91-
|| OB_VERSION >= OB_VERSION_4_3_4_0;
91+
|| OB_VERSION >= OB_VERSION_4_3_4_0;
9292
}
9393

94-
9594
public static final long OB_VERSION_4_2_3_0 = calcVersion(4, (short) 2, (byte) 3, (byte) 0);
9695

9796
public static final long OB_VERSION_4_3_0_0 = calcVersion(4, (short) 3, (byte) 0, (byte) 0);

src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ private static TableEntry getTableEntryFromRemote(Connection connection, TableEn
735735
}
736736
}
737737
}
738-
738+
739739
if (ObGlobal.obVsnMajor() >= 4) {
740740
// only set empty partitionEntry
741741
ObPartitionEntry partitionEntry = new ObPartitionEntry();
@@ -912,8 +912,8 @@ public static TableEntry getTableEntryLocationFromRemote(Connection connection,
912912
} catch (Exception e) {
913913
RUNTIME.error(LCD.convert("01-00010"), key, partitionNum, tableEntry, e);
914914
throw new ObTablePartitionLocationRefreshException(format(
915-
"fail to get partition location entry from remote entryKey = %s partNum = %d tableEntry =%s "
916-
+ "offset =%d epoch =%d", key, partitionNum, tableEntry, i, epoch), e);
915+
"fail to get partition location entry from remote entryKey = %s partNum = %d tableEntry =%s "
916+
+ "offset =%d epoch =%d", key, partitionNum, tableEntry, i, epoch), e);
917917
} finally {
918918
try {
919919
if (null != rs) {

src/main/java/com/alipay/oceanbase/rpc/location/model/RouteTableRefresher.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.alipay.oceanbase.rpc.ObTableClient;
2020

21-
2221
import java.util.concurrent.ConcurrentLinkedQueue;
2322
import java.util.concurrent.Semaphore;
2423
import java.util.concurrent.atomic.AtomicBoolean;
@@ -30,21 +29,22 @@
3029

3130
import static com.alipay.oceanbase.rpc.util.TableClientLoggerFactory.getLogger;
3231

33-
public class RouteTableRefresher extends Thread{
32+
public class RouteTableRefresher extends Thread {
3433

35-
private static final Logger logger = getLogger(RouteTableRefresher.class);
34+
private static final Logger logger = getLogger(RouteTableRefresher.class);
3635

37-
private volatile AtomicBoolean isFinished = new AtomicBoolean(false); // Thread end flag
36+
private volatile AtomicBoolean isFinished = new AtomicBoolean(
37+
false); // Thread end flag
3838

39-
private final Semaphore semaphore = new Semaphore(0);
39+
private final Semaphore semaphore = new Semaphore(0);
4040

41-
private volatile ConcurrentLinkedQueue<ObPair<String, Boolean>> refreshTableTasks; // Task refresh queue
41+
private volatile ConcurrentLinkedQueue<ObPair<String, Boolean>> refreshTableTasks; // Task refresh queue
4242

43-
ObTableClient client;
43+
ObTableClient client;
4444

45-
private final Lock lock = new ReentrantLock(); // Ensure the atomicity of the AddIfAbsent operation.
45+
private final Lock lock = new ReentrantLock(); // Ensure the atomicity of the AddIfAbsent operation.
4646

47-
public RouteTableRefresher(ObTableClient client){
47+
public RouteTableRefresher(ObTableClient client) {
4848
this.client = client;
4949
}
5050

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObHashPartDesc.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
114114
throw new IllegalArgumentException("length of start key and end key is not equal");
115115
}
116116

117-
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj && ((ObObj) startRow.getValues()[0]).isMinObj() &&
118-
endRow.size() == 1 && endRow.getValues()[0] instanceof ObObj && ((ObObj) endRow.getValues()[0]).isMaxObj()) {
117+
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj
118+
&& ((ObObj) startRow.getValues()[0]).isMinObj() && endRow.size() == 1
119+
&& endRow.getValues()[0] instanceof ObObj
120+
&& ((ObObj) endRow.getValues()[0]).isMaxObj()) {
119121
return completeWorks;
120122
}
121123

@@ -135,7 +137,9 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
135137
}
136138
}
137139
if (startValue == null) {
138-
throw new IllegalArgumentException("Please include all partition key in start range. Currently missing key: { " + curObRefColumnName + " }");
140+
throw new IllegalArgumentException(
141+
"Please include all partition key in start range. Currently missing key: { "
142+
+ curObRefColumnName + " }");
139143
}
140144
if (startValue instanceof ObObj
141145
&& (((ObObj) startValue).isMinObj() || ((ObObj) startValue).isMaxObj())) {
@@ -150,7 +154,9 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
150154
}
151155
}
152156
if (endValue == null) {
153-
throw new IllegalArgumentException("Please include all partition key in end range. Currently missing key: { " + curObRefColumnName + " }");
157+
throw new IllegalArgumentException(
158+
"Please include all partition key in end range. Currently missing key: { "
159+
+ curObRefColumnName + " }");
154160
}
155161
if (endValue instanceof ObObj
156162
&& (((ObObj) endValue).isMinObj() || ((ObObj) endValue).isMaxObj())) {

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObKeyPartDesc.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
103103
throw new IllegalArgumentException("length of start key and end key is not equal");
104104
}
105105

106-
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj && ((ObObj) startRow.getValues()[0]).isMinObj() &&
107-
endRow.size() == 1 && endRow.getValues()[0] instanceof ObObj && ((ObObj) endRow.getValues()[0]).isMaxObj()) {
106+
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj
107+
&& ((ObObj) startRow.getValues()[0]).isMinObj() && endRow.size() == 1
108+
&& endRow.getValues()[0] instanceof ObObj
109+
&& ((ObObj) endRow.getValues()[0]).isMaxObj()) {
108110
return completeWorks;
109111
}
110112

@@ -124,10 +126,12 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
124126
}
125127
}
126128
if (startValue == null) {
127-
throw new IllegalArgumentException("Please include all partition key in start range. Currently missing key: { " + curObRefColumnName + " }");
129+
throw new IllegalArgumentException(
130+
"Please include all partition key in start range. Currently missing key: { "
131+
+ curObRefColumnName + " }");
128132
}
129133
if (startValue instanceof ObObj
130-
&& (((ObObj) startValue).isMinObj() || ((ObObj) startValue).isMaxObj())) {
134+
&& (((ObObj) startValue).isMinObj() || ((ObObj) startValue).isMaxObj())) {
131135
return completeWorks;
132136
}
133137

@@ -139,10 +143,12 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
139143
}
140144
}
141145
if (endValue == null) {
142-
throw new IllegalArgumentException("Please include all partition key in end range. Currently missing key: { " + curObRefColumnName + " }");
146+
throw new IllegalArgumentException(
147+
"Please include all partition key in end range. Currently missing key: { "
148+
+ curObRefColumnName + " }");
143149
}
144150
if (endValue instanceof ObObj
145-
&& (((ObObj) endValue).isMinObj() || ((ObObj) endValue).isMaxObj())) {
151+
&& (((ObObj) endValue).isMinObj() || ((ObObj) endValue).isMaxObj())) {
146152
return completeWorks;
147153
}
148154
}

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObListPartDesc.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
110110
boolean endInclusive) {
111111
throw new IllegalArgumentException("getPartIds for List partition is not supported");
112112
}
113+
113114
/*
114115
* Get part id.
115116
*/

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObPartDesc.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ protected List<Comparable> initComparableElementByTypes(List<Object> objects,
170170

171171
//to prepare partition calculate resource
172172
//to check partition calculate is ready
173-
public void prepare() throws IllegalArgumentException { /* do nothing now */ }
173+
public void prepare() throws IllegalArgumentException { /* do nothing now */
174+
}
174175

175176
/*
176177
* Eval row key values.
@@ -182,38 +183,38 @@ public List<Object> evalRowKeyValues(Row row) throws IllegalArgumentException {
182183
String[] rowColumnNames = row.getColumns();
183184

184185
if (rowValues.length < partColumnSize) {
185-
throw new IllegalArgumentException("Input row key should at least include " + partColumns
186-
+ "but found" + Arrays.toString(rowValues));
186+
throw new IllegalArgumentException("Input row key should at least include "
187+
+ partColumns + "but found"
188+
+ Arrays.toString(rowValues));
187189
}
188190

189-
190191
boolean needEval = true;
191192

192193
// column or generate column
193194
for (int i = 0; i < partColumns.size(); ++i) {
194195
ObColumn curObColumn = partColumns.get(i);
195-
List<String> curObRefColumnNames = curObColumn.getRefColumnNames();
196-
Object[] evalParams = new Object[curObRefColumnNames.size()];
197-
for (int j = 0; j < curObRefColumnNames.size(); ++j) {
198-
for (int k = 0; k < rowColumnNames.length; ++k) {
199-
if (rowColumnNames[k].equalsIgnoreCase(curObRefColumnNames.get(j))) {
200-
if (curObRefColumnNames.size() == 1 && rowValues[k] instanceof ObObj) {
201-
ObObj obj = (ObObj) rowValues[k];
202-
if (obj.isMaxObj() || obj.isMinObj()) {
203-
evalValues.add(obj);
204-
needEval = false;
205-
break;
206-
}
196+
List<String> curObRefColumnNames = curObColumn.getRefColumnNames();
197+
Object[] evalParams = new Object[curObRefColumnNames.size()];
198+
for (int j = 0; j < curObRefColumnNames.size(); ++j) {
199+
for (int k = 0; k < rowColumnNames.length; ++k) {
200+
if (rowColumnNames[k].equalsIgnoreCase(curObRefColumnNames.get(j))) {
201+
if (curObRefColumnNames.size() == 1 && rowValues[k] instanceof ObObj) {
202+
ObObj obj = (ObObj) rowValues[k];
203+
if (obj.isMaxObj() || obj.isMinObj()) {
204+
evalValues.add(obj);
205+
needEval = false;
206+
break;
207207
}
208-
evalParams[j] = rowValues[k];
209-
break;
210208
}
209+
evalParams[j] = rowValues[k];
210+
break;
211211
}
212212
}
213-
if (needEval) {
214-
evalValues.add(curObColumn.evalValue(evalParams));
215-
}
216213
}
214+
if (needEval) {
215+
evalValues.add(curObColumn.evalValue(evalParams));
216+
}
217+
}
217218

218219
return evalValues;
219220
}

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObRangePartDesc.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,17 @@ public List<Long> getPartIds(Object startRowObj, boolean startInclusive, Object
220220

221221
if (!(startRowObj instanceof Row) || !(endRowObj instanceof Row)) {
222222
throw new ObTableException("invalid format of rowObj: " + startRowObj + ", "
223-
+ endRowObj);
223+
+ endRowObj);
224224
}
225225
Row startRow = (Row) startRowObj, endRow = (Row) endRowObj;
226226
// pre-check start and end
227227
// should remove after remove addRowkeyElement
228228
if (startRow.size() != endRow.size()) {
229229
throw new IllegalArgumentException("length of start key and end key is not equal");
230230
}
231-
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj && ((ObObj) startRow.getValues()[0]).isMinObj() &&
232-
endRow.size() == 1 && endRow.getValues()[0] instanceof ObObj && ((ObObj) endRow.getValues()[0]).isMaxObj()) {
231+
if (startRow.size() == 1 && startRow.getValues()[0] instanceof ObObj
232+
&& ((ObObj) startRow.getValues()[0]).isMinObj() && endRow.size() == 1
233+
&& endRow.getValues()[0] instanceof ObObj && ((ObObj) endRow.getValues()[0]).isMaxObj()) {
233234
return completeWorks;
234235
}
235236

@@ -265,8 +266,9 @@ public int getBoundsIdx(boolean isScan, List<Object> rowObj) {
265266
}
266267
Row row = (Row) rowObj.get(0);
267268
if (row.size() < partColumns.size()) {
268-
throw new IllegalArgumentException("Input row key should at least include " + partColumns
269-
+ "but found" + Arrays.toString(row.getValues()));
269+
throw new IllegalArgumentException("Input row key should at least include "
270+
+ partColumns + "but found"
271+
+ Arrays.toString(row.getValues()));
270272
}
271273

272274
try {

0 commit comments

Comments
 (0)