From ce528205362d69add5858a7c06c08585fb10548b Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Thu, 23 Apr 2020 22:53:52 +0000 Subject: [PATCH 1/3] [spanner] fix: set timeout for polling on operations fixes #3471 --- spanner/cloud-client/backup_sample.py | 4 ++-- spanner/cloud-client/snippets.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spanner/cloud-client/backup_sample.py b/spanner/cloud-client/backup_sample.py index c8bcce82b83..86b5fedccde 100644 --- a/spanner/cloud-client/backup_sample.py +++ b/spanner/cloud-client/backup_sample.py @@ -42,7 +42,7 @@ def create_backup(instance_id, database_id, backup_id): operation = backup.create() # Wait for backup operation to complete. - operation.result() + operation.result(600) # Verify that the backup is ready. backup.reload() @@ -68,7 +68,7 @@ def restore_database(instance_id, new_database_id, backup_id): operation = new_database.restore(backup) # Wait for restore operation to complete. - operation.result() + operation.result(600) # Newly created database has restore information. new_database.reload() diff --git a/spanner/cloud-client/snippets.py b/spanner/cloud-client/snippets.py index ff7ae513cac..558aabf5aa7 100644 --- a/spanner/cloud-client/snippets.py +++ b/spanner/cloud-client/snippets.py @@ -52,7 +52,7 @@ def create_database(instance_id, database_id): operation = database.create() print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Created database {} on instance {}'.format( database_id, instance_id)) @@ -213,7 +213,7 @@ def add_index(instance_id, database_id): 'CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)']) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Added the AlbumsByAlbumTitle index.') # [END spanner_create_index] @@ -306,7 +306,7 @@ def add_storing_index(instance_id, database_id): 'STORING (MarketingBudget)']) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Added the AlbumsByAlbumTitle2 index.') # [END spanner_create_storing_index] @@ -355,7 +355,7 @@ def add_column(instance_id, database_id): 'ALTER TABLE Albums ADD COLUMN MarketingBudget INT64']) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Added the MarketingBudget column.') # [END spanner_add_column] @@ -509,7 +509,7 @@ def create_table_with_timestamp(instance_id, database_id): ]) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Created Performances table on database {} on instance {}'.format( database_id, instance_id)) @@ -554,7 +554,7 @@ def add_timestamp_column(instance_id, database_id): 'OPTIONS(allow_commit_timestamp=true)']) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Altered table "Albums" on database {} on instance {}.'.format( database_id, instance_id)) @@ -1122,7 +1122,7 @@ def create_table_with_datatypes(instance_id, database_id): ]) print('Waiting for operation to complete...') - operation.result() + operation.result(60) print('Created Venues table on database {} on instance {}'.format( database_id, instance_id)) From d4585db8e730f6d908836d75297e2609bea718ba Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 24 Apr 2020 00:03:46 +0000 Subject: [PATCH 2/3] bump the deadline to 1200 for backup and restore --- spanner/cloud-client/backup_sample.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spanner/cloud-client/backup_sample.py b/spanner/cloud-client/backup_sample.py index 86b5fedccde..e19bd797f4a 100644 --- a/spanner/cloud-client/backup_sample.py +++ b/spanner/cloud-client/backup_sample.py @@ -42,7 +42,7 @@ def create_backup(instance_id, database_id, backup_id): operation = backup.create() # Wait for backup operation to complete. - operation.result(600) + operation.result(1200) # Verify that the backup is ready. backup.reload() @@ -68,7 +68,7 @@ def restore_database(instance_id, new_database_id, backup_id): operation = new_database.restore(backup) # Wait for restore operation to complete. - operation.result(600) + operation.result(1200) # Newly created database has restore information. new_database.reload() From b72741560b8124dfbc3eb53e0792fb50ce5c0ee1 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 24 Apr 2020 00:29:53 +0000 Subject: [PATCH 3/3] bumped the deadline to 120 --- spanner/cloud-client/snippets.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spanner/cloud-client/snippets.py b/spanner/cloud-client/snippets.py index 558aabf5aa7..2b565609fe4 100644 --- a/spanner/cloud-client/snippets.py +++ b/spanner/cloud-client/snippets.py @@ -52,7 +52,7 @@ def create_database(instance_id, database_id): operation = database.create() print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Created database {} on instance {}'.format( database_id, instance_id)) @@ -213,7 +213,7 @@ def add_index(instance_id, database_id): 'CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)']) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Added the AlbumsByAlbumTitle index.') # [END spanner_create_index] @@ -306,7 +306,7 @@ def add_storing_index(instance_id, database_id): 'STORING (MarketingBudget)']) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Added the AlbumsByAlbumTitle2 index.') # [END spanner_create_storing_index] @@ -355,7 +355,7 @@ def add_column(instance_id, database_id): 'ALTER TABLE Albums ADD COLUMN MarketingBudget INT64']) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Added the MarketingBudget column.') # [END spanner_add_column] @@ -509,7 +509,7 @@ def create_table_with_timestamp(instance_id, database_id): ]) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Created Performances table on database {} on instance {}'.format( database_id, instance_id)) @@ -554,7 +554,7 @@ def add_timestamp_column(instance_id, database_id): 'OPTIONS(allow_commit_timestamp=true)']) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Altered table "Albums" on database {} on instance {}.'.format( database_id, instance_id)) @@ -1122,7 +1122,7 @@ def create_table_with_datatypes(instance_id, database_id): ]) print('Waiting for operation to complete...') - operation.result(60) + operation.result(120) print('Created Venues table on database {} on instance {}'.format( database_id, instance_id))