Skip to content

Adds new StorageDriver.FileWriter interface - #1438

Merged
BrianBland merged 7 commits into
distribution:masterfrom
BrianBland:newStorageDriverWriter
Mar 11, 2016
Merged

BrianBland merged 7 commits into
distribution:masterfrom
BrianBland:newStorageDriverWriter

Conversation

@BrianBland

Copy link
Copy Markdown
Contributor

Implements new StorageDriver.FileWriter interface as defined in #1395

Currently works for the following drivers:

  • S3 (aws)
  • S3 (goamz)
  • Filesystem
  • Inmemory
  • Azure
  • Swift
  • GCS
  • OSS

@BrianBland
BrianBland force-pushed the newStorageDriverWriter branch 8 times, most recently from f6a308b to c5be337 Compare February 10, 2016 22:54
@BrianBland

Copy link
Copy Markdown
Contributor Author

@docker/distribution-maintainers I think the changes to registry/storage are ready for review before finishing up with the Swift/GCS/Rados drivers

@aaronlehmann

Copy link
Copy Markdown

This is a bit difficult to review in the current state because of the huge vendoring commit. Github can't display the diff because it's too big. I commented on the actual commit earlier, but the comment seems to have been lost after a rebase.

If #1385 is ready to merge, merging it would make things easier here.

@BrianBland

Copy link
Copy Markdown
Contributor Author

Very understandable. I believe #1385 is ready to go...

@BrianBland

Copy link
Copy Markdown
Contributor Author

Unfortunately that one isn't easy to review either

@stevvooe

Copy link
Copy Markdown
Collaborator

LGTM on the interface changes except for the Size() method.

@BrianBland
BrianBland force-pushed the newStorageDriverWriter branch 8 times, most recently from 1f3d6e2 to 309ef74 Compare February 16, 2016 23:13
@BrianBland BrianBland added this to the Registry/2.4 milestone Feb 17, 2016
@BrianBland
BrianBland force-pushed the newStorageDriverWriter branch from 309ef74 to 0c5e0fc Compare February 17, 2016 23:20
@BrianBland

Copy link
Copy Markdown
Contributor Author

This is going to be sort of a challenge to merge without temporarily disabling some of the community drivers. I don't have a reasonable test environment for swift, rados, or oss.

@lebauce / @nevermosby could either of you update the swift driver to the new specification and make a PR to my fork?

@gierschv could you help update the rados driver?

@denverdino / @liuchang0812 could you help with the OSS driver?

@denverdino

Copy link
Copy Markdown
Contributor

@BrianBland , Sure, I will change the OSS driver

@denverdino

Copy link
Copy Markdown
Contributor

@BrianBland , the PR of Support FileWriter interface for OSS storage driver is submitted.

denverdino and others added 2 commits March 8, 2016 16:38
Change-Id: Ie5533ad85f944800499ca1040fd67bf1378815e0
Signed-off-by: Li Yi <[email protected]>
@BrianBland

Copy link
Copy Markdown
Contributor Author

As part of this refactor, I've decided to remove the rados driver in favor of the updated Swift driver.

Anyone who wishes to use the registry with Ceph as the underlying storage backend should use the Ceph Object Gateway. I've successfully tested this with the Swift driver using a configuration such as:

swift:
  authurl: http://192.168.33.10:7480/auth/v1
  username: "testuser:swift"
  password: "mypassword"
  container: testing

It's possible that this also works correctly with the S3 driver thanks to #1512, but v4 auth support was only just merged into Ceph as of ceph/ceph#4943 (26 days ago), so it's doubtful that production deployments currently support this, and the stability is as of yet unverified.

@BrianBland
BrianBland force-pushed the newStorageDriverWriter branch from f378028 to 4a2f207 Compare March 11, 2016 00:47
@BrianBland
BrianBland force-pushed the newStorageDriverWriter branch from 4a2f207 to 0b89ccf Compare March 11, 2016 00:47
@BrianBland BrianBland changed the title [WIP] Adds new StorageDriver.FileWriter interface Adds new StorageDriver.FileWriter interface Mar 11, 2016
@codecov-io

Copy link
Copy Markdown

Current coverage is 58.09%

Merging #1438 into master will decrease coverage by -1.66% as of 5967d33

@@            master   #1438   diff @@
======================================
  Files          128     122     -6
  Stmts        10956   10568   -388
  Branches       885     833    -52
  Methods          0       0       
======================================
- Hit           6547    6140   -407
+ Partial        885     833    -52
- Missed        3524    3595    +71

Review entire Coverage Diff as of 5967d33


Uncovered Suggestions

  1. +0.21% via registry/registry.go#106...127
  2. +0.18% via registry/registry.go#217...235
  3. +0.17% via .../driver/s3-aws/s3.go#738...754
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@dmcgowan

Copy link
Copy Markdown
Collaborator

LGTM on interface and handler changes

@stevvooe

Copy link
Copy Markdown
Collaborator

LGTM

@BrianBland I'm not sure what to do on the rados driver. I'd prefer to drop support if we don't have a maintainer.

@RichardScothern

Copy link
Copy Markdown

@stevvooe with some judicious documentation, I don't think the ceph driver will be missed.

Any ceph user can put the swift gateway in front of their cluster and use the swift driver (and soon the s3 driver). In fact, Swift supports the S3 API, so we could conceivably rid ourselves of that driver too 😹

@RichardScothern

Copy link
Copy Markdown

LGTM. This is great in a number of ways 👏 👏 👏

BrianBland added a commit that referenced this pull request Mar 11, 2016
Adds new StorageDriver.FileWriter interface
@BrianBland
BrianBland merged commit c03b5fc into distribution:master Mar 11, 2016
@BrianBland
BrianBland deleted the newStorageDriverWriter branch March 11, 2016 23:06
@stevvooe

Copy link
Copy Markdown
Collaborator

👍

dalsh pushed a commit to dalsh/distribution that referenced this pull request Jan 13, 2017
See distribution#2077 for background.

The PR distribution#1438 which was not reviewed by azure folks basically introduced
a race condition around uploads to the same blob by multiple clients
concurrently as it used the "writer" type for PutContent(), introduced in distribution#1438.
This does chunked upload of blobs using "AppendBlob" type, which was not atomic.

Usage of "writer" type and thus AppendBlobs on metadata files is currently not
concurrency-safe and generally, they are not the right type of blob for the job.

This patch fixes PutContent() to use the atomic upload operation that works
for uploads smaller than 64 MB and creates blobs with "BlockBlob" type. To be
backwards compatible, we query the type of the blob first and if it is not
a "BlockBlob" we delete the blob first before doing an atomic PUT. This
creates a small inconsistency/race window "only once". Once the blob is made
"BlockBlob", it is overwritten with a single PUT atomicallly next time.

Therefore, going forward, PutContent() will be producing BlockBlobs and it
will silently migrate the AppendBlobs introduced in distribution#1438 to BlockBlobs with
this patch.

Tested with existing code side by side, both registries with and without this
patch work fine without breaking each other. So this should be good from a
backwards/forward compatiblity perspective, with a cost of doing an extra
HEAD checking the blob type.

Fixes distribution#2077.

Signed-off-by: Ahmet Alp Balkan <[email protected]>
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Apr 22, 2021
…Writer

Adds new StorageDriver.FileWriter interface
thaJeztah pushed a commit to thaJeztah/distribution that referenced this pull request Jan 19, 2022
…Writer

Adds new StorageDriver.FileWriter interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.