Project

General

Profile

Actions

Architecture #2364

closed

Test for the XML fileformat in migration script for EventLog migration in DB

Added by François ARMAND over 12 years ago. Updated over 9 years ago.

Status:
Released
Priority:
2
Assignee:
Matthieu CERDA
Category:
Packaging
Target version:
Effort required:
Name check:
Fix check:
Regression:

Description

We need to test for the lowest fileFormat version in the migration script, and set the result in the version table (see #2363)


Related issues 2 (0 open2 closed)

Related to Rudder - Bug #2684: The fileFormat migration script for Rudder 2.4 (version 1) contains a flawed conditionReleasedMatthieu CERDA2012-07-20Actions
Blocked by Rudder - Bug #2495: Bad way to find EventLog to migrate from Rudder 2.3ReleasedFrançois ARMAND2012-05-22Actions
Actions #1

Updated by François ARMAND over 12 years ago

The SQL query to test for fileFormat=1 is:

SELECT * FROM eventlog WHERE 
  xmlexists('/entry/*[@fileFormat=1]'PASSING BY REF data) OR 
  xmlexists('/entry/addPending'PASSING BY REF data)
  LIMIT 1;

The SQL insert to do if the previous select return a result:

INSERT INTO migrationeventlog(detectiontime, detectedfileformat)
VALUES ('NOW', 1);

Of course, "NOW" should be date like "2012-02-13 02:19:09.89+01"

Actions #2

Updated by Jonathan CLARKE over 12 years ago

  • Target version changed from 2.4.0~alpha6 to 2.4.0~alpha7
Actions #3

Updated by Jonathan CLARKE over 12 years ago

  • Assignee changed from Jonathan CLARKE to Matthieu CERDA
Actions #4

Updated by Jonathan CLARKE over 12 years ago

  • Subject changed from Test for the XML fileformat in migration script to Test for the XML fileformat in migration script for EventLog migration in DB
Actions #5

Updated by Matthieu CERDA over 12 years ago

  • Status changed from 2 to Discussion
  • Assignee changed from Matthieu CERDA to François ARMAND

Hum, I can not use this testing statement, because the xmlexists function is only present on postgresql >= 9.1.

However, here is a summary of the supported OS and their psql version:
  • SLES11: 8.3.9
  • Debian 6: 8.4.11
  • CentOS 6: 8.4.9
  • Ubuntu 12.04: 9.1
  • Ubuntu 11.10: 9.1
  • Debian 5: 8.3.17

I need an alternate SQL query or a workaround, please :(

Actions #6

Updated by Matthieu CERDA over 12 years ago

Bump

Actions #7

Updated by Nicolas CHARLES over 12 years ago

I didn't try to do it in one run, but the first part of the query, to count fileFormat 1 is :

select count(*) from (
select xpath('/entry/*[@fileFormat=1]',data) AS x
from eventlog) as Y
where array_upper(x, 1) > 0;

the second is :

select count(*) from (
select xpath('/entry/addPending',data) AS x
from eventlog) as Y
where array_upper(x, 1) > 0;

If any of them return a number greater than 0, then the update should be done

Actions #8

Updated by Matthieu CERDA over 12 years ago

  • Status changed from Discussion to Pending technical review
  • % Done changed from 0 to 100

Applied in changeset commit:d7e8e7135ba571ed0f187ee6f7888c381ce398b4.

Actions #9

Updated by Jonathan CLARKE over 12 years ago

  • Status changed from Pending technical review to 10
  • Assignee changed from François ARMAND to Matthieu CERDA

Looks good to me! I'm glad this has been sorted.

Actions #10

Updated by Jonathan CLARKE over 12 years ago

  • Tracker changed from User story to Architecture
  • Status changed from 10 to Released
Actions #11

Updated by Nicolas PERRON almost 12 years ago

  • Project changed from Rudder to 34
  • Category deleted (11)
Actions #12

Updated by Benoît PECCATTE over 9 years ago

  • Project changed from 34 to Rudder
  • Category set to Packaging
Actions

Also available in: Atom PDF