Skip to content

Commit e053056

Browse files
authored
Merge pull request #216 from WeiXinChan/pom
update pom.xml
2 parents 07c37aa + 9f96bbf commit e053056

30 files changed

+605
-386
lines changed

pom.xml

Lines changed: 49 additions & 30 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,21 +103,6 @@
91103
<dependency>
92104
<groupId>com.google.guava</groupId>
93105
<artifactId>guava</artifactId>
94-
<version>31.1-jre</version>
95-
</dependency>
96-
97-
<dependency>
98-
<groupId>org.springframework</groupId>
99-
<artifactId>spring-core</artifactId>
100-
<version>5.2.25.RELEASE</version>
101-
<scope>test</scope>
102-
</dependency>
103-
104-
<dependency>
105-
<groupId>org.springframework</groupId>
106-
<artifactId>spring-beans</artifactId>
107-
<version>5.2.25.RELEASE</version>
108-
<scope>test</scope>
109106
</dependency>
110107

111108
<dependency>
@@ -129,13 +126,11 @@
129126
<dependency>
130127
<groupId>org.slf4j</groupId>
131128
<artifactId>slf4j-api</artifactId>
132-
<version>1.7.36</version>
133129
</dependency>
134130

135131
<dependency>
136132
<groupId>junit</groupId>
137133
<artifactId>junit</artifactId>
138-
<version>4.13.2</version>
139134
<scope>test</scope>
140135
</dependency>
141136

@@ -144,6 +139,12 @@
144139
<artifactId>powermock-api-mockito2</artifactId>
145140
<version>2.0.9</version>
146141
<scope>test</scope>
142+
<exclusions>
143+
<exclusion>
144+
<artifactId>objenesis</artifactId>
145+
<groupId>org.objenesis</groupId>
146+
</exclusion>
147+
</exclusions>
147148
</dependency>
148149

149150
<dependency>
@@ -153,17 +154,17 @@
153154
<scope>test</scope>
154155
</dependency>
155156

156-
<dependency>
157-
<groupId>ch.qos.logback</groupId>
158-
<artifactId>logback-classic</artifactId>
159-
<version>1.2.12</version>
160-
<scope>test</scope>
161-
</dependency>
162-
163157
<dependency>
164158
<groupId>org.testcontainers</groupId>
165159
<artifactId>jdbc</artifactId>
166160
<scope>test</scope>
161+
<version>1.15.3</version>
162+
<exclusions>
163+
<exclusion>
164+
<groupId>org.rnorth.visible-assertions</groupId>
165+
<artifactId>visible-assertions</artifactId>
166+
</exclusion>
167+
</exclusions>
167168
</dependency>
168169
</dependencies>
169170

@@ -361,6 +362,24 @@
361362
</execution>
362363
</executions>
363364
</plugin>
365+
<plugin>
366+
<groupId>org.apache.maven.plugins</groupId>
367+
<artifactId>maven-enforcer-plugin</artifactId>
368+
<version>3.0.0-M3</version>
369+
<executions>
370+
<execution>
371+
<id>enforce-dependency-convergence</id>
372+
<goals>
373+
<goal>enforce</goal>
374+
</goals>
375+
<configuration>
376+
<rules>
377+
<DependencyConvergence/>
378+
</rules>
379+
</configuration>
380+
</execution>
381+
</executions>
382+
</plugin>
364383
</plugins>
365384
</build>
366385
</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/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)