Release highlights:
- Automatic failover using a Raft-based protocol
- More flexible administration for servers and tables
- Advanced recovery features
Read the blog post for more details.
Compatibility
Data files from RethinkDB versions 1.14.0 onward will be automatically migrated.
As with any major release, back up your data files before performing the upgrade.
If you're upgrading directly from RethinkDB 1.13 or earlier, you will need to manually
upgrade using rethinkdb dump
.
Note that files from the RethinkDB 2.1.0 beta release are not compatible with this
version.
Changed handling of server failures
This release introduces a new system for dealing with server failures and network
partitions based on the Raft consensus algorithm.
Previously, unreachable servers had to be manually removed from the cluster in order to
restore availability. RethinkDB 2.1 can resolve many cases of availability loss
automatically, and keeps the cluster in an administrable state even while servers are
missing.
There are three important scenarios in RethinkDB 2.1 when it comes to restoring the
availability of a given table after a server failure:
- The table has three or more replicas, and a majority of the servers that are hosting
these replicas are connected. RethinkDB 2.1 automatically elects new primary replicas
to replace unavailable servers and restore availability. No manual intervention is
required, and data consistency is maintained. - A majority of the servers for the table are connected, regardless of the number of
replicas. The table can be manually reconfigured using the usual commands, and data
consistency is always maintained. - A majority of servers for the table are unavailable. The new
emergency_repair
option
totable.reconfigure
can be used to restore table availability in this case.
System table changes
To reflect changes in the underlying cluster administration logic, some of the tables in
the rethinkdb
database changed.
Changes to table_config
:
- Each shard subdocument now has a new field
nonvoting_replicas
, that can be set to a
subset of the servers in thereplicas
field. write_acks
must now be either"single"
or"majority"
. Custom write ack
specifications are no longer supported. Instead, non-voting replicas can be used to set
up replicas that do not count towards the write ack requirements.- Tables that have all of their replicas disconnected are now listed as special documents
with an"error"
field. - Servers that are disconnected from the cluster are no longer included in the table.
- The new
indexes
field lists the secondary indexes on the given table.
Changes to table_status
:
- The
primary_replica
field is now calledprimary_replicas
and has an array of
current primary replicas as its value. While under normal circumstances only a single
server will be serving as the primary replica for a given shard, there can temporarily
be multiple primary replicas during handover or while data is being transferred between
servers. - The possible values of the
state
field now are"ready"
,"transitioning"
,
"backfilling"
,"disconnected"
,"waiting_for_primary"
and"waiting_for_quorum"
. - Servers that are disconnected from the cluster are no longer included in the table.
Changes to current_issues
:
- The issue types
"table_needs_primary"
,"data_lost"
,"write_acks"
,
"server_ghost"
and"server_disconnected"
can no longer occur. - A new issue type
"table_availability"
was added and appears whenever a table is
missing at least one server. Note that no issue is generated if a server which is not
hosting any replicas disconnects.
Changes to cluster_config
:
- A new document with the
id
"heartbeat"
allows configuring the heartbeat timeout for
intracluster connections.
New ReQL error types
RethinkDB 2.1 introduces new error types that allow you to handle different error classes
separately in your application if you need to. You can find the
complete list of new error types in the documentation.
As part of this change, ReQL error types now use the Reql
name prefix instead of Rql
(for example ReqlRuntimeError
instead of RqlRuntimeError
).
The old type names are still supported in our drivers for backwards compatibility.
Other API-breaking changes
.split('')
now treats the input as UTF-8 instead of an array of bytesnull
values in compound index are no longer discarded- The new
read_mode="outdated"
optional argument replacesuse_outdated=True
Deprecated functionality
The older protocol-buffer-based client protocol is deprecated in this release. RethinkDB
2.2 will no longer support clients that still use it. All "current" drivers listed on
the drivers page use the new JSON-based protocol and will continue to work
with RethinkDB 2.2.
New features
- Server
- Added automatic failover and semi-lossless rebalance based on Raft (#223)
- Backfills are now interuptible and reversible (#3886, #3885)
table.reconfigure
now works even if some servers are disconnected (#3913)- Replicas can now be marked as voting or non-voting (#3891)
- Added an emergency repair feature to restore table availability if consensus is lost
(#3893) - Reads can now be made against a majority of replicas (#3895)
- Added an emergency read mode that extracts data directly from a given replica for data
recovery purposes (#4388) - Servers with no responsibilities can now be removed from clusters without raising an
issue (#1790) - Made the intracluster heartbeat timeout configurable (#4449)
- ReQL
- All drivers
- Python driver
Improvements
- Server
- Improved the handling of cluster membership and removal of servers (#3262, #3897,
#1790) - Changed the formatting of the
table_status
system table (#3882, #4196) - Added an
indexes
field to thetable_config
system table (#4525) - Improved efficiency by making
datum_t
movable (#4056) - ReQL backtraces are now faster and smaller (#2900)
- Replaced cJSON with rapidjson (#3844)
- Failed meta operations are now transparently retried (#4199)
- Added more detailed logging of cluster events (#3878)
- Improved unsaved data limit throttling to increase write performance (#4441)
- Improved the performance of the
is_empty
term (#4592) - Small backfills are now prioritized to make tables available more quickly after a
server restart (#4383) - Reduced the memory requirements when backfilling large documents (#4474)
- Changefeeds using the
squash
option now send batches early if the changefeed queue
gets too full (#3942)
- Improved the handling of cluster membership and removal of servers (#3262, #3897,
- ReQL
.split('')
is now UTF-8 aware (#2518)- Improved the behaviour of compound index values containing
null
(#4146) - Errors now distinguish failed writes from indeterminate writes (#4296)
r.union
is now a top-level term (#4030)condition.branch(...)
now works just liker.branch(condition, ...)
(#4438)- Improved the detection of non-atomic
update
andreplace
arguments (#4582)
- Web UI
- JavaScript driver
- Python driver
- Ruby driver
- TCP keepalive is now enabled for all connections (#4572)
Bug fixes
time_of_date
anddate
now respect timezones (#4149)- Added code to work around a bug in some versions of GLIBC and EGLIBC (#4470)
- Updated the OS X uninstall script to avoid spurious error messages (#3773)
- Fixed a starvation issue with squashing changefeeds (#3903)
has_fields
now returns a selection when called on a table (#2609)- Fixed a bug that caused intermittent server crashes with the message
Guarantee failed: [fn_id != __null]
in combination with ther.js
command (#4611) - Web UI
- Python driver
- Fixed a missing argument error (#4402)
- JavaScript driver
- Ruby driver
- Made the EventMachine API raise an error when a connection is closed while handlers
are active (#4626)
- Made the EventMachine API raise an error when a connection is closed while handlers
Contributors
Many thanks to external contributors from the RethinkDB community for helping
us ship RethinkDB 2.1. In no particular order:
- Thomas Kluyver (@takluyver)
- Jonathan Phillips (@jipperinbham)
- Yohan Graterol (@yograterol)
- Adam Grandquist (@grandquista)
- Peter Hamilton (@hamiltop)
- Marshall Cottrell (@marshall007)
- Elias Levy (@eliaslevy)
- Ian Beringer (@ianberinger)
- Jason Dobry (@jmdobry)
- Wankai Zhang (@wankai)
- Elifarley Cruz (@elifarley)
- Brandon Mills (@btmills)
- Daniel Compton (@danielcompton)
- Ed Costello (@epc)
- Lowe Thiderman (@thiderman)
- Andy Wilson (@wilsaj)
- Nicolas Viennot (@nviennot)
- bnosrat (@bnosrat)
- Mike Mintz (@mikemintz)
- Lahfa Ryan (@RaitoBezarius)
- Sebastien Diaz (@sebadiaz)