@@ -566,3 +566,55 @@ def test_snapshot_compatibility(self):
566566 self ._process_on_stop ()
567567 prev_version = version
568568 num_snapshot += 1
569+
570+
571+ class PreOidsFetchValueTest (NodeProvider , unittest .TestCase ):
572+
573+ def test_pre_oid_references (self ):
574+ cluster = self ._new_cluster ('5.4.x' , 3 )
575+ cluster .start ()
576+
577+ with connect (cluster .node ().http_url , error_trace = True ) as conn :
578+ c = conn .cursor ()
579+ c .execute ("create table tbl (a text, b text) partitioned by (a)" )
580+ c .execute ("insert into tbl (a, b) values ('foo1', 'bar1')" )
581+
582+ for idx , node in enumerate (cluster ):
583+ new_node = self .upgrade_node (node , '5.8.5' )
584+ cluster [idx ] = new_node
585+
586+ with connect (cluster .node ().http_url , error_trace = True ) as conn :
587+ c = conn .cursor ()
588+ c .execute ("alter table tbl add column c text" )
589+ c .execute ("insert into tbl (a, b, c) values ('foo1', 'bar2', 'baz2')" )
590+ c .execute ("insert into tbl (a, b, c) values ('foo2', 'bar1', 'baz1')" )
591+
592+ for idx , node in enumerate (cluster ):
593+ new_node = self .upgrade_node (node , '5.9.x' )
594+ cluster [idx ] = new_node
595+
596+ with connect (cluster .node ().http_url , error_trace = True ) as conn :
597+ c = conn .cursor ()
598+ c .execute ("insert into tbl (a, b, c) values ('foo1', 'bar3', 'baz3')" )
599+ c .execute ("insert into tbl (a, b, c) values ('foo2', 'bar2', 'baz2')" )
600+ c .execute ("insert into tbl (a, b, c) values ('foo3', 'bar1', 'baz1')" )
601+
602+ for idx , node in enumerate (cluster ):
603+ new_node = self .upgrade_node (node , '5.10' )
604+ cluster [idx ] = new_node
605+
606+ with connect (cluster .node ().http_url , error_trace = True ) as conn :
607+ c = conn .cursor ()
608+ c .execute ("insert into tbl (a, b, c) values ('foo1', 'bar4', 'baz4')" )
609+ c .execute ("insert into tbl (a, b, c) values ('foo2', 'bar3', 'baz3')" )
610+ c .execute ("insert into tbl (a, b, c) values ('foo3', 'bar2', 'baz2')" )
611+ c .execute ("insert into tbl (a, b, c) values ('foo4', 'bar1', 'baz1')" )
612+
613+ c .execute ("refresh table tbl" )
614+
615+ # LIMIT 10 forces the engine to go via _doc, which triggers the bug
616+ # fixed by https://github.com/crate/crate/pull/17819
617+ c .execute ("select b from tbl limit 10" )
618+ result = c .fetchall ()
619+ for row in result :
620+ self .assertIsNotNone (row [0 ])
0 commit comments