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 breeze kvstore nodes oputput #12

Closed
wants to merge 3 commits into from
Closed

Conversation

tamihiro
Copy link
Contributor

@tamihiro tamihiro commented Dec 3, 2017

Description:

  • breeze kvstore nodes returned ugly output because the original code extended a list of string objects with a unicode object (prefix_strs).
  • Fixed it so as to pass a properly formatted list of loopback addresses as an argument instead of prefix_strs.

Test Plan:

  • ran the command on my lab setup and confirmed the fix.
$ breeze kvstore nodes
Node             V6-Loopback      V4-Loopback
---------------  ---------------  -------------
* ubuntu-opnr-1  2001:db8::1/128  10.0.0.1/32
> ubuntu-opnr-2  2001:db8::2/128  10.0.0.2/32
> ubuntu-opnr-3  2001:db8::3/128  10.0.0.3/32

@@ -218,7 +218,7 @@ def _parse_nodes(rows, value):

marker = '* ' if prefix_db.thisNodeName == host_id else '> '
row = ["{}{}".format(marker, prefix_db.thisNodeName)]
row.extend(prefix_strs)
row.extend(map(lambda l: l.split()[0], prefix_strs.splitlines()[2:]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use newer syntax instead of lambda

row.extend([l.split()[0] for l in prefix_strs.splitlines()[2:]))

We should only print prefixes here which are of type LOOPBACK and use utils.sprint_prefix function to convert ip-prefix thrift object to string representation

// Get loopback prefixes
loopback_prefixes = [p.prefix for p in prefix_db.prefixEntries \
                     if p.prefixType = lsdb_types.PrefixType.LOOPBACK]

// add it to row
row.extend([utils.sprint_prefix(p) for p in loopback_prefixes])

Copy link
Contributor

@saifhhasan saifhhasan left a comment

Choose a reason for hiding this comment

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

Can you also revise this pull request to follow our suggested template. Aim is that each pull request should clearly identify what change went into it and how it was tested.

https://github.com/facebook/openr/blob/master/.github/PULL_REQUEST_TEMPLATE.md

Copy link
Contributor

@saifhhasan saifhhasan left a comment

Choose a reason for hiding this comment

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

putting back onto your queue for revision. Looking forward to updated one :)

@saifhhasan
Copy link
Contributor

Also can you update issue to follow issue template. https://github.com/facebook/openr/blob/master/.github/ISSUE_TEMPLATE.md

With clear indication of what is expected output and what should be actual output :)

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes

@tamihiro
Copy link
Contributor Author

tamihiro commented Dec 4, 2017

Thanks saifhhasan for the review and suggestion. Please check my new commit and updated comments, and let me know if further changes are necessary.

@@ -218,7 +218,9 @@ def _parse_nodes(rows, value):

Copy link
Contributor

Choose a reason for hiding this comment

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

remove unnecessary variable prefix_strs as well.

@tamihiro
Copy link
Contributor Author

tamihiro commented Dec 4, 2017

Thanks again, removed prefix_strs :)

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@saifhhasan is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes, changes since last import

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes, changes since last import

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes, changes since last import

@facebook-github-bot
Copy link
Contributor

@tamihiro has updated the pull request. View: changes, changes since last import

@tamihiro tamihiro deleted the test branch December 6, 2017 01:34
facebook-github-bot pushed a commit that referenced this pull request Feb 28, 2020
Summary:
There is a race condition when KvStoreWrapper and ZMQ background threads are
destroyed. This diff is an attempt to explicitly destroy KvStoreWrapper in TearDown

Also use unique_ptr instead of shared_ptr

```
WARNING: ThreadSanitizer: data race (pid=49594)
  Write of size 8 at 0x7ba000000220 by thread T1:
    #0 close <null> (link_monitor_test+0xdb1f6a)
    #1 zmq::signaler_t::~signaler_t() /home/engshare/third-party2/zeromq/4.3.1/src/zeromq-4.3.1/src/signaler.cpp:114:20 (link_monitor_test+0xbd1274)

  Previous read of size 8 at 0x7ba000000220 by main thread:
    #0 epoll_ctl <null> (link_monitor_test+0xd9bdef)
    #1 epoll_del /home/engshare/third-party2/libevent/1.4.14b_hphp/src/libevent-1.4.14b-stable/epoll.c:485 (link_monitor_test+0xec4253)
    #2 folly::EventBaseEvent::eb_event_del() <null> (link_monitor_test+0xa747ef)
    #3 folly::EventHandler::~EventHandler() <null> (link_monitor_test+0xa74a70)
    #4 std::_Hashtable<int, std::pair<int const, openr::OpenrEventBase::ZmqEventHandler>, std::allocator<std::pair<int const, openr::OpenrEventBase::ZmqEventHandler> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::~_Hashtable() <null> (link_monitor_test+0x219620)
    #5 openr::OpenrEventBase::~OpenrEventBase() <null> (link_monitor_test+0x212d8d)
    #6 openr::KvStore::~KvStore() <null> (link_monitor_test+0x1bfbb7)
    #7 openr::KvStore::~KvStore() <null> (link_monitor_test+0x1bfbe9)
    #8 openr::KvStoreWrapper::~KvStoreWrapper() <null> (link_monitor_test+0x117533)
    #9 std::_Sp_counted_ptr_inplace<openr::KvStoreWrapper, std::allocator<openr::KvStoreWrapper>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() <null> (link_monitor_test+0x116fbd)
    #10 LinkMonitorTestFixture::~LinkMonitorTestFixture() <null> (link_monitor_test+0xf8285)
    #11 LinkMonitorTestFixture_BasicOperation_Test::~LinkMonitorTestFixture_BasicOperation_Test() <null> (link_monitor_test+0xf7ee9)
    #12 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (link_monitor_test+0xc4b2ae)
    #13 __libc_start_main /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/csu/libc-start.c:308:16 (libc.so.6+0x211a5)
```

Reviewed By: yi-xian

Differential Revision: D20148667

fbshipit-source-id: 71634c08df8ebbc98a6b8c4aa3329166834453f2
facebook-github-bot pushed a commit that referenced this pull request Sep 26, 2020
Summary:
Pull Request resolved: facebookexperimental/rust-shed#12

The OpenSSL version on Mac doesn't work well with EdenSCM and Mononoke integration, just use the one from getdeps/brew.

Also remove the now redundant "DEVELOPER_DIR" since the modern XCode version works.

Pull Request resolved: facebook/sapling#63

Reviewed By: StanislavGlebik

Differential Revision: D23927022

Pulled By: lukaspiatkowski

fbshipit-source-id: 6b6b3baa33d49b567b9aa6178cbd20b7ae9edc89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants