Skip to content

Commit 0e82963

Browse files
committed
feat: deprecate async_enabled replication argument removed server-side
The `asyncEnabled` field was removed from the Weaviate server schema in v1.38. The client still accepted `async_enabled` and forwarded it, so the server silently dropped it and the user's intent was lost without any indication (issue #2047). Following the existing precedent for `max_workers` / `alive_nodes_checking_frequency` (Dep029), the `async_enabled` argument in `Configure.replication` / `Reconfigure.replication` now emits a `DeprecationWarning` (Dep030) when passed, while remaining functional against older servers. Docstrings are updated to document the removal. Closes #2047
1 parent 5a4b983 commit 0e82963

3 files changed

Lines changed: 51 additions & 3 deletions

File tree

test/collection/test_config.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,6 +3041,29 @@ def test_replication_config_update_merge_with_missing_async_config() -> None:
30413041
assert result["factor"] == 3
30423042

30433043

3044+
@pytest.mark.parametrize(
3045+
"config_factory",
3046+
[Configure.replication, Reconfigure.replication],
3047+
)
3048+
def test_replication_async_enabled_emits_deprecation_warning(config_factory: object) -> None:
3049+
"""`async_enabled` was removed from the server schema in v1.38 and must warn when passed."""
3050+
with pytest.warns(DeprecationWarning, match="Dep030"):
3051+
config_factory(async_enabled=True) # type: ignore[operator]
3052+
3053+
3054+
@pytest.mark.parametrize(
3055+
"config_factory",
3056+
[Configure.replication, Reconfigure.replication],
3057+
)
3058+
def test_replication_without_async_enabled_does_not_warn(config_factory: object) -> None:
3059+
"""Omitting `async_enabled` must not emit the deprecation warning."""
3060+
import warnings
3061+
3062+
with warnings.catch_warnings():
3063+
warnings.simplefilter("error", DeprecationWarning)
3064+
config_factory(factor=3) # type: ignore[operator]
3065+
3066+
30443067
def test_nested_property_with_id_name_is_allowed() -> None:
30453068
"""A nested property named 'id' must not raise — only top-level 'id' is reserved."""
30463069
prop = Property(

weaviate/collections/classes/config.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,14 +2791,20 @@ def replication(
27912791
) -> _ReplicationConfigCreate:
27922792
"""Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of Weaviate.
27932793
2794-
NOTE: `async_enabled` is only available with WeaviateDB `>=v1.26.0`
2794+
Note:
2795+
`async_enabled` was removed from the Weaviate server schema in v1.38. Passing it
2796+
has no effect against any server `>=v1.38` (the server silently drops it and runs
2797+
async replication by default for any class with a replication factor > 1) and emits
2798+
a ``DeprecationWarning``. The argument will be removed in a future release.
27952799
27962800
Args:
27972801
factor: The replication factor.
27982802
async_enabled: Enabled async replication.
27992803
deletion_strategy: How conflicts between different nodes about deleted objects are resolved.
2800-
async_config: The configuration for async replication. This is only relevant if `async_enabled` is `True`.
2804+
async_config: The configuration for async replication.
28012805
"""
2806+
if async_enabled is not None:
2807+
_Warnings.async_enabled_field_removed_server_side()
28022808
return _ReplicationConfigCreate(
28032809
factor=factor,
28042810
asyncEnabled=async_enabled,
@@ -3071,12 +3077,20 @@ def replication(
30713077
30723078
Use this method when defining the `replication_config` argument in `collection.update()`.
30733079
3080+
Note:
3081+
`async_enabled` was removed from the Weaviate server schema in v1.38. Passing it
3082+
has no effect against any server `>=v1.38` (the server silently drops it and runs
3083+
async replication by default for any class with a replication factor > 1) and emits
3084+
a ``DeprecationWarning``. The argument will be removed in a future release.
3085+
30743086
Args:
30753087
factor: The replication factor.
30763088
async_enabled: Enable async replication.
30773089
deletion_strategy: How conflicts between different nodes about deleted objects are resolved.
3078-
async_config: The async replication configuration. This is only applicable if `async_enabled` is set to `True`.
3090+
async_config: The async replication configuration.
30793091
"""
3092+
if async_enabled is not None:
3093+
_Warnings.async_enabled_field_removed_server_side()
30803094
return _ReplicationConfigUpdate(
30813095
factor=factor,
30823096
asyncEnabled=async_enabled,

weaviate/warnings.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@ def async_replication_field_removed_server_side(argument: str) -> None:
261261
stacklevel=1,
262262
)
263263

264+
@staticmethod
265+
def async_enabled_field_removed_server_side() -> None:
266+
warnings.warn(
267+
message="""Dep030: The `async_enabled` argument in `Configure.replication` / `Reconfigure.replication` is deprecated.
268+
The `asyncEnabled` field was removed from the Weaviate server schema in v1.38 and is silently ignored by newer servers,
269+
where async replication runs by default for any class with a replication factor > 1.
270+
The argument has no effect against any server >= 1.38 and will be removed in a future release.""",
271+
category=DeprecationWarning,
272+
stacklevel=1,
273+
)
274+
264275
@staticmethod
265276
def datetime_insertion_with_no_specified_timezone(date: datetime) -> None:
266277
warnings.warn(

0 commit comments

Comments
 (0)