Skip to content

Don't save shard config in LocalShard::create_snapshot - #4997

Merged
xzfc merged 1 commit into
devfrom
dont-save-shard-config
Sep 2, 2024
Merged

xzfc merged 1 commit into
devfrom
dont-save-shard-config

Conversation

@xzfc

@xzfc xzfc commented Sep 1, 2024

Copy link
Copy Markdown
Member

This PR removes code to save shard config in LocalShard::create_snapshot.

Reason: this file is getting overwritten in the only code path in which this method is called. So, no need to write it in the first place. Here is the call graph:

graph TD
    Collection::create_snapshot --> ShardReplicaSet::create_snapshot
    ForwardProxyShard::create_snapshot --> LocalShard::create_snapshot
    ProxyShard::create_snapshot --> LocalShard::create_snapshot
    QueueProxyShard::create_snapshot --> LocalShard::create_snapshot
    ShardReplicaSet::create_snapshot --> Shard::create_snapshot
    Shard::create_snapshot --> LocalShard::create_snapshot
    Shard::create_snapshot --> ProxyShard::create_snapshot
    Shard::create_snapshot --> ForwardProxyShard::create_snapshot
    Shard::create_snapshot --> QueueProxyShard::create_snapshot
    Shard::create_snapshot --> DummyShard::create_snapshot
    ShardHolder::creste_shard_snapshot --> ShardReplicaSet::create_snapshot
    _do_create_full_snapshot --> TableOfContent::create_snapshot
    TableOfContent::create_snapshot --> Collection::create_snapshot
    do_create_snapshot --> TableOfContent::create_snapshot

    class ShardReplicaSet::create_snapshot highlight1
    class LocalShard::create_snapshot highlight2

    classDef highlight1 color:#77FF77,fill:#222222
    classDef highlight2 color:#FF7777,fill:#222222
Loading

$${\texttt{\color{#ff7777}Red node}},$$ LocalShard::create_snapshot: removed code (this PR).
$${\texttt{\color{#77ff00}Green node}},$$ ShardReplicaSet::create_snapshot: overwrites this file with {"type":"ReplicaSet"}.

I've stumbled into this when updating the code to build a snapshot archive without copying files to a temporary directory. Adding two files with the same name to an archive is problematic.

@xzfc
xzfc requested review from generall and timvisee September 1, 2024 23:35
@xzfc
xzfc force-pushed the dont-save-shard-config branch from b30dfa2 to e89f7c6 Compare September 2, 2024 00:22
@xzfc
xzfc merged commit f32dcd7 into dev Sep 2, 2024
@xzfc
xzfc deleted the dont-save-shard-config branch September 2, 2024 12:34
@timvisee timvisee mentioned this pull request Sep 17, 2024
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.

2 participants