New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCS offload support(2): replace s3client
api with jclouds
related api
#2065
Conversation
84e0fbe
to
61c1c09
Compare
retest this please error:
|
69edf1d
to
808603f
Compare
s3client
api with jclouds
related api s3client
api with jclouds
related api
f27b4c2
to
000675e
Compare
s3client
api with jclouds
related api s3client
api with jclouds
related api
Seems integration test still have some issue, change back to Work In Progress |
7fd22ee
to
95cff33
Compare
retest this please |
s3client
api with jclouds
related api s3client
api with jclouds
related api
<include>org.apache.jclouds.api:*</include> | ||
<include>org.apache.jclouds.common:*</include> | ||
<include>org.apache.jclouds.provider:*</include> | ||
<include>com.google.inject.extensions:guice-assistedinject</include> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are new dependencies, which need to be accounted for in the LICENSE/NOTICE.
pom.xml
Outdated
@@ -101,6 +101,8 @@ flexible messaging model and an intuitive client API.</description> | |||
<module>tests</module> | |||
<module>pulsar-log4j2-appender</module> | |||
<module>protobuf-shaded</module> | |||
<!-- jclouds shaded for gson conflict: https://issues.apache.org/jira/browse/JCLOUDS-1166 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're shading so much crap. there must be a better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ivankelly, Opened issue #2164 for this. Once it is done we could remove this shading.
@@ -268,6 +268,12 @@ | |||
<version>${project.version}</version> | |||
<scope>test</scope> | |||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to remove the aws s3 dependency too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, Seems as you commented, the AWSCredentials related things could not get out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need the full s3 dependency now, just whatever AWSCredentials is in.
<dependency> | ||
<groupId>org.apache.jclouds</groupId> | ||
<artifactId>jclouds-allblobstore</artifactId> | ||
<version>2.2.0-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SNAPSHOT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, 2.2.1 has some issue related with gcs multi-part upload, so we use the latest. This is tracked in #2164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it'll have to be updated before an actual release.
VersionCheck versionCheck, | ||
long objectLen, int bufferSize) { | ||
this.s3client = s3client; | ||
public BackedInputStreamImpl(BlobStore blobStore, String bucket, String key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename BlobStoreBackedInputStreamImpl
@@ -123,6 +191,10 @@ static String indexBlockOffloadKey(long ledgerId, UUID uuid) { | |||
return String.format("%s-ledger-%d-index", uuid.toString(), ledgerId); | |||
} | |||
|
|||
public boolean createBucket() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will remove it. If needed, we could add it in the future.
etags.add(uploadRes.getPartETag()); | ||
Payload partPayload = Payloads.newInputStreamPayload(blockStream); | ||
partPayload.getContentMetadata().setContentLength((long)blockSize); | ||
partPayload.getContentMetadata().setContentType("text/plain"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not text/plain. It's application/octet-stream if anything
addVersionInfo(blobBuilder); | ||
Payload indexPayload = Payloads.newInputStreamPayload(indexStream); | ||
indexPayload.getContentMetadata().setContentLength((long)indexStream.getStreamSize()); | ||
indexPayload.getContentMetadata().setContentType("text/plain"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
application/octet-stream
blobStore.removeBlob(bucket, dataBlockOffloadKey(ledgerId, uid)); | ||
blobStore.removeBlob(bucket, indexBlockOffloadKey(ledgerId, uid)); | ||
// adobe/s3mock not support removeBlobs well. | ||
/*blobStore.removeBlobs(bucket, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are shipping out own s3mock, we should fix it.
And I don't understand how it doesn't support removeBlobs if deleteObjects worked fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will changed it back to have a try.
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
|
||
public class BlobStoreTestBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3TestBase and the mock can be deleted now, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3TestBase had a feature to allow the test to use real AWS if a system property was set. It would be good to have something similar here to validate that the code is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, would like to do it later. opened issue #2165 to track this work.
e5749a4
to
3e7aad7
Compare
@ivankelly Thanks for the comments, updated this PR. |
try { | ||
Blob blob = blobStore.getBlob(bucket, key); | ||
versionCheck.check(key, blob); | ||
PayloadSlicer slicer = new BasePayloadSlicer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slicer isnt what you need here. getBlob can take a GetOptions parameter. You can set the range in that.
retest this please |
60d6d33
to
cf020a7
Compare
<dependency> | ||
<groupId>org.apache.jclouds</groupId> | ||
<artifactId>jclouds-allblobstore</artifactId> | ||
<version>2.2.0-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it'll have to be updated before an actual release.
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class S3BackedReadHandleImpl implements ReadHandle { | ||
private static final Logger log = LoggerFactory.getLogger(S3BackedReadHandleImpl.class); | ||
public class BackedReadHandleImpl implements ReadHandle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be BlobStoreBackedReadHandleImpl. Basically, anywhere you removed S3 we should have BlobStore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will change it, if you insist on this.
log.error("Exception when get credentials for s3 ", e); | ||
} | ||
|
||
String id = "accesskey"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default these to ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. will keep this default value. empty string will meet error in jclouds.
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class S3ManagedLedgerOffloader implements LedgerOffloader { | ||
private static final Logger log = LoggerFactory.getLogger(S3ManagedLedgerOffloader.class); | ||
public class ManagedLedgerOffloader implements LedgerOffloader { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to BlobStoreManagedLedgerOffloader
@@ -268,6 +268,12 @@ | |||
<version>${project.version}</version> | |||
<scope>test</scope> | |||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need the full s3 dependency now, just whatever AWSCredentials is in.
retest this please for C++/Python Tests build error |
I know it is approved. let's not merge this until I cut 2.1 release. |
This is the third part to support Google Cloud Storage offload. It aims to support GCS related config in `ManagedLedgerOffloader`. It is based on PR #2065. Please only review the commits after [e5b1f7a](e5b1f7a). Currently it passed the real test in GCS, by test case [ManagedLedgerOffloaderTest#testGcsRealOffload](eda5097#diff-6387a2ab4cf9c9243135b5a34c8522efR584), since lack of GCS mock docker image, will try to use read GCS to do the integration test in later PR. Master Issue: #2067
This is the second part to support
Google Cloud Storage
offload.It aims to replace "s3 client" api with "jclouds" api, and make sure unit test and integration test passed.
There will be a following change to add
Google Cloud Storage
support and related test.change:
replace
s3client
api withjclouds
related api inS3ManagedLedgerOffloader
Master Issue: #2067