From 16634d41d3ba2084be366731f45b4313feaaacc3 Mon Sep 17 00:00:00 2001 From: MishaDemianenko Date: Tue, 26 Sep 2017 12:48:15 +0200 Subject: [PATCH] HighLimitFormatSettings as reference of HighLimit format settings Introduce HighLimitFormatSettings, move all of the max ids definition to new settings class, update high limit format to reference new constants instead. Rename constants in HighLimitFormatSettings and StandardFormatSettings to not include "record" word in all of the constant names. --- .../format/standard/DynamicRecordFormat.java | 2 +- .../format/standard/NodeRecordFormat.java | 2 +- .../format/standard/PropertyRecordFormat.java | 2 +- .../standard/StandardFormatSettings.java | 10 ++-- .../highlimit/BaseHighLimitRecordFormat.java | 4 +- .../format/highlimit/DynamicRecordFormat.java | 2 +- .../store/format/highlimit/HighLimit.java | 5 -- .../highlimit/HighLimitFormatSettings.java | 52 +++++++++++++++++++ .../format/highlimit/NodeRecordFormat.java | 2 +- .../highlimit/PropertyRecordFormat.java | 2 +- .../RelationshipGroupRecordFormat.java | 2 +- .../highlimit/RelationshipRecordFormat.java | 2 +- .../BaseHighLimitRecordFormatTest.java | 2 +- 13 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/HighLimitFormatSettings.java diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/DynamicRecordFormat.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/DynamicRecordFormat.java index 7ddd5b6b05f91..024d5b2cbe6b3 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/DynamicRecordFormat.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/DynamicRecordFormat.java @@ -37,7 +37,7 @@ public class DynamicRecordFormat extends BaseOneByteHeaderRecordFormat public NodeRecordFormat() { - super( fixedRecordSize( RECORD_SIZE ), 0, IN_USE_BIT, StandardFormatSettings.NODE_RECORD_MAXIMUM_ID_BITS ); + super( fixedRecordSize( RECORD_SIZE ), 0, IN_USE_BIT, StandardFormatSettings.NODE_MAXIMUM_ID_BITS ); } @Override diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/PropertyRecordFormat.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/PropertyRecordFormat.java index ce6168835336c..c19a9401a91dc 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/PropertyRecordFormat.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/PropertyRecordFormat.java @@ -40,7 +40,7 @@ public class PropertyRecordFormat extends BaseRecordFormat public PropertyRecordFormat() { - super( fixedRecordSize( RECORD_SIZE ), 0, StandardFormatSettings.PROPERTY_RECORD_MAXIMUM_ID_BITS ); + super( fixedRecordSize( RECORD_SIZE ), 0, StandardFormatSettings.PROPERTY_MAXIMUM_ID_BITS ); } @Override diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/StandardFormatSettings.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/StandardFormatSettings.java index 46a7d362f5143..bdac58c64fa8c 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/StandardFormatSettings.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/format/standard/StandardFormatSettings.java @@ -25,12 +25,12 @@ public final class StandardFormatSettings { public static final int PROPERTY_TOKEN_MAXIMUM_ID_BITS = 24; - static final int NODE_RECORD_MAXIMUM_ID_BITS = 35; + static final int NODE_MAXIMUM_ID_BITS = 35; static final int RELATIONSHIP_MAXIMUM_ID_BITS = 35; - static final int PROPERTY_RECORD_MAXIMUM_ID_BITS = 36; - static final int DYNAMIC_RECORD_MAXIMUM_ID_BITS = 36; - static final int LABEL_TOKEN_MAXIMUM_ID_BITS = 32; - static final int RELATIONSHIP_TYPE_TOKEN_MAXIMUM_ID_BITS = 16; + static final int PROPERTY_MAXIMUM_ID_BITS = 36; + public static final int DYNAMIC_MAXIMUM_ID_BITS = 36; + public static final int LABEL_TOKEN_MAXIMUM_ID_BITS = 32; + public static final int RELATIONSHIP_TYPE_TOKEN_MAXIMUM_ID_BITS = 16; static final int RELATIONSHIP_GROUP_MAXIMUM_ID_BITS = 35; private StandardFormatSettings() diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/BaseHighLimitRecordFormat.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/BaseHighLimitRecordFormat.java index 6a915c0e2f55d..fb30c7f395081 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/BaseHighLimitRecordFormat.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/BaseHighLimitRecordFormat.java @@ -97,9 +97,9 @@ abstract class BaseHighLimitRecordFormat static final int HEADER_BIT_FIRST_RECORD_UNIT = 0b0000_0100; static final int HEADER_BIT_FIXED_REFERENCE = 0b0000_0100; - protected BaseHighLimitRecordFormat( Function recordSize, int recordHeaderSize ) + protected BaseHighLimitRecordFormat( Function recordSize, int recordHeaderSize, int maxIdBits ) { - super( recordSize, recordHeaderSize, IN_USE_BIT, HighLimit.DEFAULT_MAXIMUM_BITS_PER_ID ); + super( recordSize, recordHeaderSize, IN_USE_BIT, maxIdBits ); } public void read( RECORD record, PageCursor primaryCursor, RecordLoad mode, int recordSize ) diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/DynamicRecordFormat.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/DynamicRecordFormat.java index 4f05f1a8374b7..54768ef0a6c3b 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/DynamicRecordFormat.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/DynamicRecordFormat.java @@ -51,7 +51,7 @@ public class DynamicRecordFormat extends BaseOneByteHeaderRecordFormat. + */ +package org.neo4j.kernel.impl.store.format.highlimit; + +import org.neo4j.kernel.impl.store.format.standard.StandardFormatSettings; + +/** + * Reference class for high limit format settings. + * + * @see HighLimit + */ +public class HighLimitFormatSettings +{ + /** + * Default maximum number of bits that can be used to represent id + */ + static final int DEFAULT_MAXIMUM_BITS_PER_ID = 50; + + static final int PROPERTY_MAXIMUM_ID_BITS = DEFAULT_MAXIMUM_BITS_PER_ID; + static final int NODE_MAXIMUM_ID_BITS = DEFAULT_MAXIMUM_BITS_PER_ID; + static final int RELATIONSHIP_MAXIMUM_ID_BITS = DEFAULT_MAXIMUM_BITS_PER_ID; + static final int RELATIONSHIP_GROUP_MAXIMUM_ID_BITS = DEFAULT_MAXIMUM_BITS_PER_ID; + static final int DYNAMIC_MAXIMUM_ID_BITS = DEFAULT_MAXIMUM_BITS_PER_ID; + + @SuppressWarnings( "unused" ) + static final int PROPERTY_TOKEN_MAXIMUM_ID_BITS = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; + @SuppressWarnings( "unused" ) + static final int LABEL_TOKEN_MAXIMUM_ID_BITS = StandardFormatSettings.LABEL_TOKEN_MAXIMUM_ID_BITS; + @SuppressWarnings( "unused" ) + static final int RELATIONSHIP_TYPE_TOKEN_MAXIMUM_ID_BITS = StandardFormatSettings.RELATIONSHIP_TYPE_TOKEN_MAXIMUM_ID_BITS; + + private HighLimitFormatSettings() + { + } +} diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/NodeRecordFormat.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/NodeRecordFormat.java index e02c44a51b46e..deca36ea037a1 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/NodeRecordFormat.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/NodeRecordFormat.java @@ -74,7 +74,7 @@ class NodeRecordFormat extends BaseHighLimitRecordFormat NodeRecordFormat( int recordSize ) { - super( fixedRecordSize( recordSize ), 0 ); + super( fixedRecordSize( recordSize ), 0, HighLimitFormatSettings.NODE_MAXIMUM_ID_BITS ); } @Override diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/PropertyRecordFormat.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/PropertyRecordFormat.java index 9ae8c65fbf4ab..3238489684c56 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/PropertyRecordFormat.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/PropertyRecordFormat.java @@ -81,7 +81,7 @@ class PropertyRecordFormat extends BaseOneByteHeaderRecordFormat protected PropertyRecordFormat() { - super( fixedRecordSize( RECORD_SIZE ), 0, IN_USE_BIT, HighLimit.DEFAULT_MAXIMUM_BITS_PER_ID ); + super( fixedRecordSize( RECORD_SIZE ), 0, IN_USE_BIT, HighLimitFormatSettings.PROPERTY_MAXIMUM_ID_BITS ); } @Override diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/RelationshipGroupRecordFormat.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/RelationshipGroupRecordFormat.java index fc03829853863..a5586f0d6d85c 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/RelationshipGroupRecordFormat.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/store/format/highlimit/RelationshipGroupRecordFormat.java @@ -85,7 +85,7 @@ class RelationshipGroupRecordFormat extends BaseHighLimitRecordFormat protected MyRecordFormat() { - super( header -> 4, 4 ); + super( header -> 4, 4, HighLimitFormatSettings.DEFAULT_MAXIMUM_BITS_PER_ID ); } @Override