Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/collection/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3041,6 +3041,29 @@ def test_replication_config_update_merge_with_missing_async_config() -> None:
assert result["factor"] == 3


@pytest.mark.parametrize(
"config_factory",
[Configure.replication, Reconfigure.replication],
)
def test_replication_async_enabled_emits_deprecation_warning(config_factory: object) -> None:
"""`async_enabled` was removed from the server schema in v1.38 and must warn when passed."""
with pytest.warns(DeprecationWarning, match="Dep030"):
config_factory(async_enabled=True) # type: ignore[operator]


@pytest.mark.parametrize(
"config_factory",
[Configure.replication, Reconfigure.replication],
)
def test_replication_without_async_enabled_does_not_warn(config_factory: object) -> None:
"""Omitting `async_enabled` must not emit the deprecation warning."""
import warnings

with warnings.catch_warnings():
warnings.simplefilter("error", DeprecationWarning)
config_factory(factor=3) # type: ignore[operator]


def test_nested_property_with_id_name_is_allowed() -> None:
"""A nested property named 'id' must not raise — only top-level 'id' is reserved."""
prop = Property(
Expand Down
20 changes: 17 additions & 3 deletions weaviate/collections/classes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2791,14 +2791,20 @@ def replication(
) -> _ReplicationConfigCreate:
"""Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of Weaviate.

NOTE: `async_enabled` is only available with WeaviateDB `>=v1.26.0`
Note:
`async_enabled` was removed from the Weaviate server schema in v1.38. Passing it
has no effect against any server `>=v1.38` (the server silently drops it and runs
async replication by default for any class with a replication factor > 1) and emits
a ``DeprecationWarning``. The argument will be removed in a future release.

Args:
factor: The replication factor.
async_enabled: Enabled async replication.
deletion_strategy: How conflicts between different nodes about deleted objects are resolved.
async_config: The configuration for async replication. This is only relevant if `async_enabled` is `True`.
async_config: The configuration for async replication.
"""
if async_enabled is not None:
_Warnings.async_enabled_field_removed_server_side()
return _ReplicationConfigCreate(
factor=factor,
asyncEnabled=async_enabled,
Expand Down Expand Up @@ -3071,12 +3077,20 @@ def replication(

Use this method when defining the `replication_config` argument in `collection.update()`.

Note:
`async_enabled` was removed from the Weaviate server schema in v1.38. Passing it
has no effect against any server `>=v1.38` (the server silently drops it and runs
async replication by default for any class with a replication factor > 1) and emits
a ``DeprecationWarning``. The argument will be removed in a future release.

Args:
factor: The replication factor.
async_enabled: Enable async replication.
deletion_strategy: How conflicts between different nodes about deleted objects are resolved.
async_config: The async replication configuration. This is only applicable if `async_enabled` is set to `True`.
async_config: The async replication configuration.
"""
if async_enabled is not None:
_Warnings.async_enabled_field_removed_server_side()
return _ReplicationConfigUpdate(
factor=factor,
asyncEnabled=async_enabled,
Expand Down
11 changes: 11 additions & 0 deletions weaviate/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ def async_replication_field_removed_server_side(argument: str) -> None:
stacklevel=1,
)

@staticmethod
def async_enabled_field_removed_server_side() -> None:
warnings.warn(
message="""Dep030: The `async_enabled` argument in `Configure.replication` / `Reconfigure.replication` is deprecated.
The `asyncEnabled` field was removed from the Weaviate server schema in v1.38 and is silently ignored by newer servers,
where async replication runs by default for any class with a replication factor > 1.
The argument has no effect against any server >= 1.38 and will be removed in a future release.""",
category=DeprecationWarning,
stacklevel=1,
)

@staticmethod
def datetime_insertion_with_no_specified_timezone(date: datetime) -> None:
warnings.warn(
Expand Down