Skip to content

Commit

Permalink
Rename Busted format to HighLimit format
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Feb 15, 2016
1 parent b347cb2 commit a8ee0d0
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 43 deletions.
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;
import java.util.function.Function;
Expand All @@ -26,20 +26,20 @@
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.kernel.impl.store.StoreHeader;
import org.neo4j.kernel.impl.store.format.BaseOneByteHeaderRecordFormat;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.id.IdSequence;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.kernel.impl.store.record.Record;

import static org.neo4j.kernel.impl.store.RecordPageLocationCalculator.offsetForId;
import static org.neo4j.kernel.impl.store.RecordPageLocationCalculator.pageIdForRecord;
import static org.neo4j.kernel.impl.store.format.busted.Reference.PAGE_CURSOR_ADAPTER;
import static org.neo4j.kernel.impl.store.format.highlimit.Reference.PAGE_CURSOR_ADAPTER;

/**
* Base class for record format which utilizes dynamically sized references to other record IDs and with ability
* to use record units, meaning that a record may span two physical records in the store. This to keep store size
* low and only have records that have big references occupy double amount of space. This format supports up to
* 58-bit IDs, which is roughly 280 quadrillion. With that size the ID limits can be considered busted,
* 58-bit IDs, which is roughly 280 quadrillion. With that size the ID limits can be considered highlimit,
* hence the format name. The IDs take up between 3-8B depending on the size of the ID where relative ID
* references are used as often as possible. See {@link Reference}.
*
Expand Down Expand Up @@ -75,14 +75,14 @@
*
* @param <RECORD> type of {@link AbstractBaseRecord}
*/
abstract class BaseBustedRecordFormat<RECORD extends AbstractBaseRecord>
abstract class BaseHighLimitRecordFormat<RECORD extends AbstractBaseRecord>
extends BaseOneByteHeaderRecordFormat<RECORD>
{
static final long NULL = Record.NULL_REFERENCE.intValue();
static final int HEADER_BIT_RECORD_UNIT = 0b0000_0010;
static final int HEADER_BIT_FIRST_RECORD_UNIT = 0b0000_0100;

protected BaseBustedRecordFormat( Function<StoreHeader,Integer> recordSize, int recordHeaderSize )
protected BaseHighLimitRecordFormat( Function<StoreHeader,Integer> recordSize, int recordHeaderSize )
{
super( recordSize, recordHeaderSize, IN_USE_BIT );
}
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;
import org.neo4j.io.pagecache.PageCursor;
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import org.neo4j.kernel.impl.store.format.RecordFormat;
import org.neo4j.kernel.impl.store.format.RecordFormats;
Expand All @@ -34,19 +34,19 @@
import org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord;

/**
* Record format with very high limits, 58-bit per ID, while at the same time keeping store size small.
* Record format with very high limits, 50-bit per ID, while at the same time keeping store size small.
*
* @see BaseBustedRecordFormat
* @see BaseHighLimitRecordFormat
*/
public class Busted implements RecordFormats
public class HighLimit implements RecordFormats
{
public static final RecordFormats RECORD_FORMATS = new Busted();
public static final RecordFormats RECORD_FORMATS = new HighLimit();

@Override
public String storeVersion()
{
// Community.Busted.Zero
return "vC.B.0";
// Community.HighLimit.Zero
return "vC.H.0";
}

@Override
Expand Down
Expand Up @@ -17,16 +17,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;

import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.record.NodeRecord;
import org.neo4j.kernel.impl.store.record.Record;

class NodeRecordFormat extends BaseBustedRecordFormat<NodeRecord>
class NodeRecordFormat extends BaseHighLimitRecordFormat<NodeRecord>
{
private static final long NULL_LABELS = Record.NO_LABELS_FIELD.intValue();
private static final int RECORD_SIZE = 16;
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;
import org.neo4j.io.pagecache.PageCursor;
Expand All @@ -26,7 +26,7 @@
import org.neo4j.kernel.impl.store.record.PropertyBlock;
import org.neo4j.kernel.impl.store.record.PropertyRecord;

import static org.neo4j.kernel.impl.store.format.busted.Reference.PAGE_CURSOR_ADAPTER;
import static org.neo4j.kernel.impl.store.format.highlimit.Reference.PAGE_CURSOR_ADAPTER;

/**
* {@link PropertyRecord} format which currently has some wasted space in the end due to hard coded
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;

Expand Down
Expand Up @@ -17,14 +17,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord;

class RelationshipGroupRecordFormat extends BaseBustedRecordFormat<RelationshipGroupRecord>
class RelationshipGroupRecordFormat extends BaseHighLimitRecordFormat<RelationshipGroupRecord>
{
private static final int RECORD_SIZE = 32;
private static final int HAS_OUTGOING_BIT = 0b0000_1000;
Expand Down
Expand Up @@ -17,14 +17,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.record.RelationshipRecord;

class RelationshipRecordFormat extends BaseBustedRecordFormat<RelationshipRecord>
class RelationshipRecordFormat extends BaseHighLimitRecordFormat<RelationshipRecord>
{
private static final int RECORD_SIZE = 32;
private static final int FIRST_IN_START_BIT = 0b0000_1000;
Expand Down
Expand Up @@ -17,14 +17,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;

import org.neo4j.io.pagecache.PageCursor;

/**
* Used in {@link Busted} record format where records may required multiple units, which mean writing and
* Used in {@link HighLimit} record format where records may required multiple units, which mean writing and
* reading may require, from one byte to the next, move to another place or cursor to read from or write to.
* Encapsulates logic for checking for consistent reads and repositioning for next retry.
*/
Expand Down
Expand Up @@ -17,13 +17,13 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;

import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;

/**
* {@link DataAdapter} able to acquire a secondary {@link PageCursor} on potentially a different page
Expand Down Expand Up @@ -59,10 +59,10 @@ public byte get( PageCursor primaryCursor /*same as the one we have*/ )
{
// Just read out the header, get it out of the way and verify that this secondary record
// is in fact a secondary record.
// TODO can we do this in BaseBustedRecordFormat (the place where this adapter is created) instead?
// TODO can we do this in BaseHighLimitRecordFormat (the place where this adapter is created) instead?
byte secondaryHeaderByte = secondaryCursor.getByte();
assert (secondaryHeaderByte & BaseBustedRecordFormat.HEADER_BIT_RECORD_UNIT) != 0;
assert (secondaryHeaderByte & BaseBustedRecordFormat.HEADER_BIT_FIRST_RECORD_UNIT) == 0;
assert (secondaryHeaderByte & BaseHighLimitRecordFormat.HEADER_BIT_RECORD_UNIT) != 0;
assert (secondaryHeaderByte & BaseHighLimitRecordFormat.HEADER_BIT_FIRST_RECORD_UNIT) == 0;
switched = true;
}
return secondaryCursor.getByte();
Expand Down
Expand Up @@ -17,16 +17,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import java.io.IOException;

import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.impl.store.UnderlyingStorageException;
import org.neo4j.kernel.impl.store.format.busted.Reference.DataAdapter;
import org.neo4j.kernel.impl.store.format.highlimit.Reference.DataAdapter;

import static org.neo4j.kernel.impl.store.format.BaseRecordFormat.IN_USE_BIT;
import static org.neo4j.kernel.impl.store.format.busted.BaseBustedRecordFormat.HEADER_BIT_RECORD_UNIT;
import static org.neo4j.kernel.impl.store.format.highlimit.BaseHighLimitRecordFormat.HEADER_BIT_RECORD_UNIT;

/**
* {@link DataAdapter} able to move the {@link PageCursor} to another record, potentially on another page,
Expand Down
Expand Up @@ -19,15 +19,15 @@
*/
package org.neo4j.kernel.impl.store.format;

import org.neo4j.kernel.impl.store.format.busted.Busted;
import org.neo4j.kernel.impl.store.format.highlimit.HighLimit;

public class BustedRecordFormatTest extends RecordFormatTest
public class HighLimitRecordFormatTest extends RecordFormatTest
{
protected static final RecordGenerators _58_BIT_LIMITS = new LimitedRecordGenerators( random, 58, 58, 58, 16, NULL );
protected static final RecordGenerators _50_BIT_LIMITS = new LimitedRecordGenerators( random, 50, 50, 50, 16, NULL );

public BustedRecordFormatTest()
public HighLimitRecordFormatTest()
{
super( Busted.RECORD_FORMATS, _50_BIT_LIMITS );
super( HighLimit.RECORD_FORMATS, _50_BIT_LIMITS );
}
}
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format.busted;
package org.neo4j.kernel.impl.store.format.highlimit;

import org.junit.Rule;
import org.junit.Test;
Expand All @@ -26,12 +26,11 @@
import java.nio.ByteBuffer;

import org.neo4j.io.pagecache.StubPageCursor;
import org.neo4j.kernel.impl.store.format.busted.Reference;
import org.neo4j.test.RandomRule;

import static org.junit.Assert.assertEquals;

import static org.neo4j.kernel.impl.store.format.busted.Reference.PAGE_CURSOR_ADAPTER;
import static org.neo4j.kernel.impl.store.format.highlimit.Reference.PAGE_CURSOR_ADAPTER;

public class ReferenceTest
{
Expand Down

0 comments on commit a8ee0d0

Please sign in to comment.