I'm trying to use the SegmentWriter class to append data to an
existing segment, but I can't seem to construct an instance of it with
an existing segment directory. I tried setting the "force" argument
to true, but the constructor still bombs out when it hits the
MapFile.Writer constructors for writing to the data files in the
fetcher/, content/, etc. directories. I checked the source code for
MapFile.Writer, where I found the following code:
File dir = new File(dirName);
if (nfs.exists(dir)) {
throw new IOException("already exists: " + dir);
}
nfs.mkdirs(dir);
Thus, MapFile.Writer can NEVER write to an existing directory. The
SequenceFile.Writer instances created in the MapFile.Writer
constructor throw the same exception in a couple more places. Is
there any way to work around this without rewriting all these writer
classes? If not, then the "force" option is effectively useless, and
a segment can never be modified after it is created.
-Dan