Forum Stats

  • 3,874,372 Users
  • 2,266,738 Discussions
  • 7,911,832 Comments

Discussions

Coherence 3.4.2 dumps loading in 3.5.3

755620
755620 Member Posts: 2
edited Mar 3, 2010 11:09AM in Coherence Support
I'm using coherence 3.4.2 now and my current task is to migrate caches to 3.5.3 version. During dumps loading via PofBufferReader I've caught the error:
 java.lang.IllegalArgumentException: The cache XXX was created using a different factory; that same factory should be used to release the cache.
                at com.tangosol.net.DefaultConfigurableCacheFactory.releaseCache(DefaultConfigurableCacheFactory.java:3220)
                at com.tangosol.net.DefaultConfigurableCacheFactory.releaseCache(DefaultConfigurableCacheFactory.java:321)
                at com.tangosol.net.CacheFactory.releaseCache(CacheFactory.java:1057)
The code for the dump creation / loading:
     public void writeToFile(String fileName, Set cacheKeysBatch, NamedCache cache) throws FileNotFoundException {
        ConfigurablePofContext context = (ConfigurablePofContext) cache.getCacheService().getSerializer();
        FileOutputStream fileOutputStream = new FileOutputStream(new File(fileName));
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, 1024 * 1024);
        DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);
        WrapperBufferOutput wrappedOut = new WrapperBufferOutput(dataOutputStream);
        PofBufferWriter pofWriter = new PofBufferWriter(wrappedOut, context);
        try {
            pofWriter.writeMap(0, cache.getAll(cacheKeysBatch));
            wrappedOut.flush();
        } catch(IOException e) {
            LOG.error("Problems writing to file [" + fileName + "] [" + e.getMessage() + "]", e.getCause());
        } finally {
            IOUtils.closeQuietly(fileOutputStream);
        }
    }

    public void load(String cacheName, InputStream inputStream) throws IOException {
        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 1024 * 1024);
        DataInputStream dataInputStream = new DataInputStream(bufferedInputStream);
        WrapperBufferInput bufferReader = new WrapperBufferInput(dataInputStream);
        ConfigurablePofContext pofContext = (ConfigurablePofContext) getNamedCache(cacheName).getCacheService()
            .getSerializer();
        PofBufferReader pofReader = new PofBufferReader(bufferReader, pofContext);
        HashMap entryMap = new HashMap();
        pofReader.readMap(0, entryMap);
        NamedCache cache = getNamedCache(cacheName);
        cache.putAll(entryMap);
        releaseAndObtainCache(cache);
    }

    private void releaseAndObtainCache(NamedCache cache) {
        CacheFactory.releaseCache(cache);
        Runtime.getRuntime().gc();
    }
Is it possible to use dump created in 3.4 in 3.5 or could you please suggest any tools or approaches to migrate the data between 3.4 and 3.5?

Thanks

Edited by: user4539457 on Feb 24, 2010 1:48 AM

Answers

  • drowland
    drowland Member Posts: 51
    Hello,

    Could you provide a little more detail in order to understand or reproduce your problem?

    It the problem coming from writing to disk in (3.4.2) or is it come from reading from disk (3.5.3)?

    Could you provide a little more context with regard to process - basically looking for the full use case that failed.

    Also could you provide the config file information.

    I will try to chase down some examples in the mean time.

    Thanks
    Dave
  • 755620
    755620 Member Posts: 2
    Hello,

    Yes, I have a dump on the disk prepared by the coherence 3.4.2. When I try to load it with coherence 3.5.3 I get the error "The cache XXX was created using a different factory...".

    Our config file:
    <cache-config>
        <caching-scheme-mapping>
            <cache-mapping>
                <cache-name>com.xxx.coherence.MakeImpl</cache-name>
                <scheme-name>make-scheme</scheme-name>
            </cache-mapping>
          </caching-scheme-mapping>
        <caching-schemes>
            <near-scheme>
                <scheme-name>make-scheme</scheme-name>
                <front-scheme>
                    <local-scheme>
                        <high-units>100</high-units>
                    </local-scheme>
                </front-scheme>
                <back-scheme>
                    <distributed-scheme>
                        <scheme-name>make-distributed</scheme-name>
                        <service-name>MakeCache</service-name>
                        <thread-count>10</thread-count>
                        <backup-count>1</backup-count>
                        <transfer-threshold>128</transfer-threshold>
                        <partition-count>1021</partition-count>                    
                        <serializer>
                            <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                            <init-params>
                                <init-param>
                                    <param-type>string</param-type>
                                    <param-value>pof-config.xml</param-value>
                                </init-param>
                            </init-params>
                        </serializer>
                        <backing-map-scheme>
                            <local-scheme>
                                <unit-calculator>BINARY</unit-calculator>
                            </local-scheme>
                        </backing-map-scheme>
                        <autostart>true</autostart>
                    </distributed-scheme>
                </back-scheme>
                <invalidation-strategy>present</invalidation-strategy>
                <autostart>true</autostart>
            </near-scheme>
        </caching-schemes>
    </cache-config>
    
    <pof-config>
        <user-type-list>
            <!-- include all application POF user types -->
            <user-type>
                <type-id>4005</type-id>
                <class-name>com.xxx.coherence.MakeImpl</class-name>
            </user-type>
          ...............
        </user-type-list>
        <allow-interfaces>true</allow-interfaces>
        <allow-subclasses>true</allow-subclasses>
    </pof-config>
  • drowland
    drowland Member Posts: 51
    Hello,

    Sorry for the delay. Thanks for the configuration information. In order to reproduce your error is it possible to get a little more context? Basically looking for the details of the load logic that gets the error. Also I have some sample that does a back/restore of a cache that may be of interest. It is a little too much to post in the forum but if you contact me I can make it available.


    Thanks,
    David

    [email protected]
This discussion has been closed.