<p dir="ltr">Hi Amar, </p>
<p dir="ltr">On May 15, 2017 2:15 PM, Amar Tumballi <atumball@redhat.com> wrote:<br>
><br>
><br>
><br>
> On Tue, Apr 11, 2017 at 2:59 PM, Amar Tumballi <amarts@gmail.com> wrote:<br>
>><br>
>> Comments inline.<br>
>><br>
>> On Mon, Dec 19, 2016 at 1:47 PM, Xavier Hernandez <xhernandez@datalab.es> wrote:<br>
>>><br>
>>> On 12/19/2016 07:57 AM, Aravinda wrote:<br>
>>>><br>
>>>><br>
>>>> regards<br>
>>>> Aravinda<br>
>>>><br>
>>>> On 12/16/2016 05:47 PM, Xavier Hernandez wrote:<br>
>>>>><br>
>>>>> On 12/16/2016 08:31 AM, Aravinda wrote:<br>
>>>>>><br>
>>>>>> Proposal to add one more byte to GFID to store "Type" information.<br>
>>>>>> Extra byte will represent type(directory: 00, file: 01, Symlink: 02<br>
>>>>>> etc)<br>
>>>>>><br>
>>>>>> For example, if a directory GFID is f4f18c02-0360-4cdc-8c00-0164e49a7afd<br>
>>>>>> then, GFID2 will be 00f4f18c02-0360-4cdc-8c00-0164e49a7afd.<br>
>>>>>><br>
>>>>>> Changes to Backend store<br>
>>>>>> ------------------------<br>
>>>>>> Existing: .glusterfs/gfid[0:2]/gfid/[2:4]/gfid<br>
>>>>>> Proposed: .glusterfs/gfid2[0:2]/gfid2[2:4]/gfid2[4:6]/gfid2<br>
>>>>>><br>
>>>>>> Advantages:<br>
>>>>>> -----------<br>
>>>>>> - Automatic grouping in .glusterfs directory based on file Type.<br>
>>>>>> - Easy identification of Type by looking at GFID in logs/status output<br>
>>>>>>   etc.<br>
>><br>
>><br>
>> Above two will be good enough points to bump up the priority for the feature.<br>
>>  <br>
>>>>>><br>
>>>>>> - Crawling(Quota/AFR): List of directories can be easily fetched by<br>
>>>>>>   crawling `.glusterfs/gfid2[0:2]/` directory. This enables easy<br>
>>>>>>   parallel Crawling.<br>
>><br>
>><br>
>> With the current design, we still have to do a distributed readdir() to get all <br>
>> the entries in the directory. This layout change, along with proposed <br>
>> DHT2/EHT/DHT2+ (name for me doesn't matter here) layout, where directory <br>
>> entries would be created in just one place should enhance the performance overall.<br>
>>  <br>
>>>>>><br>
>>>>>> - Quota - Marker: Marker transator can mark xtime of current file and<br>
>>>>>>   parent directory. No need to update xtime xattr of all directories<br>
>>>>>>   till root.<br>
>>>>>> - Geo-replication: - Crawl can be multithreaded during initial sync.<br>
>>>>>>   With marker changes above it will be more effective in crawling.<br>
>>>>>><br>
>>  <br>
>>>>>><br>
>>>>>> Please add if any more advantageous.<br>
>>>>>><br>
>>>>>> Disadvantageous:<br>
>>>>>> ----------------<br>
>>>>>> Functionality is not changed with the above change except the length<br>
>>>>>> of the ID. I can't think of any disadvantages except the code changes<br>
>>>>>> to accommodate this change. Let me know if I missed anything here.<br>
>>>>><br>
>>>>><br>
>>>>> One disadvantage is that 17 bytes is a very ugly number for<br>
>>>>> structures. Compilers will add paddings that will make any structure<br>
>>>>> containing a GFID noticeable bigger. This will also cause troubles on<br>
>>>>> all binary formats where a GFID is used, making them incompatible. One<br>
>>>>> clear case of this is the XDR encoding of the gluster protocol.<br>
>>>>> Currently a GFID is defined this way in many places:<br>
>>>>><br>
>>>>>         opaque gfid[16]<br>
>>>>><br>
>>>>> This seems to make it quite complex to allow a mix of gluster versions<br>
>>>>> in the same cluster (for example in a middle of an upgrade).<br>
>><br>
>><br>
>> Totally agree with Xavier here. Not in support of adding one more byte.<br>
>>  <br>
>>>>><br>
>>>>><br>
>>>>> What about this alternative approach:<br>
>>>>><br>
>>>>> Based on the RFC4122 [1] that describes the format of an UUID, we can<br>
>>>>> define a new structure for new GFID's using the same length.<br>
>>>>><br>
>>>>> Currently all GFID's are generated using the "random" method. This<br>
>>>>> means that all GFID have this structure:<br>
>>>>><br>
>>>>>         xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx<br>
>>>>><br>
>>>>> Where N can be 8, 9, A or B, and M is 4.<br>
>>>>><br>
>>>>> There are some special GFID's that have a M=0 and N=0, for example the<br>
>>>>> root GFID.<br>
>>>>><br>
>>>>> What I propose is to use a new variant of GFID, for example E or F<br>
>>>>> (officially marked as reserved for future definition) or even 0 to 7.<br>
>>>>> We could use M as an internal version for the GFID structure (defined<br>
>>>>> by ourselves when needed). Then we could use the first 4 or 8 bits of<br>
>>>>> each GFID as you propose, without needing to extend current GFID<br>
>>>>> length nor risking to collide with existing GFID's.<br>
>>>>><br>
>>>>> If we are concerned about the collision probability (quite small but<br>
>>>>> still bigger than the current version) because we loose some random<br>
>>>>> bits, we could use N = 0..7 and leave M random. This way we get 5 more<br>
>>>>> random bits, from which we could use 4 to represent the inode type.<br>
>>>>><br>
>>>>> I think this way everything will work smoothly with older versions<br>
>>>>> with minimal effort.<br>
>>>>><br>
>>>>> What do you think ?<br>
>>>><br>
>>>> That is really nice suggestion.<br>
>>>><br>
>>>> To get the crawling advantageous as mentioned above, we need to make<br>
>>>> backend store as .glusterfs/N/gfid[0:2]/gfid[2:4]/gfid<br>
>>><br>
>>><br>
>>> That's one possibility. Since N will be 4 bits at most, it won't collide with currently existing subdirectories that represent 8 bits. Or we could use M. It all depends on the exact interpretation we give to each field.<br>
>>><br>
>>> One suggestion I would make is to define it in a way that we use the minimal amount of bits to represent what we need now but leave space for future extensions. For example creating a "reserved" value for the field.<br>
>>><br>
><br>
> While discussing this with Aravinda, we realized, if we just make changes in UUID generation logic, we don't need to be worried about version incompatibility.</p>
<p dir="ltr">Yes. That's one of the main advantages of keeping an standard UUID. </p>
<p dir="ltr">><br>
> Also, I have a question, What are the chances of uuid collision if we take just 3 bits from the first byte ? <br>
><br>
> 000 - Unspecified (can be anything).<br>
> 001 - Directory<br>
> 010 - Regular File<br>
> 011 - Special files (symlink, Block and Char devices, socket files etc).<br>
> {100 - 111} - Reserved.</p>
<p dir="ltr">This cannot be done. Since we are currently using random UUIDs, on average, one of every eight randomly generated ids will start with each one of the combinations. </p>
<p dir="ltr">Already existing GFIDs will be a problem when updating. The only thing that can avoid the problem is to create new GFIDs in a format that won't collide with existing ones, and this can only be done safely if we use the special fiels of the UUID itself. </p>
<p dir="ltr">><br>
> As a side-effect, it reduces the number of directories created at as the metadata, inside of .glusterfs directory. (Will be 50% of current load). </p>
<p dir="ltr">Maybe we can find a better way to store the GFIDs using the standard fields instead of relying on the first bits, which is not a valid solution. </p>
<p dir="ltr">We can think more about this. </p>
<p dir="ltr">Xavi</p>
<p dir="ltr">><br>
> -Amar<br>
>  <br>
>>><br>
>>> Proposal:<br>
>>><br>
>>> Use N = 00xx for special GFID's, like NULL GFID, or the ones currently used in some places. All these will also have M = 0. All other values of M will be reserved for future extensions.<br>
>>><br>
>>> Also reserve all other values of N (01xx) for future extensions.<br>
>>><br>
>>> This gives a lot of space to represent many things in the future if necessary, while keeping current usage compatible with it.<br>
>>><br>
>>> For this particular case we could use N = 0000 and define M as (this is a mapping of the posix S_IFxxx values):<br>
>>><br>
>>> M = 0000 Current special GFID's<br>
>>> M = 0001 Fifo (S_IFIFO)<br>
>>> M = 0010 Character Device (S_IFCHR)<br>
>>> M = 0100 Directory (S_IFDIR)<br>
>>> M = 0110 Block Device (S_IFBLK)<br>
>>> M = 1000 Regular File (S_IFREG)<br>
>>> M = 1010 Symbolic Link (S_IFLNK)<br>
>>> M = 1100 Socket (S_IFSOCK)<br>
>>><br>
>>> M = xx11 \<br>
>>> M = x1x1  | Reserved for future extensions<br>
>>> M = 1xx1  |<br>
>>> M = 111x /<br>
>>><br>
>>> If we use our own mapping instead of using the same values than IF_Sxxx macros, we can get a more compact representation if needed.<br>
>>><br>
>>> In this case the directory structure could be .glusterfs/M/gfid[0:2]/gfid[2:4]/gfid. And use M = 0 to put all current existing gfid's, or we could leave existing gfid's in their current location.<br>
>>><br>
>>> Or we could even have .glusterfs/NM/gfid[0:2]/gfid[2:4]/gfid. This would probably be compatible even with future extensions.<br>
>>><br>
>><br>
>> I would go with only 'M' being considered for current layout and keeping N for future developments. Even though we are not considering 'N' internally, we can keep directory name as '00MM' (zero zero M M). so that backend layout would be compatible to consider N later if required.<br>
>><br>
>> One major thing is we need a solid plan for migration from current layout to newer layout.<br>
>><br>
>> Regards,<br>
>> Amar<br>
>>  <br>
>>><br>
>>> Xavi<br>
>>><br>
>>><br>
>>><br>
>>>>><br>
>>>>> Xavi<br>
>>>>><br>
>>>>> [1] https://www.ietf.org/rfc/rfc4122.txt<br>
>>>>><br>
>>>>>><br>
>>>>>> Changes:<br>
>>>>>> ---------<br>
>>>>>> - Code changes to accommodate 17 bytes GFID instead of 16 bytes(Read<br>
>>>>>>   and Write)<br>
>>>>>> - Migration Tool to upgrade GFIDs in Volume/Cluster<br>
>>>>>><br>
>>>>>> Let me know your thoughts.<br>
>>>>>><br>
>>>>><br>
>>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Gluster-devel mailing list<br>
>>> Gluster-devel@gluster.org<br>
>>> http://www.gluster.org/mailman/listinfo/gluster-devel<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Gluster-devel mailing list<br>
>> Gluster-devel@gluster.org<br>
>> http://lists.gluster.org/mailman/listinfo/gluster-devel<br>
><br>
><br>
><br>
><br>
> -- <br>
> Amar Tumballi (amarts)<br></p>