freebsd-skq/sbin/hastd
trociny cc424717c7 MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196:
r257155:

Make hastctl list command output current queue sizes.

Reviewed by:	pjd

r257582 (pjd):

Correct alignment.

r259191:

For memsync replication, hio_countdown is used not only as an
indication when a request can be moved to done queue, but also for
detecting the current state of memsync request.

This approach has problems, e.g. leaking a request if memsynk ack from
the secondary failed, or racy usage of write_complete, which should be
called only once per write request, but for memsync can be entered by
local_send_thread and ggate_send_thread simultaneously.

So the following approach is implemented instead:

1) Use hio_countdown only for counting components we waiting to
   complete, i.e. initially it is always 2 for any replication mode.

2) To distinguish between "memsync ack" and "memsync fin" responses
   from the secondary, add and use hio_memsyncacked field.

3) write_complete() in component threads is called only before
   releasing hio_countdown (i.e. before the hio may be returned to the
   done queue).

4) Add and use hio_writecount refcounter to detect when
   write_complete() can be called in memsync case.

Reported by:	Pete French petefrench ingresso.co.uk
Tested by:	Pete French petefrench ingresso.co.uk

r259192:

Add some macros to make the code more readable (no functional chages).

r259193:

Fix compiler warnings.

r259194:

In remote_send_thread, if sending a request fails don't take the
request back from the receive queue -- it might already be processed
by remote_recv_thread, which lead to crashes like below:

  (primary) Unable to receive reply header: Connection reset by peer.
  (primary) Unable to send request (Connection reset by peer):
      WRITE(954662912, 131072).
  (primary) Disconnected from kopusha:7772.
  (primary) Increasing localcnt to 1.
  (primary) Assertion failed: (old > 0), function refcnt_release,
      file refcnt.h, line 62.

Taking the request back was not necessary (it would properly be
processed by the remote_recv_thread) and only complicated things.

r259195:

Send wakeup to threads waiting on empty queue before releasing the
lock to decrease spurious wakeups.

Submitted by:	davidxu

r259196:

Check remote protocol version only for the first connection (when it
is actually sent by the remote node).

Otherwise it generated confusing "Negotiated protocol version 1" debug
messages when processing the second connection.
2013-12-28 19:21:22 +00:00
..
activemap.c Spelling fixes for sbin/ 2012-01-07 16:09:33 +00:00
activemap.h
control.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
control.h Rename HASTCTL_ defines, which are used for conversion between main 2011-04-26 19:38:30 +00:00
crc32.c Allow to checksum on-the-wire data using either CRC32 or SHA256. 2011-03-06 22:56:14 +00:00
crc32.h Allow to checksum on-the-wire data using either CRC32 or SHA256. 2011-03-06 22:56:14 +00:00
ebuf.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
ebuf.h
event.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
event.h Forgot to add event.c and event.h in r212038. 2010-08-31 09:38:43 +00:00
hast_checksum.c Simplify code by changing functions types from int to avoid, as the functions 2011-12-15 22:03:17 +00:00
hast_checksum.h Allow to checksum on-the-wire data using either CRC32 or SHA256. 2011-03-06 22:56:14 +00:00
hast_compression.c Spelling fixes for sbin/ 2012-01-07 16:09:33 +00:00
hast_compression.h Allow to compress on-the-wire data using two algorithms: 2011-03-06 23:09:33 +00:00
hast_proto.c - Add support for 'memsync' mode. This is the fastest replication mode that's 2013-02-17 21:12:34 +00:00
hast_proto.h Remove hast_proto_recv(). It was used only in one place, where 2011-04-17 16:18:45 +00:00
hast.conf.5 - Add support for 'memsync' mode. This is the fastest replication mode that's 2013-02-17 21:12:34 +00:00
hast.h MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
hastd.8 MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
hastd.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
hastd.h Add function to assert that the only descriptors we have open are the ones 2011-01-28 21:56:47 +00:00
hooks.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
hooks.h hook_check() is now only used to report about long-running hooks, so the 2010-10-04 21:43:06 +00:00
lzf.c Allow to compress on-the-wire data using two algorithms: 2011-03-06 23:09:33 +00:00
lzf.h Spelling fixes for sbin/ 2012-01-07 16:09:33 +00:00
Makefile Get rid of libl dependency. We needed it only to provide yywrap. But 2013-05-11 09:51:44 +00:00
metadata.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
metadata.h
nv.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
nv.h Add nv_assert() which allows to assert that the given name exists. 2011-01-22 22:38:18 +00:00
parse.y Improve compatibility with old flex and fix build with GCC. 2013-05-22 17:47:45 +00:00
pjdlog.c Ensure that pjdlog functions don't modify errno. 2011-09-27 06:43:51 +00:00
pjdlog.h Revert r228695. We use __func__ here as a format to distinguish between 2012-11-05 00:38:14 +00:00
primary.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
proto_common.c Check if there is cmsg at all. 2012-07-01 16:26:07 +00:00
proto_impl.h The proto API is a general purpose API, so don't use 'hast' in structures or 2011-03-22 16:21:11 +00:00
proto_socketpair.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
proto_tcp.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
proto_uds.c For functions that return -1 on failure check exactly for -1 and not for 2012-01-10 22:39:07 +00:00
proto.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
proto.h In hast.conf we define the other node's address in 'remote' variable. 2011-03-21 08:54:59 +00:00
rangelock.c Nice range comparison. 2012-02-11 16:41:52 +00:00
rangelock.h
refcnt.h Don't let hastd use C11 atomics. 2013-06-29 20:13:39 +00:00
secondary.c MFC r257155, r257582, r259191, r259192, r259193, r259194, r259195, r259196: 2013-12-28 19:21:22 +00:00
subr.c Change the cap_rights_t type from uint64_t to a structure that we can extend 2013-09-05 00:09:56 +00:00
subr.h Constify argument. 2012-01-06 12:27:17 +00:00
synch.h Revert: r236909 2012-06-11 20:27:52 +00:00
token.l Improve compatibility with old flex and fix build with GCC. 2013-05-22 17:47:45 +00:00