Java Code Examples for org.apache.ignite.configuration.BinaryConfiguration#setCompactFooter()

The following examples show how to use org.apache.ignite.configuration.BinaryConfiguration#setCompactFooter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteTestConfigurationBuilder.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 2
Source File: IgniteModuleMemberRegistrationIT.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 3
Source File: TcpClientDiscoveryMarshallerCheckSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (testFooter) {
        cfg.setMarshaller(new BinaryMarshaller());

        TcpDiscoverySpi spi = new TcpDiscoverySpi();

        spi.setJoinTimeout(-1); // IGNITE-605, and further tests limitation bypass

        cfg.setDiscoverySpi(spi);

        if (igniteInstanceName.endsWith("0")) {
            BinaryConfiguration bc = new BinaryConfiguration();
            bc.setCompactFooter(false);

            cfg.setBinaryConfiguration(bc);
            cfg.setClientMode(true);
        }
    }
    else {
        if (igniteInstanceName.endsWith("0"))
            cfg.setMarshaller(new JdkMarshaller());
        else {
            cfg.setClientMode(true);
            cfg.setMarshaller(new BinaryMarshaller());
        }
    }

    return cfg;
}
 
Example 4
Source File: IgniteWalRecoverySeveralRestartsTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(cacheName);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
    ccfg.setIndexedTypes(Integer.class, IndexedObject.class);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4)); // 64 per node
    ccfg.setReadFromBackup(true);

    cfg.setCacheConfiguration(ccfg);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(500L * 1024 * 1024).setPersistenceEnabled(true))
        .setWalMode(WALMode.LOG_ONLY)
        .setPageSize(PAGE_SIZE);

    cfg.setDataStorageConfiguration(memCfg);

    cfg.setMarshaller(null);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}
 
Example 5
Source File: BinaryMarshallerSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @return Binary marshaller.
 */
protected BinaryMarshaller binaryMarshaller(
    BinaryNameMapper nameMapper,
    BinaryIdMapper mapper,
    BinarySerializer serializer,
    Collection<BinaryTypeConfiguration> cfgs,
    Collection<String> excludedClasses
) throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(nameMapper);
    bCfg.setIdMapper(mapper);
    bCfg.setSerializer(serializer);
    bCfg.setCompactFooter(compactFooter());

    bCfg.setTypeConfigurations(cfgs);

    iCfg.setBinaryConfiguration(bCfg);
    iCfg.setClientMode(false);
    iCfg.setDiscoverySpi(new TcpDiscoverySpi() {
        @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
            //No-op.
        }
    });
    iCfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());

    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());

    BinaryMarshaller marsh = new BinaryMarshaller();

    MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null, excludedClasses);

    GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);

    kernCtx.add(new GridSystemViewManager(kernCtx));
    kernCtx.add(new GridDiscoveryManager(kernCtx));

    marshCtx.onMarshallerProcessorStarted(kernCtx, null);

    marsh.setContext(marshCtx);

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);

    return marsh;
}
 
Example 6
Source File: BinaryFooterOffsetsAbstractSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
    super.beforeTest();

    ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());

    marsh = new BinaryMarshaller();

    IgniteConfiguration iCfg = new IgniteConfiguration();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));

    bCfg.setCompactFooter(compactFooter());

    iCfg.setBinaryConfiguration(bCfg);

    marsh.setContext(new MarshallerContextTestImpl(null));

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
}
 
Example 7
Source File: BinaryObjectBuilderAdditionalSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cacheCfg.setCacheMode(REPLICATED);

    CacheConfiguration cacheCfg2 = new CacheConfiguration("partitioned");
    cacheCfg2.setCacheMode(PARTITIONED);

    cfg.setCacheConfiguration(cacheCfg, cacheCfg2);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setCompactFooter(compactFooter());

    bCfg.setClassNames(Arrays.asList("org.apache.ignite.internal.binary.mutabletest.*"));

    cfg.setMarshaller(new BinaryMarshaller());

    return cfg;
}
 
Example 8
Source File: IgnitePdsTransactionsHangTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    BinaryConfiguration binaryCfg = new BinaryConfiguration();
    binaryCfg.setCompactFooter(false);
    cfg.setBinaryConfiguration(binaryCfg);

    cfg.setPeerClassLoadingEnabled(true);

    TcpCommunicationSpi tcpCommSpi = new TcpCommunicationSpi();

    tcpCommSpi.setSharedMemoryPort(-1);
    cfg.setCommunicationSpi(tcpCommSpi);

    TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);

    cfg.setTransactionConfiguration(txCfg);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(PAGE_CACHE_SIZE);
    memPlcCfg.setMaxSize(PAGE_CACHE_SIZE);
    memPlcCfg.setPersistenceEnabled(true);

    DataStorageConfiguration memCfg = new DataStorageConfiguration();

    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    memCfg.setWalHistorySize(1);
    memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
    memCfg.setPageSize(PAGE_SIZE);

    cfg.setDataStorageConfiguration(memCfg);

    return cfg;
}
 
Example 9
Source File: IgnitePdsCacheIntegrationTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true))
        .setWalMode(WALMode.LOG_ONLY)
        .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);

    cfg.setDataStorageConfiguration(memCfg);

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);

    ccfg.setIndexedTypes(Integer.class, DbValue.class);

    ccfg.setRebalanceMode(CacheRebalanceMode.NONE);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    cfg.setCacheConfiguration(ccfg);

    cfg.setMarshaller(null);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(bCfg);

    return cfg;
}
 
Example 10
Source File: IgnitePdsNoActualWalHistoryTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    cfg.setCacheConfiguration(ccfg);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(4 * 1024);

    cfg.setDataStorageConfiguration(dbCfg);

    dbCfg.setWalSegmentSize(4 * 1024 * 1024)
        .setWalHistorySize(2)
        .setWalSegments(10)
        .setWalMode(WALMode.LOG_ONLY)
        .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
            .setMaxSize(100L * 1024 * 1024)
            .setPersistenceEnabled(true));

    cfg.setMarshaller(null);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}
 
Example 11
Source File: IgnitePdsMultiNodePutGetRestartTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setClusterStateOnStart(ClusterState.INACTIVE);

    cfg.setConsistentId(gridName);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true))
        .setWalMode(WALMode.LOG_ONLY).setWalSegmentSize(4 * 1024 * 1024);

    cfg.setDataStorageConfiguration(memCfg);

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);

    ccfg.setIndexedTypes(Integer.class, DbValue.class);

    ccfg.setRebalanceMode(CacheRebalanceMode.NONE);

    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cfg.setCacheConfiguration(ccfg);

    cfg.setMarshaller(null);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(bCfg);

    return cfg;
}
 
Example 12
Source File: BinaryFieldsAbstractSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * Create marshaller.
 *
 * @return Binary marshaller.
 * @throws Exception If failed.
 */
protected BinaryMarshaller createMarshaller() throws Exception {
    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(),
        new NullLogger());

    BinaryMarshaller marsh = new BinaryMarshaller();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setCompactFooter(compactFooter());

    bCfg.setTypeConfigurations(Arrays.asList(
        new BinaryTypeConfiguration(TestObject.class.getName()),
        new BinaryTypeConfiguration(TestOuterObject.class.getName()),
        new BinaryTypeConfiguration(TestInnerObject.class.getName())
    ));

    IgniteConfiguration iCfg = new IgniteConfiguration();

    iCfg.setBinaryConfiguration(bCfg);

    marsh.setContext(new MarshallerContextTestImpl(null));

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);

    return marsh;
}
 
Example 13
Source File: IgniteWalRecoveryTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    CacheConfiguration<Integer, IndexedObject> ccfg = renamed ?
        new CacheConfiguration<>(RENAMED_CACHE_NAME) : new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
    ccfg.setNodeFilter(new RemoteNodeFilter());
    ccfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Integer, IndexedObject> locCcfg = new CacheConfiguration<>(LOC_CACHE_NAME);
    locCcfg.setCacheMode(CacheMode.LOCAL);
    locCcfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Object, Object> cfg1 = new CacheConfiguration<>("cache1")
        .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
        .setAffinity(new RendezvousAffinityFunction(false, 32))
        .setCacheMode(CacheMode.PARTITIONED)
        .setRebalanceMode(CacheRebalanceMode.SYNC)
        .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
        .setBackups(0);

    CacheConfiguration<Object, Object> cfg2 = new CacheConfiguration<>(cfg1).setName("cache2").setRebalanceOrder(10);

    cfg.setCacheConfiguration(ccfg, locCcfg, cfg1, cfg2);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(4 * 1024);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(256L * 1024 * 1024);
    memPlcCfg.setMaxSize(256L * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);

    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);

    dbCfg.setWalHistorySize(2);

    if (logOnly)
        dbCfg.setWalMode(WALMode.LOG_ONLY);

    if (walSegmentSize != 0)
        dbCfg.setWalSegmentSize(walSegmentSize);

    dbCfg.setWalSegments(walSegments);

    dbCfg.setWalPageCompression(walPageCompression);

    dbCfg.setCheckpointFrequency(checkpointFrequency);

    cfg.setDataStorageConfiguration(dbCfg);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    if (!getTestIgniteInstanceName(0).equals(gridName))
        cfg.setUserAttributes(F.asMap(HAS_CACHE, true));

    if (customFailureDetectionTimeout > 0)
        cfg.setFailureDetectionTimeout(customFailureDetectionTimeout);

    return cfg;
}
 
Example 14
Source File: IgniteWalRecoveryPPCTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME_1);

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    cfg.setCacheConfiguration(ccfg);

    CacheConfiguration<Integer, IndexedObject> ccfg2 = new CacheConfiguration<>(CACHE_NAME_2);

    ccfg2.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg2.setDataRegionName(MEM_PLC_NO_PDS);

    cfg.setCacheConfiguration(ccfg, ccfg2);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();
    dbCfg.setPageSize(4 * 1024);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
    memPlcCfg.setInitialSize(256L * 1024 * 1024);
    memPlcCfg.setMaxSize(256L * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);

    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    DataRegionConfiguration memPlcCfg2 = new DataRegionConfiguration();
    memPlcCfg2.setName(MEM_PLC_NO_PDS);
    memPlcCfg2.setInitialSize(256L * 1024 * 1024);
    memPlcCfg2.setMaxSize(256L * 1024 * 1024);
    memPlcCfg2.setPersistenceEnabled(false);

    dbCfg.setDataRegionConfigurations(memPlcCfg2);

    dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);

    dbCfg.setWalHistorySize(2);

    dbCfg.setWalMode(WALMode.LOG_ONLY);

    if (walSegmentSize != 0)
        dbCfg.setWalSegmentSize(walSegmentSize);

    cfg.setDataStorageConfiguration(dbCfg);

    cfg.setMarshaller(null);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}
 
Example 15
Source File: WalRecoveryTxLogicalRecordsTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, IndexedValue> ccfg = new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
    ccfg.setIndexedTypes(Integer.class, IndexedValue.class);

    if (extraCcfg != null)
        cfg.setCacheConfiguration(ccfg, new CacheConfiguration<>(extraCcfg));
    else
        cfg.setCacheConfiguration(ccfg);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(pageSize);

    dbCfg.setWalHistorySize(WAL_HIST_SIZE);

    dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setMaxSize(100L * 1024 * 1024)
        .setPersistenceEnabled(true));

    if (checkpointFreq != null)
        dbCfg.setCheckpointFrequency(checkpointFreq);

    cfg.setDataStorageConfiguration(dbCfg);

    cfg.setMarshaller(null);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}