Skip to content

Mas i1817 overflowrtq#1829

Merged
martinsumner merged 24 commits into
develop-3.0from
mas-i1817-overflowrtq
May 12, 2022
Merged

Mas i1817 overflowrtq#1829
martinsumner merged 24 commits into
develop-3.0from
mas-i1817-overflowrtq

Conversation

@martinsumner

@martinsumner martinsumner commented May 12, 2022

Copy link
Copy Markdown
Contributor

Expand on use of riak_kv_overflow_queue so that it is used by the riak_kv_replrtq_src, as well as riak_kv_reaper and riak_kv_eraser.

This means that larger queue sizes can be supported for riak_kv_replrtq_src without having to worry about compromising the memory of the node. This should allow for repl_keys_range AAE folds to generate very large replication sets, without clogging the node worker pool by pausing so that real-time replication can keep up.

The overflow queues are deleted on shutdown (if there is a queue on disk). The feature is to allow for larger queues without memory exhaustion, persistence is not used to persist queues across restarts.

Overflow Queues extended to include a 'reader' queue which may be used for read_repairs. Currently this queue is only used for the repair_keys_range query and the read-repair trigger.

Also don't log queues on a crash - avoid over-sized crash dumps
Have the queue backed to disk, so that beyond a certain size it overflows from memory to disk (and once the on disk part is consumed from the queue the files are removed).
Risk of misconfiguration leading to wiping of wrong data.  Also starting a job may lead to the main process having its disk_log wiped.
Avoid enoent errors
Check for a soft overload on any vnode before reaping.  This will add some delay - but reap has been show to potentially overload a cluster ... availability is more important than reap speed.

There is no catch for {error, mailbox_overload} should it occur - it should not as the mailbox check should prevent it.  If it does, the reaper will crash (and restart without any reaps) - return to a safe known position.
The queue file generated, are still in UUID format, but the id now incorporates creation date.  This should make it easier to detect and clean any garbage that might be accrued.

One use case where '++' is used has also been removed (although a lists:flatten/1 was still required at the end in this case)
Refactor riak_kv_replrtq_src to use the riak_kv_overflow_queue, and allow for larger queues to be supported without leading to memory exhaustion.

Issues still with eqc test.  Also issue of inaccurate accounting of maximum queue size, and setting sizes (and their defaults) at startup.

The popping from rtq is also a bit ugly, would be nice to have some cleaner code for this.
… false

If ObjectLimit == 0, then this might not be the case
This now passes 10K eqc tests of replrtq_eqc.

Stat of discards added to riak_kv_stats
There will be no attempt to re-open overflow on startup.  The queue is persisted to avoid over-consumption of memory, not so that replication requests can be persisted across reboots
Add equivalent to reaper/eraser clear function, which can be used when resetting the size of overflow queues
Default them all to the same value for simplicity, and name the configuration item consistently (although there is a subtle difference in the implementation for replrtq)
Needs to change size limit stored on state.  Also remove previous (and now redundant) configuration: replrtq_srcqueuelimit now replaced with replrtq_overflow_limit
@martinsumner

Copy link
Copy Markdown
Contributor Author

#1817

Comment thread priv/riak_kv.schema
{datatype, directory}
]}.

%% @doc A path under which the reaper overload queue will be stored.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should this doc string be updated to indicate this location is used for all queues?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are separate locations for each queue, which you can't really see from the diff:

%% @doc A path under which the eraser overload queue will be stored.
{mapping, "eraser_dataroot", "riak_kv.eraser_dataroot", [
  {default, "$(platform_data_dir)/kv_eraser"},
  {datatype, directory}
]}.

%% @doc A path under which the reaper overload queue will be stored.
{mapping, "reaper_dataroot", "riak_kv.reaper_dataroot", [
  {default, "$(platform_data_dir)/kv_reaper"},
  {datatype, directory}
]}.

%% @doc A path under which the reader overload queue will be stored.
{mapping, "reader_dataroot", "riak_kv.reader_dataroot", [
  {default, "$(platform_data_dir)/kv_reader"},
  {datatype, directory}
]}.

%% @doc A path under which the repl real-time overload queue will be stored.
{mapping, "replrtq_dataroot", "riak_kv.replrtq_dataroot", [
  {default, "$(platform_data_dir)/kv_replrtqsrc"},
  {datatype, directory}
]}.

@martinsumner
martinsumner merged commit 3d2d4e2 into develop-3.0 May 12, 2022
@martinsumner
martinsumner deleted the mas-i1817-overflowrtq branch May 12, 2022 17:39
martinsumner added a commit that referenced this pull request May 31, 2022
Merge in changes from Riak 3.0.10.

Includes PRs:

- #1809
- #1812
- #1814
- #1816
- #1829
- #1830
hmmr pushed a commit to TI-Tokyo/basho-riak_kv that referenced this pull request Nov 23, 2022
Expand on use of riak_kv_overflow_queue so that it is used by the riak_kv_replrtq_src, as well as riak_kv_reaper and riak_kv_eraser.

This means that larger queue sizes can be supported for riak_kv_replrtq_src without having to worry about compromising the memory of the node. This should allow for repl_keys_range AAE folds to generate very large replication sets, without clogging the node worker pool by pausing so that real-time replication can keep up.

The overflow queues are deleted on shutdown (if there is a queue on disk). The feature is to allow for larger queues without memory exhaustion, persistence is not used to persist queues across restarts.

Overflow Queues extended to include a 'reader' queue which may be used for read_repairs. Currently this queue is only used for the repair_keys_range query and the read-repair trigger.
# Conflicts:
#	priv/riak_kv.schema
#	src/riak_kv_overflow_queue.erl
#	src/riak_kv_replrtq_src.erl
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