免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3027 | 回复: 0

kfs的chunk [复制链接]

论坛徽章:
0
发表于 2010-02-23 16:14 |显示全部楼层

                块是kfs中负载均衡的最小单位,可以理解为普通文件系统的一个block(4k),kfs中一个chunk的大小为64MB,每个chunk有一个唯一的64位id值。一个文件由多个chunk组成,每个文件也由一个唯一的64位id标示。chunk由chunkserver维护,一个chunk可能分布在多个chunkserver上。chunk的meta信息和chunk一起记录在磁盘上,chunkserver启动的时候加载磁盘上的chunk信息。
磁盘上的chunk信息如下:
               
               
                               int metaMagic;                      /**
        int metaVersion;                    /**
        kfsFileId_t fileId;                 /**
        kfsChunkId_t chunkId;               /**
        kfsSeq_t chunkVersion;              /**
        off_t  chunkSize;                   /**
        /**
        uint32_t chunkBlockChecksum[MAX_CHUNK_CHECKSUM_BLOCKS];  
        // some statistics about the chunk:
        // -- version # has an estimate of the # of writes
        // -- track the # of reads
        // ...
        uint32_t numReads;                  /**
        char filename[MAX_FILENAME_LEN];    /**
其中chunkVersion表示了块是否up-to-date,该信息同时在metaserver和chunkserver上保存。论文中的描述如下:
Chunk replicas may become stale if a chunkserver fails and misses mutations to the chunk while it is down. For each chunk, the master maintains a chunk version number to distinguish between up-to-date and stale replicas.         
Whenever the master grants a new lease on a chunk, it increases the chunk version number and informs the up-to-date replicas. The master and these replicas all record the new version number in their persistent state. This occurs before any client is notified and therefore before it can start writing to the chunk. If another replica is currently unavailable, its chunk version number will not be advanced. The master will detect that this chunkserver has a stale replica when the chunkserver restarts and reports its set of chunks and their associated version numbers. If the master sees a version number greater than the one in its records, the master assumes that it failed when granting the lease and so takes the higher version to be up-to-date.
chunkBlockChecksum为每个block(每个block的大小为16k)计算一个校验和,这样处理是防止进行校验和检查的时候需要读取整个chunk。
chunkserver在内存中未每个块维护了磁盘元信息的拷贝。
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16588/showart_2185220.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP