Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Fix replication bug, add gdb opt to pytest #513

Merged
merged 2 commits into from
Nov 28, 2022

Conversation

dranikpg
Copy link
Contributor

Fixes bug in replica.cc

Add option to run instances inside gdb

Comment on lines +34 to +38
args = [self.params.path, *arglist]
if self.params.gdb:
args = ["gdb", "--ex", "r", "--args"] + args
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this option is worth it.

Its helpful for me, because in case of a bad signal, the whole process stops. Once brought back to foreground, gdb is directly active and can be used to get stacktrace/dump variables/stack.

However, it doesn't allow customizing anything before start. Like selecting only a few instances, or setting breakpoints. The latter can be fixed by making the gdb parameter a string and forwarding it to gdb, so just --gdb becomes --gdb="break dflycmd.cc:100; break replica.cc:100"

@romange romange self-requested a review November 25, 2022 17:07
@dranikpg dranikpg marked this pull request as draft November 25, 2022 17:22
@dranikpg dranikpg marked this pull request as ready for review November 28, 2022 14:02
@dranikpg
Copy link
Contributor Author


// Start rdb saving.
SaveMode mode = shard == nullptr ? SaveMode::SUMMARY : SaveMode::SINGLE_SHARD;
std::error_code local_ec = snapshot->Start(mode, abs_path.generic_string(), scripts);
error_code local_ec = snapshot->Start(mode, full_path.generic_string(), scripts);
Copy link
Collaborator

Choose a reason for hiding this comment

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

was it a bug, @dranikpg ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is refactoring included. I broke it in the last PR unknowingly

@romange
Copy link
Collaborator

romange commented Nov 28, 2022

LGTM. For the protocol, can you tell what the bugs were?

@dranikpg
Copy link
Contributor Author

dranikpg commented Nov 28, 2022

  1. Accessing replica's sync block in wrong scope when it already might be out of scope (stack placed). We could have solved it with using a shared_ptr, but this is also a logical error - no reason to do any more operations, even if they have no effect
  2. Casting path to string by mistake and making resulting path building wrong for save df

@dranikpg
Copy link
Contributor Author

The third change was increasing some general wait points in pytests, because the CI env is really slow. However, this has also the benefit of catching multi-threading bugs that are hard to reproduce on fast machines

@romange romange merged commit 2493434 into dragonflydb:main Nov 28, 2022
@dranikpg dranikpg deleted the fix-replica-bug branch November 29, 2022 22:35
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