-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GLUTEN-6590] Support compact mergetree file on s3
- Loading branch information
Showing
7 changed files
with
184 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
|
||
#include "GlutenDiskS3.h" | ||
#include <Disks/ObjectStorages/DiskObjectStorage.h> | ||
#include <Parser/SerializedPlanParser.h> | ||
#include "CompactObjectStorageDiskTransaction.h" | ||
|
||
#if USE_AWS_S3 | ||
namespace local_engine | ||
{ | ||
|
||
DB::DiskTransactionPtr GlutenDiskS3::createTransaction() | ||
{ | ||
return std::make_shared<CompactObjectStorageDiskTransaction>(*this, SerializedPlanParser::global_context->getTempDataOnDisk()->getVolume()->getDisk()); | ||
} | ||
|
||
std::unique_ptr<ReadBufferFromFileBase> GlutenDiskS3::readFile( | ||
const String & path, | ||
const ReadSettings & settings, | ||
std::optional<size_t> read_hint, | ||
std::optional<size_t> file_size) const | ||
{ | ||
ReadSettings copy_settings = settings; | ||
// Threadpool read is not supported for s3 compact version currently | ||
copy_settings.remote_fs_method = RemoteFSReadMethod::read; | ||
return DiskObjectStorage::readFile(path, copy_settings, read_hint, file_size); | ||
} | ||
|
||
DiskObjectStoragePtr GlutenDiskS3::createDiskObjectStorage() | ||
{ | ||
const auto config_prefix = "storage_configuration.disks." + name; | ||
return std::make_shared<GlutenDiskS3>( | ||
getName(), | ||
object_key_prefix, | ||
getMetadataStorage(), | ||
getObjectStorage(), | ||
SerializedPlanParser::global_context->getConfigRef(), | ||
config_prefix, | ||
object_storage_creator); | ||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
|
||
#include <Disks/ObjectStorages/DiskObjectStorage.h> | ||
#include <Parser/SerializedPlanParser.h> | ||
#include "CompactObjectStorageDiskTransaction.h" | ||
|
||
#if USE_AWS_S3 | ||
namespace local_engine | ||
{ | ||
class GlutenDiskS3 : public DB::DiskObjectStorage | ||
{ | ||
public: | ||
GlutenDiskS3( | ||
const String & name_, | ||
const String & object_key_prefix_, | ||
DB::MetadataStoragePtr metadata_storage_, | ||
DB::ObjectStoragePtr object_storage_, | ||
const Poco::Util::AbstractConfiguration & config, | ||
const String & config_prefix, | ||
std::function<DB::ObjectStoragePtr(const Poco::Util::AbstractConfiguration & conf, DB::ContextPtr context)> creator) | ||
: DiskObjectStorage(name_, object_key_prefix_, metadata_storage_, object_storage_, config, config_prefix), | ||
object_storage_creator(creator) {} | ||
|
||
DB::DiskTransactionPtr createTransaction() override; | ||
|
||
std::unique_ptr<ReadBufferFromFileBase> readFile( | ||
const String & path, | ||
const ReadSettings & settings, | ||
std::optional<size_t> read_hint, | ||
std::optional<size_t> file_size) const override; | ||
|
||
DiskObjectStoragePtr createDiskObjectStorage() override; | ||
|
||
private: | ||
std::function<DB::ObjectStoragePtr(const Poco::Util::AbstractConfiguration & conf, DB::ContextPtr context)> object_storage_creator; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters