nucliadb 6.7.1.post4824__py3-none-any.whl → 6.7.1.post4826__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nucliadb might be problematic. Click here for more details.

@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  import asyncio
23
23
  import logging
24
+ import os
24
25
  from contextlib import asynccontextmanager
25
26
  from typing import Any, AsyncGenerator, Optional
26
27
 
@@ -69,11 +70,14 @@ POOL_METRICS_GAUGES = {
69
70
  class DataLayer:
70
71
  def __init__(self, connection: psycopg.AsyncConnection):
71
72
  self.connection = connection
73
+ self.for_update_log = os.environ.get("PG_FOR_UPDATE_LOG", "false").lower() == "true"
72
74
 
73
75
  async def get(self, key: str, select_for_update: bool = False) -> Optional[bytes]:
74
76
  with pg_observer({"type": "get"}):
75
77
  statement = "SELECT value FROM resources WHERE key = %s"
76
78
  if select_for_update:
79
+ if self.for_update_log:
80
+ logger.warning(f"SELECT FOR UPDATE on key={key}")
77
81
  statement += " FOR UPDATE"
78
82
  async with self.connection.cursor() as cur:
79
83
  await cur.execute(statement, (key,))
@@ -117,6 +121,8 @@ class DataLayer:
117
121
  async with self.connection.cursor() as cur:
118
122
  statement = "SELECT key, value FROM resources WHERE key = ANY(%s)"
119
123
  if select_for_update:
124
+ if self.for_update_log:
125
+ logger.warning(f"SELECT FOR UPDATE on keys={keys}")
120
126
  statement += " FOR UPDATE"
121
127
  await cur.execute(statement, (keys,))
122
128
  records = {record[0]: record[1] for record in await cur.fetchall()}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.7.1.post4824
3
+ Version: 6.7.1.post4826
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.7.1.post4824
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.7.1.post4824
24
- Requires-Dist: nucliadb-protos>=6.7.1.post4824
25
- Requires-Dist: nucliadb-models>=6.7.1.post4824
26
- Requires-Dist: nidx-protos>=6.7.1.post4824
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.7.1.post4826
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.7.1.post4826
24
+ Requires-Dist: nucliadb-protos>=6.7.1.post4826
25
+ Requires-Dist: nucliadb-models>=6.7.1.post4826
26
+ Requires-Dist: nidx-protos>=6.7.1.post4826
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.46.0
29
29
  Requires-Dist: uvicorn[standard]
@@ -117,7 +117,7 @@ nucliadb/common/maindb/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXM
117
117
  nucliadb/common/maindb/driver.py,sha256=FMRBZgb1lRxOTnr9PHsWs1hLGTswKzkfk6CLzNmFmt8,2633
118
118
  nucliadb/common/maindb/exceptions.py,sha256=u6ZSQW6jk5QM_IL5XmQ_dF-vZ-JkuWEqZbNJ-S6FG_g,988
119
119
  nucliadb/common/maindb/local.py,sha256=uE9DIQX1yCNHNN8Tx4fPgSiuTtWpQhlfWkMJ8QZPae0,7270
120
- nucliadb/common/maindb/pg.py,sha256=FNq2clckJYj4Te-1svjQblqGoAF5OwJ5nwz2JtxD0d4,13645
120
+ nucliadb/common/maindb/pg.py,sha256=g16ZUkZEQkRq-G-WcIytCTe14GdaWqBvKl6PBLaHpx8,13978
121
121
  nucliadb/common/maindb/utils.py,sha256=zWLs82rWEVhpc1dYvdqTZiAcjZroB6Oo5MQaxMeFuKk,3301
122
122
  nucliadb/common/models_utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
123
123
  nucliadb/common/models_utils/from_proto.py,sha256=1Ut6_f5ofao1numCkr5xgeVWhuVitx1ebggzU8hu0jU,15764
@@ -376,8 +376,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
376
376
  nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
377
377
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
378
378
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
379
- nucliadb-6.7.1.post4824.dist-info/METADATA,sha256=Gh23bnmdWwXL-eg_dnpeUx7czBmbEc9HgXiG6I3Tm6c,4158
380
- nucliadb-6.7.1.post4824.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
381
- nucliadb-6.7.1.post4824.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
382
- nucliadb-6.7.1.post4824.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
383
- nucliadb-6.7.1.post4824.dist-info/RECORD,,
379
+ nucliadb-6.7.1.post4826.dist-info/METADATA,sha256=Mu-VDViTPr5KuXfS95lweuedlvXVIUzk2QLkwTeX5Pg,4158
380
+ nucliadb-6.7.1.post4826.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
381
+ nucliadb-6.7.1.post4826.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
382
+ nucliadb-6.7.1.post4826.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
383
+ nucliadb-6.7.1.post4826.dist-info/RECORD,,