@Override public String getDefaultValue() { return default_listen_address.getDefaultValue() + ":" + defaultPort; }
@Override public String getDefaultValue() { return newSetting.getDefaultValue(); }
@Override public String getDefaultValue() { return s.getDefaultValue(); }
/** * @return number of relationships threshold for considering a node dense. */ default int denseNodeThreshold() { return Integer.parseInt( dense_node_threshold.getDefaultValue() ); }
@Override public String getDefaultValue() { return default_advertised_address.getDefaultValue() + ":" + LISTEN_SOCKET_ADDRESS.apply( listenAddressSetting.getDefaultValue() ).socketAddress().getPort(); }
@Override public String forUriPath() { return ServerSettings.rest_api_path.getDefaultValue(); }
@Override public void setValueWithOldSetting( String value, Map<String,String> rawConfiguration ) { if ( StringUtils.isNotEmpty( value ) ) { String oldSettingDefaultValue = GraphDatabaseSettings.index_sampling_buffer_size.getDefaultValue(); Long newValue = oldSettingDefaultValue.equals( value ) ? ByteUnit.mebiBytes( 8 ) : Settings.BYTES.apply( value ); rawConfiguration.put( "dbms.index_sampling.sample_size_limit", String.valueOf( newValue ) ); } } } );
private static void configureIntegerSetting( Config config, Setting<Integer> setting, int fullBlockSize, int headerSize, Map<String,String> formatConfig ) { Integer defaultValue = Integer.parseInt( setting.getDefaultValue() ); int propertyValue = config.get( setting ); if ( propertyValue == defaultValue ) { int updatedBlockSize = fullBlockSize - headerSize; if ( updatedBlockSize != propertyValue ) { if ( updatedBlockSize < MINIMAL_BLOCK_SIZE ) { throw new IllegalArgumentException( "Block size should be bigger then " + MINIMAL_BLOCK_SIZE ); } addFormatSetting( formatConfig, setting, updatedBlockSize ); } } }
public static String getRelativePath( File folder, Setting<File> setting ) { return folder.toPath().resolve( setting.getDefaultValue() ).toString(); }
private static ZoneId logZoneIdFrom( Map<String,String> config ) { String dbTimeZone = config.getOrDefault( db_timezone.name(), db_timezone.getDefaultValue() ); return LogTimeZone.valueOf( dbTimeZone ).getZoneId(); }
@Parameterized.Parameters( name = "{index} denseNodeThreshold={0}" ) public static Collection<Integer> data() { return Arrays.asList( 5, parseInt( GraphDatabaseSettings.dense_node_threshold.getDefaultValue() ) ); }
@Parameterized.Parameters( name = "denseNodeThreshold={0}" ) public static Collection<Object[]> data() { Collection<Object[]> data = new ArrayList<>(); int max = parseInt( GraphDatabaseSettings.dense_node_threshold.getDefaultValue() ); for ( int i = 1; i < max; i++ ) { data.add( new Object[] {i} ); } return data; }
@Before public void before() { fs = new DefaultFileSystemAbstraction(); defaultThreshold = parseInt( GraphDatabaseSettings.dense_node_threshold.getDefaultValue() ); }
return Integer.parseInt( GraphDatabaseSettings.label_block_size.getDefaultValue() ) + DynamicRecordFormat.RECORD_HEADER_SIZE;
@Test public void failStoreInitializationWhenHeaderRecordCantBeRead() throws IOException { File storeFile = dir.file( "a" ); File idFile = dir.file( "idFile" ); PageCache pageCache = mock( PageCache.class ); PagedFile pagedFile = mock( PagedFile.class ); PageCursor pageCursor = mock( PageCursor.class ); when( pageCache.map( eq( storeFile ), anyInt(), any( OpenOption.class ) ) ).thenReturn( pagedFile ); when( pagedFile.io( 0L, PagedFile.PF_SHARED_READ_LOCK ) ).thenReturn( pageCursor ); when( pageCursor.next() ).thenReturn( false ); RecordFormats recordFormats = Standard.LATEST_RECORD_FORMATS; expectedException.expect( StoreNotFoundException.class ); expectedException.expectMessage( "Fail to read header record of store file: " + storeFile.getAbsolutePath() ); try ( DynamicArrayStore dynamicArrayStore = new DynamicArrayStore( storeFile, idFile, config, IdType.NODE_LABELS, idGeneratorFactory, pageCache, NullLogProvider.getInstance(), Settings.INTEGER.apply( GraphDatabaseSettings.label_block_size.getDefaultValue() ), recordFormats ) ) { dynamicArrayStore.initialise( false ); } }
@Test public void shouldGetDefaultPropertyByKey() throws Exception { // GIVEN Config config = Config.defaults(); ConfigAdapter wrappingConfiguration = new ConfigAdapter( config ); // WHEN final Object propertyValue = wrappingConfiguration.getProperty( ServerSettings.rest_api_path.name() ); // THEN assertEquals( new URI( ServerSettings.rest_api_path.getDefaultValue() ), propertyValue ); }
@Test public void shouldGetPropertyInRightFormat() throws Exception { // GIVEN Config config = Config.defaults(); ConfigAdapter wrappingConfiguration = new ConfigAdapter( config ); // WHEN wrappingConfiguration .setProperty( ServerSettings.rest_api_path.name(), "http://localhost:7474///db///data///" ); final Object dataPath = wrappingConfiguration.getProperty( ServerSettings.rest_api_path.name() ); // THEN assertEquals( new URI( ServerSettings.rest_api_path.getDefaultValue() ), dataPath ); }
@Test public void shouldCalculateCorrectEstimatesOnEmptyData() throws Exception { // given Groups groups = new Groups(); Collection<DataFactory> nodeData = asList( generateData( defaultFormatNodeFileHeader(), new MutableLong(), 0, 0, ":ID", "nodes-1.csv", groups ) ); Collection<DataFactory> relationshipData = asList( generateData( defaultFormatRelationshipFileHeader(), new MutableLong(), 0, 0, ":START_ID,:TYPE,:END_ID", "rels-1.csv", groups ) ); Input input = new CsvInput( nodeData, defaultFormatNodeFileHeader(), relationshipData, defaultFormatRelationshipFileHeader(), IdType.INTEGER, COMMAS, Collector.EMPTY, groups ); // when Input.Estimates estimates = input.calculateEstimates( new PropertyValueRecordSizeCalculator( LATEST_RECORD_FORMATS.property().getRecordSize( NO_STORE_HEADER ), parseInt( GraphDatabaseSettings.string_block_size.getDefaultValue() ), 0, parseInt( GraphDatabaseSettings.array_block_size.getDefaultValue() ), 0 ) ); // then assertEquals( 0, estimates.numberOfNodes() ); assertEquals( 0, estimates.numberOfRelationships() ); assertEquals( 0, estimates.numberOfRelationshipProperties() ); assertEquals( 0, estimates.numberOfNodeProperties() ); assertEquals( 0, estimates.numberOfNodeLabels() ); }
Integer.parseInt( GraphDatabaseSettings.dense_node_threshold.getDefaultValue() ) + 1 // We must be over the dense node threshold for the bug to manifest
Input.Estimates estimates = input.calculateEstimates( new PropertyValueRecordSizeCalculator( format.property().getRecordSize( NO_STORE_HEADER ), parseInt( GraphDatabaseSettings.string_block_size.getDefaultValue() ), 0, parseInt( GraphDatabaseSettings.array_block_size.getDefaultValue() ), 0 ) );