Skip to content

Commit 7b7e778

Browse files
committed
format project and add format check to GitHub Action
1 parent ca68517 commit 7b7e778

File tree

10 files changed

+132
-123
lines changed

10 files changed

+132
-123
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
distribution: 'zulu'
4444
cache: 'maven'
4545
- name: Maven Build
46-
run: mvn -B clean verify -Dgpg.skip -DskipTests=true
46+
run: |
47+
mvn -B clean verify -Dgpg.skip -DskipTests=true
48+
git diff --exit-code
4749
4850
test-obkv-table-client-java:
4951
name: Test (obkv-table-client-java)

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@
331331
<nrOfIndentSpace>4</nrOfIndentSpace>
332332
<keepBlankLines>true</keepBlankLines>
333333
<sortProperties>true</sortProperties>
334+
<expandEmptyElements>false</expandEmptyElements>
334335
<encoding>${project.encoding}</encoding>
335336
</configuration>
336337
</plugin>

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObConnectionFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040

4141
public class ObConnectionFactory implements ConnectionFactory {
4242

43-
private static final Logger logger = LoggerFactory.getLogger(ObConnectionFactory.class);
43+
private static final Logger logger = LoggerFactory
44+
.getLogger(ObConnectionFactory.class);
4445

4546
private static final EventLoopGroup workerGroup = NettyEventLoopUtil.newEventLoopGroup(Runtime
4647
.getRuntime().availableProcessors() + 1,

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
122122
ObRpcResultCode resultCode = new ObRpcResultCode();
123123
resultCode.decode(buf);
124124
// If response indicates the request is routed to wrong server, we should refresh the routing meta.
125-
if (!conn.getObTable().getReRouting() &&response.getHeader().isRoutingWrong()) {
125+
if (!conn.getObTable().getReRouting() && response.getHeader().isRoutingWrong()) {
126126
String errMessage = TraceUtil.formatTraceMessage(conn, request,
127127
"routed to the wrong server: " + response.getMessage());
128128
logger.warn(errMessage);
@@ -139,7 +139,8 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
139139
throw new ObTableNeedFetchAllException(errMessage, resultCode.getRcode());
140140
}
141141
}
142-
if (resultCode.getRcode() != 0 && response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) {
142+
if (resultCode.getRcode() != 0
143+
&& response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) {
143144
String errMessage = TraceUtil.formatTraceMessage(conn, request,
144145
"routed to the wrong server: " + response.getMessage());
145146
logger.warn(errMessage);

src/main/java/com/alipay/oceanbase/rpc/direct_load/protocol/v0/ObDirectLoadProtocolV0.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public void checkIsSupported(ObDirectLoadStatement statement) throws ObDirectLoa
6969
logger.warn("partition names in ob version " + ObGlobal.getObVsnString(obVersion)
7070
+ "is not supported, minimum version required is "
7171
+ ObGlobal.getObVsnString(OB_VERSION_4_3_5_0));
72-
throw new ObDirectLoadNotSupportedException("partition names in ob version "
73-
+ ObGlobal.getObVsnString(obVersion)
74-
+ " is not supported, minimum version required is "
75-
+ ObGlobal.getObVsnString(OB_VERSION_4_3_5_0));
72+
throw new ObDirectLoadNotSupportedException(
73+
"partition names in ob version " + ObGlobal.getObVsnString(obVersion)
74+
+ " is not supported, minimum version required is "
75+
+ ObGlobal.getObVsnString(OB_VERSION_4_3_5_0));
7676
}
7777
}
7878

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

Lines changed: 96 additions & 97 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ public Long getReplicaNum() {
102102
* Is partition table.
103103
*/
104104
public boolean isPartitionTable() {
105-
return partitionNum > 1 || (partitionInfo != null && partitionInfo.getLevel()
106-
.getIndex() > ObPartitionLevel.LEVEL_ZERO.getIndex() && partitionInfo.getLevel()
107-
.getIndex() < ObPartitionLevel.UNKNOWN.getIndex());
105+
return partitionNum > 1
106+
|| (partitionInfo != null
107+
&& partitionInfo.getLevel().getIndex() > ObPartitionLevel.LEVEL_ZERO.getIndex() && partitionInfo
108+
.getLevel().getIndex() < ObPartitionLevel.UNKNOWN.getIndex());
108109
}
109110

110111
/*

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/ObTableLSOpRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ public void addTabletOperation(ObTableTabletOp tabletOp) {
121121
public void setLsOperation(ObTableLSOperation lsOperation) {
122122
this.lsOperation = lsOperation;
123123
}
124-
124+
125125
/*
126126
* Get entity type.
127127
*/
128128
public ObTableEntityType getEntityType() {
129129
return entityType;
130130
}
131-
131+
132132
/*
133133
* Set entity type.
134134
*/

src/main/java/com/alipay/oceanbase/rpc/stream/ObTableClientQueryAsyncStreamResult.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ public void init() throws Exception {
8282
} catch (Exception e) {
8383
if (e instanceof ObTableNeedFetchAllException) {
8484
setExpectant(refreshPartition(this.asyncRequest.getObTableQueryRequest()
85-
.getTableQuery(), client.getPhyTableNameFromTableGroup(entityType, tableName)));
85+
.getTableQuery(), client.getPhyTableNameFromTableGroup(entityType,
86+
tableName)));
8687
it = expectant.entrySet().iterator();
8788
retryTimes++;
8889
if (retryTimes > maxRetries) {
8990
RUNTIME.error("Fail to get refresh table entry response after {}",
9091
retryTimes);
9192
throw new ObTableRetryExhaustedException(
9293
"Fail to get refresh table entry response after " + retryTimes
93-
+ "errorCode:" + ((ObTableNeedFetchAllException) e).getErrorCode());
94+
+ "errorCode:"
95+
+ ((ObTableNeedFetchAllException) e).getErrorCode());
9496

9597
}
9698
} else {
@@ -188,7 +190,7 @@ protected Map<Long, ObPair<Long, ObTableParam>> refreshPartition(ObTableQuery ta
188190
public void renewLease() throws Exception {
189191
if (!isEnd() && !expectant.isEmpty()) {
190192
Iterator<Map.Entry<Long, ObPair<Long, ObTableParam>>> it = expectant.entrySet()
191-
.iterator();
193+
.iterator();
192194
Map.Entry<Long, ObPair<Long, ObTableParam>> lastEntry = it.next();
193195
ObPair<Long, ObTableParam> partIdWithObTable = lastEntry.getValue();
194196
// try access new partition, async will not remove useless expectant
@@ -230,7 +232,8 @@ public boolean next() throws Exception {
230232
referToLastStreamResult(lastEntry.getValue());
231233
} catch (Exception e) {
232234
if (e instanceof ObTableNeedFetchAllException) {
233-
String realTableName = client.getPhyTableNameFromTableGroup(entityType, tableName);
235+
String realTableName = client.getPhyTableNameFromTableGroup(entityType,
236+
tableName);
234237
this.asyncRequest.getObTableQueryRequest().getTableQuery()
235238
.adjustStartKey(currentStartKey);
236239
setExpectant(refreshPartition(this.asyncRequest.getObTableQueryRequest()
@@ -262,7 +265,8 @@ public boolean next() throws Exception {
262265
referToNewPartition(entry.getValue());
263266
} catch (Exception e) {
264267
if (e instanceof ObTableNeedFetchAllException) {
265-
String realTableName = client.getPhyTableNameFromTableGroup(entityType, tableName);
268+
String realTableName = client.getPhyTableNameFromTableGroup(entityType,
269+
tableName);
266270
this.asyncRequest.getObTableQueryRequest().getTableQuery()
267271
.adjustStartKey(currentStartKey);
268272
setExpectant(refreshPartition(this.asyncRequest.getObTableQueryRequest()

src/main/java/com/alipay/oceanbase/rpc/table/ObHBaseParams.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import static com.alipay.oceanbase.rpc.util.Serialization.encodeObUniVersionHeader;
2424

2525
public class ObHBaseParams extends ObKVParamsBase {
26-
int caching = -1; // limit the number of for each rpc call
27-
int callTimeout = -1; // scannerLeasePeriodTimeout in hbase, client rpc timeout
28-
boolean allowPartialResults = true; // whether allow partial row return or not
29-
boolean isCacheBlock = false; // whether enable server block cache and row cache or not
30-
boolean checkExistenceOnly = false; // check the existence only
26+
int caching = -1; // limit the number of for each rpc call
27+
int callTimeout = -1; // scannerLeasePeriodTimeout in hbase, client rpc timeout
28+
boolean allowPartialResults = true; // whether allow partial row return or not
29+
boolean isCacheBlock = false; // whether enable server block cache and row cache or not
30+
boolean checkExistenceOnly = false; // check the existence only
3131
String hbaseVersion = "1.3.6";
3232

3333
private static final int FLAG_ALLOW_PARTIAL_RESULTS = 1 << 0;
@@ -120,7 +120,7 @@ public byte[] encode() {
120120
System.arraycopy(booleansToByteArray(), 0, bytes, idx, 1);
121121
idx += 1;
122122
System.arraycopy(Serialization.encodeVString(hbaseVersion), 0, bytes, idx,
123-
Serialization.getNeedBytes(hbaseVersion));
123+
Serialization.getNeedBytes(hbaseVersion));
124124
idx += Serialization.getNeedBytes(hbaseVersion);
125125

126126
return bytes;
@@ -150,8 +150,8 @@ public String toString() {
150150
return "ObParams: {\n pType = " + pType + ", \n caching = " + caching
151151
+ ", \n callTimeout = " + callTimeout + ", \n allowPartialResult = "
152152
+ allowPartialResults + ", \n isCacheBlock = " + isCacheBlock
153-
+ ", \n checkExistenceOnly = " + checkExistenceOnly
154-
+ ", \n hbaseVersion = " + hbaseVersion + "\n}\n";
153+
+ ", \n checkExistenceOnly = " + checkExistenceOnly + ", \n hbaseVersion = "
154+
+ hbaseVersion + "\n}\n";
155155
}
156156

157157
}

0 commit comments

Comments
 (0)