@@ -194,31 +194,16 @@ def __init__(self, session, client_context=None):
194194 self ._client_context = _validate_client_context (client_context )
195195 self ._execute_sql_request_count : int = 0
196196 self ._read_request_count : int = 0
197- < << << << HEAD
198- == == == =
199197 self ._begin_request_sent : bool = False
200198
201199 # Identifier for the transaction.
202- >> >> >> > 89 f67fd10d4 (chore : updates thread handling to avoid race condition in tests )
203200 self ._transaction_id : Optional [bytes ] = None
204201 self ._precommit_token : Optional [MultiplexedSessionPrecommitToken ] = None
205202 self ._lock : CrossSync ._Sync_Impl .Lock = CrossSync ._Sync_Impl .Lock ()
206203
207- < << << << HEAD
208- @property
209- def _resource_info (self ):
210- """Resource information for metrics labels."""
211- database = self ._session ._database
212- return {
213- "project" : database ._instance ._client .project ,
214- "instance" : database ._instance .instance_id ,
215- "database" : database .database_id ,
216- }
217- == == == =
218204 # Operation within a transaction can be performed using multiple
219205 # threads, so we need to use a lock when updating the transaction.
220206 self ._lock : threading .Lock = threading .Lock ()
221- >> >> >> > 89 f67fd10d4 (chore : updates thread handling to avoid race condition in tests )
222207
223208 # Event to coordinate concurrent requests beginning the transaction.
224209 # This is used to prevent the "Transaction has not begun" race condition.
@@ -250,14 +235,6 @@ def read(
250235 column_info = None ,
251236 lazy_decode = False ,
252237 ):
253- < << << << HEAD
254- """Perform a ``StreamingRead`` API request for rows in a table."""
255- if self ._read_request_count > 0 :
256- if not self ._multi_use :
257- raise ValueError ("Cannot re-use single-use snapshot." )
258- if self ._transaction_id is None :
259- raise ValueError ("Transaction has not begun." )
260- == == == =
261238 """Perform a ``StreamingRead`` API request for rows in a table.
262239
263240 :type table: str
@@ -361,7 +338,6 @@ def read(
361338 if not self ._transaction_begin_event .wait (timeout = 30.0 ):
362339 raise ValueError ("Timed out waiting for transaction to begin." )
363340
364- > >> >> >> 89 f67fd10d4 (chore : updates thread handling to avoid race condition in tests )
365341 session = self ._session
366342 database = session ._database
367343 api = database .spanner_api
@@ -436,14 +412,6 @@ def execute_sql(
436412 column_info = None ,
437413 lazy_decode = False ,
438414 ):
439- < << << << HEAD
440- """Perform an ``ExecuteStreamingSql`` API request."""
441- if self ._read_request_count > 0 :
442- if not self ._multi_use :
443- raise ValueError ("Cannot re-use single-use snapshot." )
444- if self ._transaction_id is None :
445- raise ValueError ("Transaction has not begun." )
446- == == == =
447415 """Perform an ``ExecuteStreamingSql`` API request.
448416
449417 :type sql: str
@@ -566,7 +534,6 @@ def execute_sql(
566534 if not self ._transaction_begin_event .wait (timeout = 30.0 ):
567535 raise ValueError ("Timed out waiting for transaction to begin." )
568536
569- > >> >> >> 89 f67fd10d4 (chore : updates thread handling to avoid race condition in tests )
570537 if params is not None :
571538 params_pb = Struct (
572539 fields = {key : _make_value_pb (value ) for (key , value ) in params .items ()}
@@ -917,12 +884,9 @@ def _update_for_transaction_pb(self, transaction_pb: Transaction) -> None:
917884 """Updates the snapshot for the given transaction."""
918885 if self ._transaction_id is None and transaction_pb .id :
919886 self ._transaction_id = transaction_pb .id
920- < << << << HEAD
921- == == == =
922887 # Notify waiting threads that the transaction has begun.
923888 self ._transaction_begin_event .set ()
924889
925- >> >> >> > 89 f67fd10d4 (chore : updates thread handling to avoid race condition in tests )
926890 if transaction_pb ._pb .HasField ("precommit_token" ):
927891 self ._update_for_precommit_token_pb_unsafe (transaction_pb .precommit_token )
928892
0 commit comments