Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(shell): support resolve IP address in dsn/utility #337

Merged
merged 48 commits into from
Nov 19, 2019

Conversation

Smityz
Copy link
Contributor

@Smityz Smityz commented Nov 8, 2019

What problem does this PR solve?

  • Return original IP address if resolve failed
  • Move util functions into dsn/utility

What is changed and how it works?

// valid a.b.c.d:port -> return TRUE && hostname_result=hostname:port
// | invalid a.b.c.d:port1-> return FALSE  && hostname_result=a.b.c.d:port
bool hostname_from_ip_port(const char *ip_port, std::string *hostname_result);

Check List

Tests

  • Unit test
    I add a unit test in /src/core/tests/hostname.cpp
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to be included in the release note

@neverchanje neverchanje changed the title utils:support resolve IP address in ddl_client utils: support resolve IP address in ddl_client Nov 11, 2019
@Smityz Smityz changed the title utils: support resolve IP address in ddl_client BREAKING CHANGE: the return value of a series of hostname_from_ip has changed into bool, the result is returned by the pointer now Nov 11, 2019
@Smityz Smityz changed the title BREAKING CHANGE: the return value of a series of hostname_from_ip has changed into bool, the result is returned by the pointer now feat(shell):add resolve functions in some commands Nov 12, 2019
@Smityz Smityz changed the title feat(shell):add resolve functions in some commands feat(shell): support resolve IP address in ddl_client Nov 12, 2019
include/dsn/dist/replication/replication_ddl_client.h Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/dist/replication/ddl_lib/replication_ddl_client.cpp Outdated Show resolved Hide resolved
src/tests/dsn/CMakeLists.txt Outdated Show resolved Hide resolved
@Smityz Smityz changed the title feat(shell): support resolve IP address in ddl_client feat(shell): support resolve IP address in dsn/utility Nov 18, 2019
src/core/core/utils.cpp Outdated Show resolved Hide resolved
acelyc111
acelyc111 previously approved these changes Nov 18, 2019
Copy link
Member

@vagetablechicken vagetablechicken left a comment

Choose a reason for hiding this comment

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

👏

@Smityz Smityz merged commit 7e3b042 into XiaoMi:master Nov 19, 2019
// valid a.b.c.d -> return TRUE && hostname_result=hostname | invalid a.b.c.d:port1 -> return
// FALSE
// && hostname_result=a.b.c.d
bool hostname_from_ip(const char *ip, std::string *hostname_result);
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么不直接写一个新文件 hostname_utils.h/hostname_utils.cpp 啊,utils.h 里的东西太杂了,很难管理

namespace dsn {
namespace replication {

TEST(ip_to_hostname, localhost)
Copy link
Contributor

Choose a reason for hiding this comment

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

同上,建议改名 hostname_utils_test.cpp

Smityz added a commit to Smityz/rdsn that referenced this pull request Nov 21, 2019
feat(shell): support resolve IP address in dsn/utility (XiaoMi#337)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants