leo-project / leofs

The LeoFS Storage System
https://leo-project.net/leofs/
Apache License 2.0
1.55k stars 155 forks source link

[s3] Update ACL resets all other settings #470

Open windkit opened 8 years ago

windkit commented 8 years ago

Description

When I attempted to test with erasure coding in 1.4, I observed the following issue. update the acl of a bucket would always reset the redundancy method to replication

./leofs-adm add-bucket test3 05236
OK

~/leofs$ ./leofs-adm set-redundancy-method test3 05236 erasure-code 10 4
OK

~/leofs$ ./leofs-adm get-buckets
cluster id   | bucket   | owner       | permissions                            | redundancy method            | created at
-------------+----------+-------------+----------------------------------------+------------------------------+---------------------------
leofs_1      | test3    | _test_leofs | Me(full_control)                       | erasure_code, {k:10, m:4}    | 2016-04-01 15:48:31 +0900

~/leofs$ ./leofs-adm update-acl test3 05236 public-read-write
OK

~/leofs$ ./leofs-adm get-buckets
cluster id   | bucket   | owner       | permissions                            | redundancy method            | created at
-------------+----------+-------------+----------------------------------------+------------------------------+---------------------------
leofs_1      | test3    | _test_leofs | Me(full_control), Everyone(read,write) | copy, {n:2, w:1, r:1, d:1}   | 2016-04-01 15:48:31 +0900

Cause

https://github.com/leo-project/leo_s3_libs/blob/develop/src/leo_s3_bucket.erl#L527

                    leo_s3_bucket_data_handler:insert({DB, ?BUCKET_TABLE},
                                                      #?BUCKET{name = Bucket,
                                                               access_key_id = AccessKey,
                                                               acls = ACLs,
                                                               cluster_id = ClusterId,
                                                               last_synchroized_at = Now,
                                                               last_modified_at = Now,
                                                               created_at = CreatedAt});

Therefore the settings are always reset

yosukehara commented 8 years ago

@mocchira I've assigned you to fix this issue. It would be nice if you communicate with @windkit.