Skip to content

Commit 4f46f66

Browse files
committed
feat(db): remove leveldb support for arm64
1 parent e5055a7 commit 4f46f66

27 files changed

Lines changed: 255 additions & 132 deletions

File tree

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,20 @@ TRON enables large-scale development and engagement. With over 2000 transactions
5959

6060
# Building the Source Code
6161

62-
Building java-tron requires `git` package and 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
62+
Building java-tron requires `git` package
6363

64+
## operating systems
65+
Make sure you operate on `Linux` or `MacOS` operating systems, other operating systems are not supported yet.
66+
67+
## Architecture
68+
69+
### x86_64
70+
64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet.
71+
72+
### ARM64
73+
64-bit version of `JDK 17` to be installed, other JDK versions are not supported yet.
74+
75+
### build
6476
Clone the repo and switch to the `master` branch
6577

6678
```bash
@@ -77,8 +89,19 @@ $ ./gradlew clean build -x test
7789

7890
# Running java-tron
7991

80-
Running java-tron requires 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
92+
## operating systems
93+
Make sure you operate on `Linux` or `MacOS` operating systems, other operating systems are not supported yet.
94+
95+
## Architecture
8196

97+
### X86_64
98+
Requires 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet.
99+
100+
### ARM64
101+
Requires 64-bit version of `JDK 17` to be installed, other JDK versions are not supported yet.
102+
103+
104+
## Configuration flile
82105
Get the mainnet configuration file: [main_net_config.conf](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf), other network configuration files can be found [here](https://github.com/tronprotocol/tron-deployment).
83106

84107
## Hardware Requirements
@@ -100,6 +123,7 @@ Recommended:
100123

101124
Full node has full historical data, it is the entry point into the TRON network, it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node:transfer assets, deploy contracts, interact with contracts and so on. `-c` parameter specifies a configuration file to run a full node:
102125

126+
### x86_64 JDK8
103127
```bash
104128
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
105129
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
@@ -111,6 +135,19 @@ $ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
111135
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
112136
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
113137
```
138+
### ARM64 JDK17
139+
```bash
140+
$ nohup java -Xms9G -Xmx9G -XX:+UseZGC \
141+
-Xlog:gc*:file=gc.log:time,uptime,level,tags:filecount=50,filesize=100M \
142+
-XX:ReservedCodeCacheSize=256m \
143+
-XX:+UseCodeCacheFlushing \
144+
-XX:MetaspaceSize=256m \
145+
-XX:MaxMetaspaceSize=512m \
146+
-XX:MaxDirectMemorySize=1g \
147+
-XX:+HeapDumpOnOutOfMemoryError \
148+
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
149+
```
150+
114151

115152
## Running a super representative node for mainnet
116153

@@ -126,6 +163,7 @@ Fill in the private key of a super representative address into the `localwitness
126163

127164
then run the following command to start the node:
128165

166+
### x86_64 JDK8
129167
```bash
130168
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
131169
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
@@ -137,6 +175,18 @@ $ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
137175
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
138176
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
139177
```
178+
### ARM64 JDK17
179+
```bash
180+
$ nohup java -Xms9G -Xmx9G -XX:+UseZGC \
181+
-Xlog:gc*:file=gc.log:time,uptime,level,tags:filecount=50,filesize=100M \
182+
-XX:ReservedCodeCacheSize=256m \
183+
-XX:+UseCodeCacheFlushing \
184+
-XX:MetaspaceSize=256m \
185+
-XX:MaxMetaspaceSize=512m \
186+
-XX:MaxDirectMemorySize=1g \
187+
-XX:+HeapDumpOnOutOfMemoryError \
188+
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
189+
```
140190

141191
## Quick Start Tool
142192

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static def isX86() {
1111

1212
static def isArm64() {
1313
def arch = System.getProperty("os.arch").toLowerCase()
14-
return new Architectures.KnownArchitecture("arm64", "aarch64").isAlias(arch)
14+
return Architectures.AARCH64.isAlias(arch)
1515
}
1616

1717
if (isArm64() && !JavaVersion.current().is(JavaVersion.VERSION_17)) {

chainbase/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies {
1010
api project(":common")
1111
api project(":crypto")
1212
api "org.fusesource.jansi:jansi:$jansiVersion"
13-
api 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
1413
api 'org.reflections:reflections:0.9.11'
1514
}
1615

framework/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.nativeplatform.platform.internal.Architectures
2+
13
plugins {
24
id "org.gradle.test-retry" version "1.5.9"
35
id "org.sonarqube" version "2.6"
@@ -34,6 +36,11 @@ task version(type: Exec) {
3436
commandLine 'bash', '-c', '../ver.sh'
3537
}
3638

39+
static def isArm64() {
40+
def arch = System.getProperty("os.arch").toLowerCase()
41+
return Architectures.AARCH64.isAlias(arch)
42+
}
43+
3744
dependencies {
3845
//local libraries
3946
implementation fileTree(dir: 'libs', include: '*.jar')
@@ -122,6 +129,18 @@ test {
122129
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
123130
classDumpDir = file("$buildDir/jacoco/classpathdumps")
124131
}
132+
if (isArm64()) {
133+
exclude { element ->
134+
element.file.name.toLowerCase().contains('leveldb')
135+
}
136+
exclude('org/tron/program/DBConvertTest.class')
137+
filter {
138+
excludeTestsMatching '*.*leveldb*'
139+
excludeTestsMatching '*.*Leveldb*'
140+
excludeTestsMatching '*.*LevelDB*'
141+
excludeTestsMatching '*.*LevelDb*'
142+
}
143+
}
125144
if (isWindows()) {
126145
exclude '**/ShieldedTransferActuatorTest.class'
127146
exclude '**/BackupDbUtilTest.class'

framework/src/main/java/org/tron/program/DBConvert.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.rocksdb.RocksDBException;
3333
import org.rocksdb.RocksIterator;
3434
import org.rocksdb.Status;
35+
import org.tron.common.arch.Arch;
3536
import org.tron.common.utils.FileUtil;
3637
import org.tron.common.utils.MarketOrderPriceComparatorForLevelDB;
3738
import org.tron.common.utils.MarketOrderPriceComparatorForRocksDB;
@@ -91,6 +92,7 @@ public static org.iq80.leveldb.Options newDefaultLevelDbOptions() {
9192
}
9293

9394
public static void main(String[] args) {
95+
Arch.throwUnsupportedArm64Exception();
9496
int code = run(args);
9597
logger.info("exit code {}.", code);
9698
System.out.printf("exit code %d.\n", code);

framework/src/main/resources/config.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ net {
55

66
storage {
77
# Directory for storing persistent data
8-
db.engine = "LEVELDB",
8+
db.engine = "LEVELDB", // deprecated for arm, because arm only support "ROCKSDB".
99
db.sync = false,
1010
db.directory = "database",
1111
index.directory = "index",
@@ -19,7 +19,7 @@ storage {
1919
# Otherwise, db configs will remain default and data will be stored in
2020
# the path of "output-directory" or which is set by "-d" ("--output-directory").
2121

22-
# setting can impove leveldb performance .... start
22+
# setting can impove leveldb performance .... start, deprecated for arm
2323
# node: if this will increase process fds,you may be check your ulimit if 'too many open files' error occurs
2424
# see https://github.com/tronprotocol/tips/blob/master/tip-343.md for detail
2525
# if you find block sync has lower performance,you can try this settings
@@ -32,21 +32,21 @@ storage {
3232
#defaultL = {
3333
# maxOpenFiles = 1000
3434
#}
35-
# setting can impove leveldb performance .... end
35+
# setting can impove leveldb performance .... end, deprecated for arm
3636

3737
# Attention: name is a required field that must be set !!!
3838
properties = [
3939
// {
4040
// name = "account",
4141
// path = "storage_directory_test",
42-
// createIfMissing = true,
42+
// createIfMissing = true, // deprecated for arm start
4343
// paranoidChecks = true,
4444
// verifyChecksums = true,
4545
// compressionType = 1, // compressed with snappy
4646
// blockSize = 4096, // 4 KB = 4 * 1024 B
4747
// writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
4848
// cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
49-
// maxOpenFiles = 100
49+
// maxOpenFiles = 100 // deprecated for arm end
5050
// },
5151
// {
5252
// name = "account-index",

gradle/verification-metadata.xml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -569,35 +569,6 @@
569569
<sha256 value="cf8878e091c721ce2944d74979e9e38972019381781fcd6882f1562ba8d47e60" origin="Generated by Gradle"/>
570570
</artifact>
571571
</component>
572-
<component group="com.halibobor" name="leveldb" version="1.18.3">
573-
<artifact name="leveldb-1.18.3.jar">
574-
<sha256 value="0f722db29feb192377769555c73bc1a9bc6b81d31400957d596c645c957e45cc" origin="Generated by Gradle"/>
575-
</artifact>
576-
<artifact name="leveldb-1.18.3.pom">
577-
<sha256 value="4ae67f61cef4c5e2f460215f1b92832c5bc5a97c6c3d5b0219ddd20156143fd8" origin="Generated by Gradle"/>
578-
</artifact>
579-
</component>
580-
<component group="com.halibobor" name="leveldb-api" version="1.18.3">
581-
<artifact name="leveldb-api-1.18.3.jar">
582-
<sha256 value="3da4c1711f01e9087ca1cc58c55ac098d02c808d401d5595d084532ca227b101" origin="Generated by Gradle"/>
583-
</artifact>
584-
<artifact name="leveldb-api-1.18.3.pom">
585-
<sha256 value="825a008e567eb81d422581a567ba780b45a21ff0537e11d1fea9f49a3c332d33" origin="Generated by Gradle"/>
586-
</artifact>
587-
</component>
588-
<component group="com.halibobor" name="leveldb-project" version="1.18.3">
589-
<artifact name="leveldb-project-1.18.3.pom">
590-
<sha256 value="c908cfdc66a933a890ab0ae77ceb28676c995a9abbb15e4946a436ce1fc995b5" origin="Generated by Gradle"/>
591-
</artifact>
592-
</component>
593-
<component group="com.halibobor" name="leveldbjni-all" version="1.18.3">
594-
<artifact name="leveldbjni-all-1.18.3.jar">
595-
<sha256 value="83a72983b6a8e0b90449f7f1e9d56c9db54526288c21c93614c9c52b351fb232" origin="Generated by Gradle"/>
596-
</artifact>
597-
<artifact name="leveldbjni-all-1.18.3.pom">
598-
<sha256 value="2559bdc07dfda47215c6bad79a540566def47c2c110963e6e48402320530fd90" origin="Generated by Gradle"/>
599-
</artifact>
600-
</component>
601572
<component group="com.mchange" name="c3p0" version="0.9.5.4">
602573
<artifact name="c3p0-0.9.5.4.jar">
603574
<sha256 value="60cf2906cd6ad6771f514a3e848b74b3e3da99c1806f2a63c38e2dd8da5ef11f" origin="Generated by Gradle"/>

platform/build.gradle

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,15 @@ static def isX86() {
1010

1111
static def isArm64() {
1212
def arch = System.getProperty("os.arch").toLowerCase()
13-
return new Architectures.KnownArchitecture("arm64", "aarch64").isAlias(arch)
13+
return Architectures.AARCH64.isAlias(arch)
1414
}
1515

1616
if (isX86()) {
1717
ext {
18-
leveldbGroup = "org.fusesource.leveldbjni"
19-
leveldbName = "leveldbjni-all"
20-
leveldbVersion = "1.8"
2118
rocksDBVersion = "5.15.10"
2219
}
2320
} else if (isArm64()) {
2421
ext {
25-
leveldbGroup = "com.halibobor"
26-
leveldbName = "leveldbjni-all"
27-
leveldbVersion = "1.18.3"
2822
rocksDBVersion = "7.7.3"
2923
}
3024
} else {
@@ -45,8 +39,9 @@ sourceSets {
4539
}
4640

4741
dependencies {
48-
api group: leveldbGroup, name: leveldbName, version: leveldbVersion
42+
api group: 'org.fusesource.leveldbjni', name: 'leveldbjni-all', version: '1.8'
4943
api group: 'org.rocksdb', name: 'rocksdbjni', version: rocksDBVersion
44+
api 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
5045
}
5146

5247
tasks.withType(JavaCompile).configureEach {

platform/src/main/java/common/org/tron/common/arch/Arch.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@ public static boolean isArm64() {
5757
String osArch = getOsArch();
5858
return osArch.contains("arm64") || osArch.contains("aarch64");
5959
}
60+
61+
public static void throwUnsupportedArm64Exception() {
62+
if (isArm64()) {
63+
throw new UnsupportedOperationException("Unsupported OS: " + getOsArch());
64+
}
65+
}
6066
}

plugins/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This package contains a set of tools for TRON, the followings are the documentat
66

77
DB archive provides the ability to reformat the manifest according to the current `database`, parameters are compatible with the previous `ArchiveManifest`.
88

9+
### Note
10+
**Doesn't work for arm architecture.**
11+
912
### Available parameters:
1013

1114
- `-b | --batch-size`: Specify the batch manifest size, default: 80000.
@@ -30,6 +33,9 @@ DB archive provides the ability to reformat the manifest according to the curren
3033

3134
DB convert provides a helper which can convert LevelDB data to RocksDB data, parameters are compatible with previous `DBConvert`.
3235

36+
### Note
37+
**Not available for arm architecture.**
38+
3339
### Available parameters:
3440

3541
- `<src>`: Input path for leveldb, default: output-directory/database.
@@ -68,6 +74,9 @@ DB copy provides a helper which can copy LevelDB or RocksDB data quickly on the
6874

6975
DB lite provides lite database, parameters are compatible with previous `LiteFullNodeTool`.
7076

77+
### Note
78+
**Not available for arm architecture if database is LevelDB.**
79+
7180
### Available parameters:
7281

7382
- `-o | --operate`: [split,merge], default: split.
@@ -138,6 +147,9 @@ DB root provides a helper which can compute merkle root for tiny db.
138147

139148
NOTE: large db may GC overhead limit exceeded.
140149

150+
### Note
151+
**Not available for arm architecture if database is LevelDB.**
152+
141153
### Available parameters:
142154

143155
- `<src>`: Source path for database. Default: output-directory/database

0 commit comments

Comments
 (0)