summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartinko2013-06-20 19:42:23 +0000
committermartinko2013-06-20 19:42:23 +0000
commitf8cc1e8c0834fc4ddee1e6a5694fe522f97224ce (patch)
treed3fbb3e115b0abd86cb23035a6a3086e0855b610
parent26be6819f4ecc80b7d01db3bfd4933ec1d02115a (diff)
londiste: resync now checks if table is available on provider
-rw-r--r--python/londiste/setup.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/python/londiste/setup.py b/python/londiste/setup.py
index 7d73f943..5a53d41a 100644
--- a/python/londiste/setup.py
+++ b/python/londiste/setup.py
@@ -444,6 +444,23 @@ class LondisteSetup(CascadeAdmin):
db = self.get_database('db')
args = self.expand_arg_list(db, 'r', True, args)
+ if not self.options.find_copy_node:
+ self.load_local_info()
+ src_db = self.get_provider_db()
+ src_curs = src_db.cursor()
+ src_tbls = self.fetch_set_tables(src_curs)
+ src_db.commit()
+
+ problems = 0
+ for tbl in args:
+ tbl = skytools.fq_name(tbl)
+ if tbl not in src_tbls or not src_tbls[tbl]['local']:
+ self.log.error("Table %s does not exist on provider, need to switch to different provider", tbl)
+ problems += 1
+ if problems > 0:
+ self.log.error("Problems, cancelling operation")
+ sys.exit(1)
+
if self.options.find_copy_node or self.options.copy_node:
q = "select table_name, table_attrs from londiste.get_table_list(%s) where local"
cur = db.cursor()