2014年12月31日 星期三

GlusterFS Pending Value Introduction


Suppose test-vol is a replicate volume, there are two bricks (brick-0, brick-1) in the test-vol

There is a test-file in test-vol, the test-file are in brick-0 and brick-1

There are some extension attributions in test-file in brick-0 and brick-1. they are "trusted.afr.test-vol-client-0" and "trusted.afr.test-vol-client-1"


2014年12月28日 星期日

GlusterFS Timer Mechanism


GlusterFS context(glusterfs_ctx) has a timer data structure(gf_timer_registert_t). 

gf_timer_registert_t {
    pthread_t          th,
    char               fin,    // finish
    _gf_timer          stale,  // stale event list
    _gf_timer          active, // active event list
    pthread_mutex_t    lock   
}
There are
  • pthread
  • active list
  • stale list
  • pthread lok
in glusterfs context timer. active and stale list date structure is _gf_timer, it is also gf timer event.
_gf_timer {
    _gf_timer         *next, *prev, // pointer to next and previous
    timespec          at,           // time to execute the event
    gf_timer_cbk_t    callbk,       // execute funcation
    void              data,         // event data for callbk
    xlator_t          *xl           // event translator
}

glusterfs_ctx timer

glusterfs_ctx will create a pthread, and pthread will execute gf_timer_proc() function.
The thread will get the timer event from active list and check the timestamp of event. if timestamp > current time, it will move the timer event from active list to stale list, and execute the callback function of timer event.

 

2014年12月23日 星期二

gfid introduction



trusted.gfid is inode number, A uuid that's unique to each file across the entire cluster. 

在brick中每一個檔案(include dir)都有一個gfid, 而在.glusterfs的folder中,會有一個對應的檔案, 
利用gfid的前兩個digit來分folder. 
ex. file1的gfid = 0xb8d5abfc-35f1-4716-8da8-824f186c74e8 
.glusterfs下面就會有b8/d5/b8d5abfc-35f1-4716-8da8-824f186c74e8 
brick 的/目錄的gfid是0x00000000000000000000000000000001 
若是folder的話在.glusterfs會指向parent目錄的folder連結 
ex. 
在根目錄下有一個c folder. (/c)
gfid=0x07c8896ce3404eb69690f744618ea65b 
對應的gfid file = .glusterfs/07/c8/07c8896c-e340-4eb6-9690-f744618ea65b 
他會link(symlink)到parent的目錄下的目錄 
像以下這樣 
07c8896c-e340-4eb6-9690-f744618ea65b -> ../../00/00/00000000-0000-0000-0000-000000000001/c/

在brick下查看attribute的指令:
# getattr getfattr -m . -d -e hex $brick-folder

2014年12月15日 星期一

GDB with GlsuterFS


使用GDB去追glusterfs daemon有兩種方式. 
  • gdb模式下去launch glusterd daemon
  • attach glusterfs deamon

以attach的方式attach glusterfs daemon:


假設glusterd的pid是22579
# gdb 

# (gdb) attach 22579

因為通常glusterfs daemon launch 起來後, 會進入epoll dispatch. 所以我們直接在event_dispatch_epool_handler下break point
# (gdb) b event_dispatch_epoll_handler