Repository navigation
Support move and tag action for S3/Azure Queue table engines - #86907
Conversation
|
Workflow [PR], commit [544263f] Summary: ❌
|
2216fe6 to
ecefa93
Compare
9f45a31 to
c50be46
Compare
c50be46 to
33dc38d
Compare
| auto az_context = Azure::Core::Context(); | ||
| return static_credential_a->get()->GetToken(tokenRequestContext, az_context).Token == static_credential_b->get()->GetToken(tokenRequestContext, az_context).Token; | ||
| } | ||
| return compareAzureAuthMethod(auth_method_a, auth_method_b); |
There was a problem hiding this comment.
Moved the method body as compareAzureAuthMethod() to common place, to be reachable by src/Storages/ObjectStorageQueue/ObjectStorageQueuePostProcessor.cpp
| @@ -138,6 +138,13 @@ class CachedObjectStorage final : public IObjectStorage | |||
| } | |||
| #endif | |||
|
|
|||
| #if USE_AZURE_BLOB_STORAGE || USE_AWS_S3 | |||
| void tagObjects(const StoredObjects & objects, const std::string & tag_key, const std::string & tag_value) override | |||
There was a problem hiding this comment.
Cached object storage seems to be working on top of some other storage, so it makes sense to support tagObjects() for the case of Azure/S3 underlying storage.
| @@ -11,4 +11,13 @@ size_t getTotalSize(const StoredObjects & objects) | |||
| return size; | |||
| } | |||
|
|
|||
| Strings collectRemotePaths(const StoredObjects & objects) | |||
There was a problem hiding this comment.
Put this into a common place as it's used by both Azure/S3 storage implementations
| extern const int LOGICAL_ERROR; | ||
| } | ||
|
|
||
| ObjectStorageQueuePostProcessor::ObjectStorageQueuePostProcessor( |
There was a problem hiding this comment.
The after-processing logic was duplicated in src/Storages/ObjectStorageQueue/StorageObjectStorageQueue.cpp and src/Storages/ObjectStorageQueue/ObjectStorageQueueSource.cpp. It was fine as it only took few lines of code.
This PR extends the logic with more actions, so I extracted it into a class, ObjectStorageQueuePostProcessor, to be used in the commit() methods.
| @@ -4789,6 +4789,25 @@ def grep_in_log( | |||
| logging.debug("grep result %s", result) | |||
| return result | |||
|
|
|||
| def count_log_lines( | |||
There was a problem hiding this comment.
This is an attempt to fix the failing (but unrelated) test test_streaming_to_many_views. It reads a fixed size tail of the log to check something. But depending on log verbosity, needed lines can slip from the tail. I saw an attempt to fix it by increasing tail size (100k -> 200k). However, I think this approach with calculating the exact reading position is more reliable.
I can extract this idea into a separate PR. It might be off-topic here.
| @@ -1659,7 +1659,10 @@ def ignore_exceptions(f, *args): | |||
| ) | |||
| long_select.start() | |||
|
|
|||
| sleep_start_time = time.time() | |||
There was a problem hiding this comment.
This is an attempt to investigate the failing (unrelated) test. My guess is that duration check can be flaky as it includes time.sleep() that doesn't guarantee upper bound.
I can scrap these changes as the fail hasn't repeated.
| total_values = generate_random_files( | ||
| started_cluster, files_path, files_num, row_num=row_num, storage=storage | ||
| ) | ||
| create_table( |
There was a problem hiding this comment.
Main steps in tag/move tests are mostly copy/pasted from test_delete_after_processing
| if engine_name == "S3Queue": | ||
| recreate_minio_bucket(started_cluster, processed_bucket) | ||
| else: | ||
| recreate_azurite_container(started_cluster, processed_bucket) |
There was a problem hiding this comment.
The move test is different from other tests here: it creates a new bucket in case of a move across buckets.
| @@ -507,6 +726,8 @@ def get_rows_count(): | |||
| create_dst_table_first=False | |||
| ) | |||
|
|
|||
| log_line_offset = node.count_log_lines() | |||
There was a problem hiding this comment.
Attempt to fix failing (unrelated) test
|
CI failures seem unrelated to my changes. Also, I've added some explanatory comments to the code. |
If action is set to move, objects can be moved to a different path prefix or another bucket/container. Move requires additional table settings such as new path prefix, or bucket URL and credentials in case of S3, or connection string and container name in case of Azure. Tag requires addtional settings to pass tag key and value.
…t_3.py::test_upgrade_2
kssenii
left a comment
There was a problem hiding this comment.
Huge thanks for adding this feature!
|
@mxwell could you please adjust test |
Sure. And just to reiterate: after my updates, no |
|
Yes, ok to remove. Though it could cause an issue if there are servers with different versions on the cluster with DatabaseReplicated - one of which on a version without this PR and if s3queue table is created on a server with version containing this PR. (then a replica on older version could fail to create a table with error about s3queue metadata failing to parse because of a missing field), so I makes sense to leave just |
This PR also introduces new possible values. I haven't checked, but it looks like an old server might not work if the keeper has Should the new version stick to these 2 values only? So that Can you please confirm a preferable option? |
|
Let's just keep only after processing action in keeper, it is less likely that a new feature is used before upgrade of all replicas is finished. |
|
Hi everyone! I can’t figure out how to move processed files to another folder while preserving the lower-level directory structure. Example: The source file is located at I want it, after processing, to be moved to What I’m getting now is CREATE TABLE ... the file ends up at How can I do this correctly? |
Not possible right now. Only file name is preserved during the move: Possible direction for development I wonder what are good examples from other tools or languages that express the desired behavior. I see that rsync has Maybe This is only my thoughts. It would be interesting to hear someone from the team. |
Thanks! You can specify two prefixes in the settings — a source prefix and a target prefix — and perform a string replacement during the transfer. In practice, for example, this is similar to copying a folder with nested subfolders and files into another directory within a file system. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Users can now configure S3/Azure Queue tables to move or tag processed files, in addition to the previous options to keep or remove files. Resolves #72944
Documentation entry for user-facing changes
Details
If post processing action is set to move, processed objects can be moved to a different path prefix or another bucket/container. Move requires additional table settings such as:
Tagging requires additional settings to pass tag key and value.
Resolves #72944