Skip to content

Commit

Permalink
afr: arbiter xlator
Browse files Browse the repository at this point in the history
This patch adds the arbiter translator into the tree. This is a server
side xlator used for replica 3 volumes. It sits above posix and will be
loaded on the 3rd (last) brick of every afr subvolume in a replica 3
configuration. It intercepts inode read/write operations: reads are
unwound with ENOTCONN, inode writes are unwound with success without
actually passing them down to posix. Metadata operations are allowed to
pass through.

The CLI for creating a 3 way replica with arbiter is also added but kept
disabled (A 'normal' 3 way replica is created instead).

This patch is a part of the arbiter logic implementation for 3 way AFR,
details of which can be found at http://review.gluster.org/#/c/9656/

Change-Id: I395b81f49d5da52c466daf5c8518f1bbad9c16fa
BUG: 1199985
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/9840
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
  • Loading branch information
itisravi authored and vbellur committed Mar 19, 2015
1 parent 61489c1 commit 32ed7aa
Show file tree
Hide file tree
Showing 11 changed files with 435 additions and 3 deletions.
22 changes: 21 additions & 1 deletion cli/src/cli-cmd-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words,
char *bricks = NULL;
int32_t brick_count = 0;
char *opwords[] = { "replica", "stripe", "transport", "disperse",
"redundancy", "disperse-data", NULL };
"redundancy", "disperse-data", "arbiter", NULL };

char *w = NULL;
char *ptr = NULL;
int op_count = 0;
int32_t replica_count = 1;
int32_t arbiter_count = 0;
int32_t stripe_count = 1;
int32_t disperse_count = -1;
int32_t redundancy_count = -1;
Expand Down Expand Up @@ -521,6 +522,25 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words,
goto out;

index += 2;
if (!strcmp (words[index], "arbiter")) {
ret = gf_string2int (words[index+1],
&arbiter_count);
if (ret == -1 || arbiter_count != 1 ||
replica_count != 3) {
cli_err ("For arbiter configuration, "
"replica count must be 3 and "
"arbiter count must be 1. "
"The 3rd brick of the replica "
"will be the arbiter.");
ret = -1;
goto out;
}
ret = dict_set_int32 (dict, "arbiter-count",
arbiter_count);
if (ret)
goto out;
index += 2;
}

} else if ((strcmp (w, "stripe")) == 0) {
switch (type) {
Expand Down
3 changes: 2 additions & 1 deletion cli/src/cli-cmd-volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,8 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_info_cbk,
"list information of all volumes"},

{ "volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] "
{ "volume create <NEW-VOLNAME> [stripe <COUNT>] "
"[replica <COUNT> [arbiter <COUNT>]] "
"[disperse [<COUNT>]] [disperse-data <COUNT>] [redundancy <COUNT>] "
"[transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>"
#ifdef HAVE_BD_XLATOR
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ AC_CONFIG_FILES([Makefile
xlators/protocol/server/Makefile
xlators/protocol/server/src/Makefile
xlators/features/Makefile
xlators/features/arbiter/Makefile
xlators/features/arbiter/src/Makefile
xlators/features/changelog/Makefile
xlators/features/changelog/src/Makefile
xlators/features/changelog/lib/Makefile
Expand Down
2 changes: 1 addition & 1 deletion xlators/features/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = locks quota read-only mac-compat quiesce marker index barrier \
SUBDIRS = locks quota read-only mac-compat quiesce marker index barrier arbiter\
protect compress changelog changetimerecorder ganesha gfid-access $(GLUPY_SUBDIR) qemu-block \
upcall snapview-client snapview-server trash #path-converter # filter

Expand Down
3 changes: 3 additions & 0 deletions xlators/features/arbiter/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUBDIRS = src

CLEANFILES =
16 changes: 16 additions & 0 deletions xlators/features/arbiter/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
xlator_LTLIBRARIES = arbiter.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features

arbiter_la_LDFLAGS = -module -avoid-version

arbiter_la_SOURCES = arbiter.c
_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
arbiter_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la

noinst_HEADERS = arbiter.h arbiter-mem-types.h

AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src

AM_CFLAGS = -Wall $(GF_CFLAGS)

CLEANFILES =
19 changes: 19 additions & 0 deletions xlators/features/arbiter/src/arbiter-mem-types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/

#ifndef __ARBITER_MEM_TYPES_H__
#define __ARBITER_MEM_TYPES_H__
#include "mem-types.h"

typedef enum gf_arbiter_mem_types_ {
gf_arbiter_mt_inode_ctx_t = gf_common_mt_end + 1,
gf_arbiter_mt_iatt,
gf_arbiter_mt_end
} gf_arbiter_mem_types_t;
#endif
Loading

0 comments on commit 32ed7aa

Please sign in to comment.