[Gluster-devel] context based defaults for volume options in glusterd

Pranith Kumar Karampuri pkarampu at redhat.com
Tue Sep 1 06:29:09 UTC 2015

On 09/01/2015 11:55 AM, Krishnan Parthasarathi wrote:
> ----- Original Message -----
>> hi,
>>        Afr needs context based defaults for quorum where by default
>> quorum value is 'none' for 2-way replica and 'auto' for 3 way replica.
>> Anuradha sent http://review.gluster.org/11872 to fix the same. May be we
>> can come up with more generic solution. The present solution remembers
>> the default in volinfo->options and also written to the store. So the
>> default will be shown in "volume info" output and if we want to change
>> the defaults in future we will need to carefully think of all the things
>> that could go wrong especially peers getting rejected because of the
>> md5sum mismatch. Another way to solve the same problem is to generate
>> the default value of the vme-option based on the context of the volume
>> when we have to write to the volfile. In this particular case, we need
>> to generate default as 'none' for 2-way-replica-count volume. and 'auto'
>> for 3-replica-count volume. For volume-get command handling also we need
>> to consider this dynamic default value. For implementing this, we can
>> add a new member 'context_based_default_value_get()'(please feel free to
>> come up with better name for the function :-) ) to the vme-table which
>> can be invoked to get the default option which takes the volinfo as
>> parameter at least, and not set .value i.e implicitly .value will be NULL.
>> This is based on earlier design detail in the comment of vme-table:
>> * Fourth field is <value>. In this context they are used to specify
>> * a default. That is, even the volume dict doesn't have a value,
>> * we procced as if the default value were set for it.
>> We just want to enhance the existing behavior with this proposed change.
>> It seems more generic than the present solution in the patch. In future
>> people can write their own implementations of context based default
>> value generation following same procedure. Let me know your comments.
> Here are a few things that are not clear to me.
> 1) Does the context-based default value for an option comes into effect
> only when .value in vme table is NULL?
If there is context based default then the static default value should 
be NULL is my feeling.
> 2) IIUC, the generated default value is applied to the volume files generated
> and persisted no place else. Is this correct?
> 3) What happens if the context_based_default_get() is not available in all
> glusterds in the cluster? e.g, upgrade from 3.6 to 3.7.x (where this may land).
> Shouldn't this behaviour also be 'versioned' to prevent different volume files
> being served by different nodes of the cluster?
In the context_based_default_value_get() we can add the version checks 
and generate it the way we want.

>> Pranith

More information about the Gluster-devel mailing list