Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check-style compile warnings in server #2437

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3559ace
refact: move dirs into hugegraph-server
VGalaxies Aug 1, 2023
9068cef
refact: create dirs for hugegraph-pd and hugegraph-store
VGalaxies Aug 2, 2023
fd161f2
refact: init root pom for all modules
VGalaxies Aug 4, 2023
49a1acf
fix: fix parent of submodules in hugegraph-server
VGalaxies Aug 4, 2023
fca91b2
fix: path
msgui Aug 13, 2023
8465927
fix: conf path
msgui Aug 13, 2023
3b791ee
fix: 1.10 -> 1.11
msgui Aug 13, 2023
ae90ba6
Revert "fix: 1.10 -> 1.11"
msgui Aug 14, 2023
ce5ddbf
fix: version 1.0.0 -> 1.5.0
msgui Aug 14, 2023
8a7ed6a
fix:
msgui Aug 14, 2023
242786b
check
msgui Aug 16, 2023
2e401de
fix: SERVER_DIR
msgui Aug 16, 2023
67de746
fix
msgui Aug 16, 2023
edb77ef
fix
msgui Aug 16, 2023
764dd89
fix: SERVER_DIR
msgui Aug 16, 2023
9a2f2e6
Merge pull request #5 from msgui/fix_CI
msgui Aug 17, 2023
4f68641
test
msgui Sep 9, 2023
d582a51
Merge pull request #14 from msgui/new-fix-depedency-review
msgui Sep 9, 2023
80cf036
Merge branch 'master' of https://github.com/msgui/incubator-hugegraph
msgui Sep 13, 2023
2b241dd
Merge branch 'master' of https://github.com/msgui/incubator-hugegraph
msgui Oct 12, 2023
5b5560f
Merge branch 'master' of https://github.com/msgui/incubator-hugegraph
msgui Nov 28, 2023
016d451
Merge branch 'apache:master' into master
msgui Dec 5, 2023
c7d7c93
chore
msgui Dec 5, 2023
644e15e
Merge branch 'apache:master' into master
msgui Dec 7, 2023
0e14a96
Merge branch 'apache:master' into master
msgui Dec 9, 2023
51dd042
Merge branch 'apache:master' into master
msgui Jan 30, 2024
5c19a5a
add: Configure all files to use LF
msgui Feb 1, 2024
e5ebbb4
format hg-server-api
msgui Feb 1, 2024
65a3161
format hg-server-cassandra
msgui Feb 1, 2024
642fd3a
format hg-server-core
msgui Feb 1, 2024
604fbde
format hg-server-dist
msgui Feb 1, 2024
d898038
format hg-server-example
msgui Feb 1, 2024
7ea6d21
format hg-server-hbase
msgui Feb 1, 2024
7f39c04
format hg-server-mysql
msgui Feb 1, 2024
c546885
format hg-server-palo
msgui Feb 1, 2024
ead9b34
format hg-server-postgresql
msgui Feb 1, 2024
37cf9b1
format hg-server-rocksdb
msgui Feb 1, 2024
15ef231
format hg-server-scylladb
msgui Feb 1, 2024
579a6a2
format hg-server-test
msgui Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format hg-server-mysql
  • Loading branch information
msgui committed Feb 1, 2024
commit 7f39c041659f0b927f0465b0c7b959453aa0627b
30 changes: 16 additions & 14 deletions hugegraph-server/hugegraph-mysql/pom.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with this
work for additional information regarding copyright ownership. The ASF
licenses this file to You under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hugegraph-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

package org.apache.hugegraph.backend.store.mysql;
Expand Down Expand Up @@ -45,7 +47,7 @@ public class MysqlEntryIterator extends BackendEntryIterator {
private boolean exceedLimit;

public MysqlEntryIterator(ResultSetWrapper rs, Query query,
BiFunction<BackendEntry, BackendEntry, BackendEntry> merger) {
BiFunction<BackendEntry, BackendEntry, BackendEntry> merger) {
super(query);
this.results = rs;
this.merger = merger;
Expand Down Expand Up @@ -100,7 +102,7 @@ protected PageState pageState() {
byte[] position;
// There is no latest or no next page
if (this.lastest == null || !this.exceedLimit &&
this.fetched() <= this.query.limit() && this.next == null) {
this.fetched() <= this.query.limit() && this.next == null) {
position = PageState.EMPTY_BYTES;
} else {
MysqlBackendEntry entry = (MysqlBackendEntry) this.lastest;
Expand Down Expand Up @@ -168,6 +170,18 @@ public PagePosition(Map<HugeKeys, Object> columns) {
this.columns = columns;
}

public static PagePosition fromBytes(byte[] bytes) {
String json = StringEncoding.decode(bytes);
@SuppressWarnings("unchecked")
Map<String, Object> columns = JsonUtil.fromJson(json, Map.class);
Map<HugeKeys, Object> keyColumns = new LinkedHashMap<>();
for (Map.Entry<String, Object> entry : columns.entrySet()) {
HugeKeys key = MysqlTable.parseKey(entry.getKey());
keyColumns.put(key, entry.getValue());
}
return new PagePosition(keyColumns);
}

public Map<HugeKeys, Object> columns() {
return this.columns;
}
Expand All @@ -181,17 +195,5 @@ public byte[] toBytes() {
String json = JsonUtil.toJson(this.columns);
return StringEncoding.encode(json);
}

public static PagePosition fromBytes(byte[] bytes) {
String json = StringEncoding.decode(bytes);
@SuppressWarnings("unchecked")
Map<String, Object> columns = JsonUtil.fromJson(json, Map.class);
Map<HugeKeys, Object> keyColumns = new LinkedHashMap<>();
for (Map.Entry<String, Object> entry : columns.entrySet()) {
HugeKeys key = MysqlTable.parseKey(entry.getKey());
keyColumns.put(key, entry.getValue());
}
return new PagePosition(keyColumns);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

package org.apache.hugegraph.backend.store.mysql;

import java.util.Map;

import org.apache.hugegraph.backend.store.BackendMetrics;

import com.google.common.collect.ImmutableMap;

public class MysqlMetrics implements BackendMetrics {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

package org.apache.hugegraph.backend.store.mysql;
Expand All @@ -25,93 +27,84 @@

public class MysqlOptions extends OptionHolder {

public static final ConfigOption<String> JDBC_DRIVER =
new ConfigOption<>(
"jdbc.driver",
"The JDBC driver class to connect database.",
disallowEmpty(),
"com.mysql.jdbc.Driver"
);
public static final ConfigOption<String> JDBC_URL =
new ConfigOption<>(
"jdbc.url",
"The url of database in JDBC format.",
disallowEmpty(),
"jdbc:mysql://127.0.0.1:3306"
);
public static final ConfigOption<String> JDBC_USERNAME =
new ConfigOption<>(
"jdbc.username",
"The username to login database.",
disallowEmpty(),
"root"
);
public static final ConfigOption<String> JDBC_PASSWORD =
new ConfigOption<>(
"jdbc.password",
"The password corresponding to jdbc.username.",
null,
"******"
);
public static final ConfigOption<Boolean> JDBC_FORCED_AUTO_RECONNECT =
new ConfigOption<>(
"jdbc.forced_auto_reconnect",
"Whether to forced auto reconnect to the database even " +
"if the connection fails at the first time. Note that " +
"forced_auto_reconnect=true will disable fail-fast.",
disallowEmpty(),
false
);
public static final ConfigOption<Integer> JDBC_RECONNECT_MAX_TIMES =
new ConfigOption<>(
"jdbc.reconnect_max_times",
"The reconnect times when the database connection fails.",
rangeInt(1, 10),
3
);
public static final ConfigOption<Integer> JDBC_RECONNECT_INTERVAL =
new ConfigOption<>(
"jdbc.reconnect_interval",
"The interval(seconds) between reconnections when the " +
"database connection fails.",
rangeInt(1, 10),
3
);
public static final ConfigOption<String> JDBC_SSL_MODE =
new ConfigOption<>(
"jdbc.ssl_mode",
"The SSL mode of connections with database.",
disallowEmpty(),
"false"
);
public static final ConfigOption<String> JDBC_STORAGE_ENGINE =
new ConfigOption<>(
"jdbc.storage_engine",
"The storage engine of backend store database, " +
"like InnoDB/MyISAM/RocksDB for MySQL.",
disallowEmpty(),
"InnoDB"
);
private static volatile MysqlOptions instance;

protected MysqlOptions() {
super();
}

private static volatile MysqlOptions instance;

public static synchronized MysqlOptions instance() {
if (instance == null) {
instance = new MysqlOptions();
instance.registerOptions();
}
return instance;
}

public static final ConfigOption<String> JDBC_DRIVER =
new ConfigOption<>(
"jdbc.driver",
"The JDBC driver class to connect database.",
disallowEmpty(),
"com.mysql.jdbc.Driver"
);

public static final ConfigOption<String> JDBC_URL =
new ConfigOption<>(
"jdbc.url",
"The url of database in JDBC format.",
disallowEmpty(),
"jdbc:mysql://127.0.0.1:3306"
);

public static final ConfigOption<String> JDBC_USERNAME =
new ConfigOption<>(
"jdbc.username",
"The username to login database.",
disallowEmpty(),
"root"
);

public static final ConfigOption<String> JDBC_PASSWORD =
new ConfigOption<>(
"jdbc.password",
"The password corresponding to jdbc.username.",
null,
"******"
);

public static final ConfigOption<Boolean> JDBC_FORCED_AUTO_RECONNECT =
new ConfigOption<>(
"jdbc.forced_auto_reconnect",
"Whether to forced auto reconnect to the database even " +
"if the connection fails at the first time. Note that " +
"forced_auto_reconnect=true will disable fail-fast.",
disallowEmpty(),
false
);

public static final ConfigOption<Integer> JDBC_RECONNECT_MAX_TIMES =
new ConfigOption<>(
"jdbc.reconnect_max_times",
"The reconnect times when the database connection fails.",
rangeInt(1, 10),
3
);

public static final ConfigOption<Integer> JDBC_RECONNECT_INTERVAL =
new ConfigOption<>(
"jdbc.reconnect_interval",
"The interval(seconds) between reconnections when the " +
"database connection fails.",
rangeInt(1, 10),
3
);

public static final ConfigOption<String> JDBC_SSL_MODE =
new ConfigOption<>(
"jdbc.ssl_mode",
"The SSL mode of connections with database.",
disallowEmpty(),
"false"
);

public static final ConfigOption<String> JDBC_STORAGE_ENGINE =
new ConfigOption<>(
"jdbc.storage_engine",
"The storage engine of backend store database, " +
"like InnoDB/MyISAM/RocksDB for MySQL.",
disallowEmpty(),
"InnoDB"
);
}
Loading