kuer - 2009-03-06

in src/cc/meta/ChunkServer.h

315                 /// Available space is defined as the difference
316                 /// between the total storage space available
317                 /// on the server and the amount of space that
318                 /// has been parceled out for outstanding writes
319                 /// by the meta server.  THat is, alloc space is tied
320                 /// to the chunks that have been write-leased.  This
321                 /// has the effect of keeping alloc space tied closely
322                 /// to used space.
323                 uint64_t GetAvailSpace() {
324                         mAllocSpace = mUsedSpace +
325                                 (mNumChunkWriteReplications + mNumChunkWrites) *
326                                         CHUNKSIZE;
327                         if (mAllocSpace >= mTotalSpace)
328                                 return 0;
329                         else
330                                 return mTotalSpace - mAllocSpace;
331                 }

As my understand, mNumChunkWrites means the number of chunks that chunkserver are WRITING ( not reach the 64MB limit).

but scan all meta/ChunkServer.h/cc, the value of mNumChunkWrites keep incrementing via UpdateNumChunkWrites(1), NO DESCREASING.

I think it is wierd. CHUNK_HEART tell meta-server mNumChunks, and meta-server count chunks for CHUNK-server using mNumChunkWrites. what's the relation between them two??

As my observe, I define a 10GB space for chunk-server, but after feeding about 5~6GB data, meta-server will tell kfs-client ENOSPC (-28)

I guess the reason is that in GetAvailSpace(), space occupied by chunk is calculated twice: once in mUsedSpace, once in mNumChunkWrites.