You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by kishore g <g....@gmail.com> on 2011/10/05 00:00:13 UTC

Exception while reading Snapshot file

Hi,

I am trying to load data from a ZK snapshot file into datatree. Here is the
code I am using

    FileInputStream fis = new FileInputStream(args[0]);
    BinaryInputArchive snapshot = BinaryInputArchive.getArchive(fis);
    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
    DataTree dt = new DataTree();
    SerializeUtils.deserializeSnapshot(dt, snapshot, sessions);

I get the following exception
Exception in thread "main" java.io.EOFException
    at java.io.DataInputStream.readFully(DataInputStream.java:180)
    at java.io.DataInputStream.readLong(DataInputStream.java:399)
    at
org.apache.jute.BinaryInputArchive.readLong(BinaryInputArchive.java:67)
    at
org.apache.zookeeper.server.util.SerializeUtils.deserializeSnapshot(SerializeUtils.java:83)

Is there something wrong in the way I am reading.It is able to read part of
the data before throwing EOF. All the snapshots result in the same problem

thanks,
Kishore G

Re: Exception while reading Snapshot file

Posted by kishore g <g....@gmail.com>.
Thanks Pat. I was able to read the snapshot.

On Wed, Oct 5, 2011 at 9:45 AM, Patrick Hunt <ph...@apache.org> wrote:

> You are missing the header, see:
> org.apache.zookeeper.server.persistence.FileSnap.deserialize(DataTree,
> Map<Long, Integer>, InputArchive)
>
> Patrick
>
> On Tue, Oct 4, 2011 at 3:00 PM, kishore g <g....@gmail.com> wrote:
> > Hi,
> >
> > I am trying to load data from a ZK snapshot file into datatree. Here is
> the
> > code I am using
> >
> >    FileInputStream fis = new FileInputStream(args[0]);
> >    BinaryInputArchive snapshot = BinaryInputArchive.getArchive(fis);
> >    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
> >    DataTree dt = new DataTree();
> >    SerializeUtils.deserializeSnapshot(dt, snapshot, sessions);
> >
> > I get the following exception
> > Exception in thread "main" java.io.EOFException
> >    at java.io.DataInputStream.readFully(DataInputStream.java:180)
> >    at java.io.DataInputStream.readLong(DataInputStream.java:399)
> >    at
> > org.apache.jute.BinaryInputArchive.readLong(BinaryInputArchive.java:67)
> >    at
> >
> org.apache.zookeeper.server.util.SerializeUtils.deserializeSnapshot(SerializeUtils.java:83)
> >
> > Is there something wrong in the way I am reading.It is able to read part
> of
> > the data before throwing EOF. All the snapshots result in the same
> problem
> >
> > thanks,
> > Kishore G
> >
>

Re: Exception while reading Snapshot file

Posted by Patrick Hunt <ph...@apache.org>.
You are missing the header, see:
org.apache.zookeeper.server.persistence.FileSnap.deserialize(DataTree,
Map<Long, Integer>, InputArchive)

Patrick

On Tue, Oct 4, 2011 at 3:00 PM, kishore g <g....@gmail.com> wrote:
> Hi,
>
> I am trying to load data from a ZK snapshot file into datatree. Here is the
> code I am using
>
>    FileInputStream fis = new FileInputStream(args[0]);
>    BinaryInputArchive snapshot = BinaryInputArchive.getArchive(fis);
>    Map<Long, Integer> sessions = new HashMap<Long, Integer>();
>    DataTree dt = new DataTree();
>    SerializeUtils.deserializeSnapshot(dt, snapshot, sessions);
>
> I get the following exception
> Exception in thread "main" java.io.EOFException
>    at java.io.DataInputStream.readFully(DataInputStream.java:180)
>    at java.io.DataInputStream.readLong(DataInputStream.java:399)
>    at
> org.apache.jute.BinaryInputArchive.readLong(BinaryInputArchive.java:67)
>    at
> org.apache.zookeeper.server.util.SerializeUtils.deserializeSnapshot(SerializeUtils.java:83)
>
> Is there something wrong in the way I am reading.It is able to read part of
> the data before throwing EOF. All the snapshots result in the same problem
>
> thanks,
> Kishore G
>