Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements a record format with very high id limits
although iat the same time keeping store size increase to a minimum. Most record sizes are aligned to powers of two to be more page cache and cache line friendly. To support 50-bit IDs these pointers are compressed so that small IDs take less space than big ones in the records, whereas "null" references take only one bit. One "logical" record may span two physical records for records that have most of its IDs very big, such that one record isn't enough to hold all data. The new format is implemented as a separate format, not plugged in by default, but at least tested by RecordFormatTest. This commit also introduces InternalRecordFormatSelector which has a default (the current one) and ability to be configured to use any format by specifying RecordFormats (fully qualified) name pointing to a class implementing RecordFormats. With this a build can be set up to run with a custom format.
- Loading branch information
Showing
51 changed files
with
2,830 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
community/kernel/src/main/java/org/neo4j/kernel/impl/store/RecordPageLocationCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) 2002-2016 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.kernel.impl.store; | ||
|
||
/** | ||
* Calculates page ids and offset based on record ids. | ||
*/ | ||
public class RecordPageLocationCalculator | ||
{ | ||
/** | ||
* Calculates which page a record with the given {@code id} should go into. | ||
* | ||
* @param id record id | ||
* @param pageSize size of each page | ||
* @param recordSize size of each record | ||
* @return which page the record with the given {@code id} should go into, given the | ||
* {@code pageSize} and {@code recordSize}. | ||
*/ | ||
public static long pageIdForRecord( long id, int pageSize, int recordSize ) | ||
{ | ||
return id * recordSize / pageSize; | ||
} | ||
|
||
/** | ||
* Calculates which offset into the right page (had by {@link #pageIdForRecord(long, int, int)}) | ||
* the given {@code id} lives at. | ||
* | ||
* @param id record id | ||
* @param pageSize size of each page | ||
* @param recordSize size of each record | ||
* @return which offset into the right page the given {@code id} lives at, given the | ||
* {@code pageSize} and {@code recordSize}. | ||
*/ | ||
public static int offsetForId( long id, int pageSize, int recordSize ) | ||
{ | ||
return (int) (id * recordSize % pageSize); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.