[NC-1977] Provide a better error message when RocksDB reports an unsupported operation system/jvm combination (like 32bit Java on Windows). (#547)

Adrian Sutton 6 years ago committed by GitHub
parent f8482de9a2
commit 304ca107ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java
  2. 2
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/db/GenesisBlockMismatchTest.java
  3. 2
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  4. 20
      services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java
  5. 2
      util/src/main/java/tech/pegasys/pantheon/util/InvalidConfigurationException.java

@ -28,9 +28,9 @@ import tech.pegasys.pantheon.ethereum.core.BlockHeader;
import tech.pegasys.pantheon.ethereum.core.Hash;
import tech.pegasys.pantheon.ethereum.core.Transaction;
import tech.pegasys.pantheon.ethereum.core.TransactionReceipt;
import tech.pegasys.pantheon.ethereum.util.InvalidConfigurationException;
import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.util.InvalidConfigurationException;
import tech.pegasys.pantheon.util.Subscribers;
import tech.pegasys.pantheon.util.bytes.BytesValues;
import tech.pegasys.pantheon.util.uint.UInt256;

@ -24,10 +24,10 @@ import tech.pegasys.pantheon.ethereum.core.Hash;
import tech.pegasys.pantheon.ethereum.core.LogsBloomFilter;
import tech.pegasys.pantheon.ethereum.mainnet.MainnetBlockHashFunction;
import tech.pegasys.pantheon.ethereum.storage.keyvalue.KeyValueStoragePrefixedKeyBlockchainStorage;
import tech.pegasys.pantheon.ethereum.util.InvalidConfigurationException;
import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem;
import tech.pegasys.pantheon.services.kvstore.InMemoryKeyValueStorage;
import tech.pegasys.pantheon.services.kvstore.KeyValueStorage;
import tech.pegasys.pantheon.util.InvalidConfigurationException;
import tech.pegasys.pantheon.util.bytes.Bytes32;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import tech.pegasys.pantheon.util.uint.UInt256;

@ -38,11 +38,11 @@ import tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration;
import tech.pegasys.pantheon.ethereum.p2p.peers.DefaultPeer;
import tech.pegasys.pantheon.ethereum.p2p.peers.Peer;
import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration;
import tech.pegasys.pantheon.ethereum.util.InvalidConfigurationException;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration;
import tech.pegasys.pantheon.metrics.prometheus.PrometheusMetricsSystem;
import tech.pegasys.pantheon.util.BlockImporter;
import tech.pegasys.pantheon.util.InvalidConfigurationException;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.File;

@ -16,6 +16,7 @@ import tech.pegasys.pantheon.metrics.Counter;
import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.metrics.OperationTimer;
import tech.pegasys.pantheon.util.InvalidConfigurationException;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.Closeable;
@ -54,15 +55,26 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable {
private final OperationTimer commitLatency;
private final Counter rollbackCount;
static {
RocksDB.loadLibrary();
}
public static KeyValueStorage create(
final Path storageDirectory, final MetricsSystem metricsSystem) throws StorageException {
loadNativeLibrary();
return new RocksDbKeyValueStorage(storageDirectory, metricsSystem);
}
private static void loadNativeLibrary() {
try {
RocksDB.loadLibrary();
} catch (final ExceptionInInitializerError e) {
if (e.getCause() instanceof UnsupportedOperationException) {
LOG.info("Unable to load RocksDB library", e);
throw new InvalidConfigurationException(
"Unsupported platform detected. On Windows, ensure you have 64bit Java installed.");
} else {
throw e;
}
}
}
private RocksDbKeyValueStorage(final Path storageDirectory, final MetricsSystem metricsSystem) {
try {
options = new Options().setCreateIfMissing(true);

@ -10,7 +10,7 @@
* 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 tech.pegasys.pantheon.ethereum.util;
package tech.pegasys.pantheon.util;
public class InvalidConfigurationException extends IllegalArgumentException {
public InvalidConfigurationException(final String message) {
Loading…
Cancel
Save