Skip to content

Commit

Permalink
fix data type passed to a function call and usage of oldest table num…
Browse files Browse the repository at this point in the history
…ber in bigtable backup
  • Loading branch information
sandeepsukhani committed Aug 20, 2019
1 parent e65fd2e commit ce945b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/bigtable-backup/bigtable-backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ def ensure_backups(args):
active_table_number = int(time.time() / args.periodic_table_duration)

print("Checking right backups exist")
while oldest_table_number <= newest_table_number:
table_id = args.bigtable_table_id_prefix + str(oldest_table_number)
oldest_table_number += 1
table_number_to_check = oldest_table_number
while table_number_to_check <= newest_table_number:
table_id = args.bigtable_table_id_prefix + str(table_number_to_check)
table_number_to_check += 1
if table_id not in backups:
print("backup for {} not found".format(table_id))
create_backup(table_id, args)
Expand Down Expand Up @@ -205,7 +206,7 @@ def delete_out_of_range_backups(oldest_table_number, newest_table_number, backup
table_number = int(table_id.rsplit("_", 1)[-1])
if table_number < oldest_table_number or table_number > newest_table_number:
for timestamp in timestamps:
delete_backup(table_id, timestamp, args)
delete_backup(table_id, str(timestamp), args)
num_backups_deleted += 1

return num_backups_deleted
Expand Down

0 comments on commit ce945b4

Please sign in to comment.