Details
-
Bug
-
Resolution: Won't Fix
-
Major
-
1.7.2, 1.8.0
-
Security Level: Public
-
None
-
Linux
Description
I believe that cbdbmaint --vacuum doesn't currently do anything, and silently swallows errors.
By modifying the script to print the stderr output from the run_sql, I see this:
"Error: incomplete SQL: vacuum"
I believe this is because SQL requires the vacuum command to be followed by a trailing semi-colon.
I propose the following patch to improve error handling and to fix this problem, by adding a semi-colon to the vacuum command: (Also attached as a text file)
$ diff -c /opt/couchbase/lib/python/ cbdbmaint
-
-
- /opt/couchbase/lib/python/cbdbmaint Thu Dec 29 11:19:51 2011
- cbdbmaint Thu Mar 22 07:27:49 2012
***************
- 33,38 ****
- 33,42 ----
logger.write("Error running query: %s\n" % sql)
logger.write(e)
sys.exit(1)
+ if e:
+ logger.write("Error running query: %s\n" % sql)
+ logger.write(e)
+ sys$exit(1)
return o
-
def findCmd(cmdName):
***************
-
-
- 73,79 ****
-
if shouldVacuum and (fn == db_path or isADBFile(fn)):
print "Vacuuming", fn
! run_sql(sqlitebin, fn, "vacuum")
if dest_dir:
dest_fn = os.path.join(dest_dir, os.path.basename(fn))
— 77,83 ----
if shouldVacuum and (fn == db_path or isADBFile(fn)):
print "Vacuuming", fn
! print run_sql(sqlitebin, fn, "vacuum;")
if dest_dir:
dest_fn = os.path.join(dest_dir, os.path.basename(fn))