Skip to content

Base implementation of IDisk interafce for S3#8649

Merged
alexey-milovidov merged 5 commits intoClickHouse:masterfrom
GrigoryPervakov:vfs-s3
Jan 20, 2020
Merged

Base implementation of IDisk interafce for S3#8649
alexey-milovidov merged 5 commits intoClickHouse:masterfrom
GrigoryPervakov:vfs-s3

Conversation

@GrigoryPervakov
Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • New Feature

Changelog entry (up to few sentences, required except for Non-significant/Documentation categories):

Add base implementation for IDisk interface for S3 storage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a magic number 17?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current s3 object name is root_path + path + '.' + random string of 16 chars. Here I cut random suffix with a dot.

Comment on lines 47 to 57
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clearDirectory method should removes only files (see #8356 (comment)). Probably we need to add some option to clearDirectory for removing directories as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't table_path itself be deleted as well?

Copy link
Copy Markdown
Member Author

@GrigoryPervakov GrigoryPervakov Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we need to add void remove(const String & path, bool recursive); in IDisk interface.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To better decouple data and metadata I'd generate s3_to_path something like s3_root_path + '.storage/' + getRandomFilename().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had preferred to add origin filename to make bucket content more human-readable and reduce the probability of name overlap.


auto file_it = files.find(path);
if (file_it == files.end())
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't throw an exception?

/**
* Storage for persisting data in S3 and metadata on the local disk.
* Files are represented by file in local filesystem (clickhouse_root/disks/disk_name/path/to/file)
* that contains S3 object key with actual data.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also should contain file size.


public:
/// Used for reservation counters modification
static std::mutex reservationMutex;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very strange.

void finalize() override
{
WriteBufferFromS3::finalize();
Poco::FileOutputStream(metadata_path) << s3_path;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if error is checked.

@alexey-milovidov alexey-milovidov mentioned this pull request Jan 18, 2020
@alexey-milovidov alexey-milovidov merged commit 530e7e3 into ClickHouse:master Jan 20, 2020
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.

3 participants