File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3 Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ class S3BlobStore implements BlobStore {
116116 S3RepositoriesMetrics s3RepositoriesMetrics ,
117117 BackoffPolicy retryThrottledDeleteBackoffPolicy
118118 ) {
119+ // TODO: add a projectId field, maybe null for cluster level blobstore
119120 this .service = service ;
120121 this .bigArrays = bigArrays ;
121122 this .bucket = bucket ;
@@ -311,6 +312,7 @@ public String toString() {
311312 }
312313
313314 public AmazonS3Reference clientReference () {
315+ // TODO: change to service.client(projectId, repositoryMetadata)
314316 return service .client (repositoryMetadata );
315317 }
316318
Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ class S3Repository extends MeteredBlobStoreRepository {
292292 buildBasePath (metadata ),
293293 buildLocation (metadata )
294294 );
295+ // TODO: add a projectId field
295296 this .service = service ;
296297 this .s3RepositoriesMetrics = s3RepositoriesMetrics ;
297298 this .snapshotExecutor = threadPool ().executor (ThreadPool .Names .SNAPSHOT );
Original file line number Diff line number Diff line change @@ -168,15 +168,20 @@ public AmazonS3Reference client(RepositoryMetadata repositoryMetadata) {
168168 }
169169
170170 /**
171- * Delegates to {@link #client(RepositoryMetadata)} if per-project client is disabled.
171+ * Delegates to {@link #client(RepositoryMetadata)} when
172+ * 1. per-project client is disabled
173+ * 2. or when the blobstore is cluster level (projectId = null)
172174 * Otherwise, attempts to retrieve a per-project client by the project-id and repository metadata from the
173- * per-project client manager.
174- * Throws if project-id or the client does not exist. The client maybe initialized lazily.
175+ * per-project client manager. Throws if project-id or the client does not exist. The client maybe initialized lazily.
175176 */
176177 public AmazonS3Reference client (ProjectId projectId , RepositoryMetadata repositoryMetadata ) {
177178 if (perProjectClientManager == null ) {
179+ // Multi-Project is disabled and we have a single default project
178180 assert ProjectId .DEFAULT .equals (projectId ) : projectId ;
179181 return client (repositoryMetadata );
182+ } else if (projectId == null ) {
183+ // Multi-Project is enabled and we are retrieving a client for the cluster level blobstore
184+ return client (repositoryMetadata );
180185 } else {
181186 return perProjectClientManager .client (projectId , repositoryMetadata );
182187 }
You can’t perform that action at this time.
0 commit comments