Community/GlusterFS Hackers Guide

From GlusterDocumentation

This information is out of date
and does not contain information related to the current version of Gluster

Documentation Home


FIXME: WORK IN PROGRESS

Source repository

You can get the latest and unreleased developer's source from the Savannah's GNU Arch repository.

This document seems obsolete, see Development Work Flow for latest information.


Anonymous access

$ tla register-archive http://arch.savannah.gnu.org/archives/gluster/
$ tla get -A gluster@sv.gnu.org glusterfs--mainline--BRANCH glusterfs

See Gluster Download Page for latest branch-id.

Developer Access

Setting-up signatures auto-checking

$ mkdir -p -m 700 ~/.arch-params/signing/
$ echo 'tla-gpg-check gpg_command="gpg --verify-files -"' > ~/.arch-params/signing/=default.check
$ echo 'gpg --clearsign --use-agent' > ~/.arch-params/signing/=default

You may also be interested in the GPG Keyring of this project.

Note: Copy tla/=gpg-check.awk from GNU Arch source to your bin path as tla-gpg-check. Debian GNU/Linux does this by default. Option --use-agent requires gnupg-agent package as well. You need this option if you do not want to enter password everytime you commit. To initialize gnupg-agent, execute gpg-agent --daemon in your current shell context.

Repository Developer Checkout

$ tla my-id "FIRST-NAME LAST-NAME <YOUR-EMAIL-ID>"
$ tla register-archive sftp://USER@arch.sv.gnu.org/archives/gluster
$ tla my-default-archive gluster@sv.gnu.org
$ tla get glusterfs--mainline--2.5 glusterfs

Hacking Translators

Prerequisites :

  • Idea of translators in programming.
  • About FUSE (Not so compulsory).
  • GlusterFS Asynchronous Messaging Framework.

Howto  :

In GlusterFS, different translators are written under 'xlators/' directory of the source. Each translator is classified based on their functionalities. To get an idea of glusterfs translators, have a look at the following files,

  libglusterfs/src/xlator.h  --> check for fops and mops prototype.
  libglusterfs/src/xlator.c
  libglusterfs/src/defaults.c --> check for default fops and mops implementation.

Each translator should implement functions by name 'init ()' and 'fini ()'. There are two structures, 'fops' (filesystem operations) and 'mops' (management operations), which developer should define. Functions that are not implemented will automatically be set to default operations, which are just pass through functions.

Asynchronous calls :

Now translator's fops and mops calls are asynchronous. This method is very necessary to make GlusterFS give more performance by reducing the latency caused by the network calls. There are two macros used for this 'STACK_WIND' and 'STACK_UNWIND', which maintains the call stack (at user space). Look at libglusterfs/src/stack.h to see definition of macros.

Hacking Schedulers

Each scheduler should implement three functions in sched_ops structure. You have to take care of locking your state variables safely.

  • static int my_init (struct xlator *xl)

Module entry initialization function invoked once at the time of load. xl is pointer to this translator's structure. You can also have your own private state in xl->private void pointer. Return 0 on success or -1 with errno set appropriately.

  • static void my_fini (struct xlator *xl)

Module exit uninitialization function invoked once at the time of unload. xl is pointer to this translator's structure. Make sure you free up your own private state in xl->private properly. Return 0 on success or -1 with errno set appropriately.

  • static struct xlator * my_schedule (struct xlator *xl)

Actual scheduling logic. xl is pointer to this translator's structure. Return 0 on success or -1 with errno set appropriately.

Good examples to begin with are 'random' or 'rr' (round-robin) schedulers.

scheduler/rr/src/rr.c
scheduler/random/src/random.c

Hacking Transport

** TODO **


Debugging GlusterFS

While developping any major application, the major problem faced by developper is the ways of debugging the program. GlusterFS being a program which handles valuable data, needs to be bugs free. Hence there is a major need for various debugging methods. As its implemented in userspace, it has the benefits of different methods for debugging.

Debug/Trace Translator

As an example for the translator framework, a trace translator is implemented, which logs all the arguments passed to a function. This is very useful for checking the arguments passed for the under laying volumes. This is very useful method to start debug.

Non-Daemon Mode

Both Glusterfs-client and glusterfs-server can run in daemon mode and non-daemon mode. Non-daemon mode logs messages to console. You can see when it dies. Also it is gdb friendly.

Debugging with GNU Gdb

GlusterFS is implemented in user space completely. So, it can be debugged using gdb as any other user space application.


Patch Submission Guidelines

# diff -pruN glusterfs glusterfs-hacked > glusterfs-$VERSION-$PATCH_NAME

Mail the patch as inline mail message to gluster-devel mailing-list with subject: [PATCH: glusterfs] actual subject. Include Changelog contents in the body and not in patch.


Test Procedures

  • Kernel Compilation
  • dbench
  • iozone
  • dd
  • parallel dd
  • fill/remove file system
  • emacs editing
  • md5sum of all files
  • [un]compress all files
  • watch for memory leaks
  • LAPACK or LINPACK (Parallel Benchmarking applications)

This information is out of date
and does not contain information related to the current version of Gluster

Documentation Home

 

Copyright © Gluster, Inc. All Rights Reserved.