xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [OSSTEST PATCH 0/3] Schema tidying following recent changes
@ 2017-07-03 16:59 Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 1/3] mg-schema-test-database: Apply updates, regardless of compatibility Ian Jackson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ian Jackson @ 2017-07-03 16:59 UTC (permalink / raw)
  To: xen-devel

We make mg-schema-test-database work again.  Also, we make testid be
NOT NULL.  (Everything sets it and has done almost forever.)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 1/3] mg-schema-test-database: Apply updates, regardless of compatibility
  2017-07-03 16:59 [OSSTEST PATCH 0/3] Schema tidying following recent changes Ian Jackson
@ 2017-07-03 16:59 ` Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 2/3] mg-schema-test-database: New --max-flight option Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 3/3] db schema: Make the testid column NOT NLLL Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-07-03 16:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

The test database should be just like the real one, even if the schema
compatibility looks wrong.  So pass -ff to mg-schema-update.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 mg-schema-test-database | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mg-schema-test-database b/mg-schema-test-database
index 641aadb..9be0625 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -411,7 +411,7 @@ END
 END
 	withtest ./mg-schema-create -q --no-updates
 
-	withtest ./mg-schema-update -q apply $wantupdates
+	withtest ./mg-schema-update -qff apply $wantupdates
 
         printf " (seqs)"
         seq_alters=""
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 2/3] mg-schema-test-database: New --max-flight option
  2017-07-03 16:59 [OSSTEST PATCH 0/3] Schema tidying following recent changes Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 1/3] mg-schema-test-database: Apply updates, regardless of compatibility Ian Jackson
@ 2017-07-03 16:59 ` Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 3/3] db schema: Make the testid column NOT NLLL Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-07-03 16:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This can be useful when testing things which involve old data, rather
than things which just involve new data.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 mg-schema-test-database | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mg-schema-test-database b/mg-schema-test-database
index 9be0625..286010d 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -4,7 +4,7 @@
 #
 #
 #  ./mg-schema-test-database create [_SUFFIX] [TASK...] \
-#		[-fMINFLIGHT | -f-NUMFLIGHTS] \
+#		[-fMINFLIGHT | -f-NUMFLIGHTS] [--max-flight=MAXFLIGHT] \
 #		[-hCTRL_DAEMONS_HOST] [-fOWNER_D_PORT[,QUEUE_D_PORT]]
 #
 # does `drop' and then creates
@@ -231,6 +231,7 @@ create)
 
 	tasks=''
 	minflight=-100
+	maxflightcond='1=1'
 	for arg in "$@"; do
 		case "$arg" in
 		*@*)
@@ -251,6 +252,9 @@ create)
 			;;
 		_*)	suffix="$arg"
 			;;
+		--max-flight=*)
+			maxflightcond="flight <= ${arg#*=}"
+			;;
 		-f*)	minflight="${arg#-f}"
 			;;
 		-h*)	ctrlhost="${arg#-h}"
@@ -471,7 +475,9 @@ END
 		schema_updates)	continue ;;
 		esac
 		case " $ftables " in
-		*" $table "*)	condition="flight >= $minflight" ;;
+		*" $table "*)
+ condition="flight >= $minflight AND $maxflightcond"
+				;;
 		*)		condition="1=1" ;;
 		esac
 		each_copy_table $table "$condition"
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 3/3] db schema: Make the testid column NOT NLLL
  2017-07-03 16:59 [OSSTEST PATCH 0/3] Schema tidying following recent changes Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 1/3] mg-schema-test-database: Apply updates, regardless of compatibility Ian Jackson
  2017-07-03 16:59 ` [OSSTEST PATCH 2/3] mg-schema-test-database: New --max-flight option Ian Jackson
@ 2017-07-03 16:59 ` Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-07-03 16:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

We have to fix some old data.  We insist that the old data is indeed
old (more than 5 years old) and not part of proper flights (ie,
blessed "play" or "crashed" or "unknown").

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 schema/testid-constraint.sql | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 schema/testid-constraint.sql

diff --git a/schema/testid-constraint.sql b/schema/testid-constraint.sql
new file mode 100644
index 0000000..541f26e
--- /dev/null
+++ b/schema/testid-constraint.sql
@@ -0,0 +1,28 @@
+-- ##OSSTEST## 005 Harmless
+--
+-- All steps should have a testid.
+-- Some very old data in our existing instances lacks this.
+--
+-- The time_t value is Tue Jul  3 17:09:12 BST 2012, 5 years ago.
+
+WITH cutoff AS
+   (SELECT 1341331754)
+UPDATE steps
+   SET testid = 'xxx-dumy-testid.' || stepno
+ WHERE testid IS NULL
+   AND (
+      WITH f AS
+          (SELECT * FROM flights WHERE flights.flight = steps.flight)
+      SELECT
+	    (   ((SELECT blessing FROM f) = 'unknown'
+	      OR (SELECT blessing FROM f) = 'play'
+	      OR (SELECT blessing FROM f) = 'crashed')
+            )
+	AND (SELECT started FROM f) < (SELECT * FROM cutoff)
+	AND COALESCE( steps.flight <
+	              (SELECT min(flight) FROM flights
+	                WHERE started >= (SELECT * FROM cutoff))
+                      , 1=1 )
+           );
+
+ALTER TABLE steps ALTER COLUMN testid SET NOT NULL;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-03 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 16:59 [OSSTEST PATCH 0/3] Schema tidying following recent changes Ian Jackson
2017-07-03 16:59 ` [OSSTEST PATCH 1/3] mg-schema-test-database: Apply updates, regardless of compatibility Ian Jackson
2017-07-03 16:59 ` [OSSTEST PATCH 2/3] mg-schema-test-database: New --max-flight option Ian Jackson
2017-07-03 16:59 ` [OSSTEST PATCH 3/3] db schema: Make the testid column NOT NLLL Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).