Opened 8 years ago

Closed 8 years ago

#1404 closed defect (fixed)

some workaround for sqlite3 schema change

Reported by: jinmei Owned by: jinmei
Priority: medium Milestone: Sprint-20111122
Component: build system Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 2 Add Hours to Ticket: 0
Total Hours: 1.80 Internal?: no

Subtickets

Change History (9)

comment:1 Changed 8 years ago by jinmei

trac1404 is ready for review.

I thought it would be better to include this in the release,
so while I know it's a last minute push and was not originally
planned for this sprint, I'm pushing it to the current sprint
queue. If we decide not to address this in this release, I'm
okay with deferring it to a later sprint.

Also, as I expect we'll have this type of compatibility issues in
future (may or may not be database related), I've introduced a
dedicated directory for such check/fixup in general.

I guess this change will need a changelog entry. This is the proposed
one:

326.?	[build]*	jinmei
	Added a check script for the SQLite3 schema version.  It will be
	run at the beginning of 'make install', and if it detects an old
	version of schema, installation will stop.  You'll then need to
	upgrade the database file by following the error message.
	(Trac #1404, git TBD)

comment:2 Changed 8 years ago by jinmei

  • Milestone changed from New Tasks to Sprint-20111122
  • Status changed from new to reviewing

comment:3 Changed 8 years ago by jelte

  • Owner changed from UnAssigned to jelte

comment:4 follow-up: Changed 8 years ago by jelte

  • Owner changed from jelte to jinmei

Yes I agree about getting this in before release.

I'd love to see a more general version later btw, but for now this is certainly good enough, except that it currently doesn't work if there is no db-file present at all (a case that is highly likely and should not be a problem); we could catch operationalerror on the connect call, but that may be too general, so I suggest the following patch to simply check if the file exists (and if not, exit with status 0):

diff --git a/compatcheck/sqlite3-difftbl-check.py.in b/compatcheck/sqlite3-difft
index 7a5d991..5c85e1a 100755
--- a/compatcheck/sqlite3-difftbl-check.py.in
+++ b/compatcheck/sqlite3-difftbl-check.py.in
@@ -28,6 +28,11 @@ if len(args) == 0:
     parser.error('missing argument')
 
 db_file = args[0]
+
+# If the file doesn't exist, there's nothing to do
+if not os.path.exists(db_file):
+    sys.exit(0)
+
 conn = sqlite3.connect(db_file)
 cur = conn.cursor()
 try:

oh and 'continueing' should probably be 'continuing'

comment:5 in reply to: ↑ 4 Changed 8 years ago by jinmei

Replying to jelte:

Yes I agree about getting this in before release.

Thanks for the quick and careful check.

Yes, we needed to check the case where the file doesn't exist.
I was aware of that but overlooked it. Fixed that on the branch.
Also fixed the typo.

comment:6 Changed 8 years ago by jinmei

  • Owner changed from jinmei to jelte

comment:7 follow-up: Changed 8 years ago by jelte

  • Owner changed from jelte to jinmei

Ok, then it's ready for merge

might want to ping jeremy to see if this needs an install guide update btw

comment:8 in reply to: ↑ 7 Changed 8 years ago by jinmei

Replying to jelte:

Ok, then it's ready for merge

Thanks, merge done, closing ticket. I'll give a retroactive estimate
of 2 to this ticket.

might want to ping jeremy to see if this needs an install guide update btw

Will do on jabber.

comment:9 Changed 8 years ago by jinmei

  • Estimated Difficulty changed from 0 to 2
  • Resolution set to fixed
  • Status changed from reviewing to closed
  • Total Hours changed from 0 to 1.80
Note: See TracTickets for help on using tickets.