File: rpl_row_jsondiff_basic_pk.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (830 lines) | stat: -rw-r--r-- 42,841 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
include/rpl_init.inc [topology=1->2->3->4->5->6]
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
include/rpl_default_connections.inc
include/rpl_stop_slaves.inc
include/begin_replace_combination.inc [BOTH.BINLOG_FORMAT=ROW,MIXED,STATEMENT -> GLOBAL.SLAVE_ROWS_SEARCH_ALGORITHMS=INDEX_SCAN,HASH_SCAN,TABLE_SCAN]
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
include/rpl_start_slaves.inc
######## INITIALIZE ########
include/rpl_for_each_server_stmt.inc [SET @@SESSION.BINLOG_ROW_IMAGE = MINIMAL;
SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = PARTIAL_JSON;
SET @@GLOBAL.BINLOG_ROW_IMAGE = MINIMAL;
SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS = PARTIAL_JSON;
]
include/rpl_stop_slaves.inc
include/rpl_start_slaves.inc
******** Single JSON column ********
==== Full format ====
---- 1. Update one row using full format (wrong column used) ----
include/rpl_row_jsondiff_scenario.inc
* CREATE TABLE test.t (i INT PRIMARY KEY, j JSON, k JSON)
# Before update
i	j	k
1	[1, 2]	[3, 4]
UPDATE t SET j = JSON_SET(k, '$[0]', 'a') WHERE i = 1
# After update
i	j	k
1	["a", 4]	[3, 4]
# Decoded rows
UPDATE `test`.`t` SET j='["a", 4]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='["a", 4]', k=k WHERE i=1 AND j=CAST('[1, 2]' AS JSON) AND k=CAST('[3, 4]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='["a", 4]', k=k WHERE i=1;
---- 2. Update one row using full format (no JSON function used) ----
include/rpl_row_jsondiff_scenario.inc
* CREATE TABLE test.t (i INT PRIMARY KEY, j JSON)
# Before update
i	j
1	[1, 2]
UPDATE t SET j = CAST(7 AS JSON) WHERE i = 1
# After update
i	j
1	7
# Decoded rows
UPDATE `test`.`t` SET j='7' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='7' WHERE i=1 AND j=CAST('[1, 2]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='7' WHERE i=1;
---- 3. Update one row using full format (wrong JSON function used (1)) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2]
UPDATE t SET j = JSON_MERGE(j, '[8]') WHERE i = 1
Warnings:
Warning	1287	'JSON_MERGE' is deprecated and will be removed in a future release. Please use JSON_MERGE_PRESERVE/JSON_MERGE_PATCH instead
# After update
i	j
1	[1, 2, 8]
# Decoded rows
UPDATE `test`.`t` SET j='[1, 2, 8]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[1, 2, 8]' WHERE i=1 AND j=CAST('[1, 2]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[1, 2, 8]' WHERE i=1;
---- 4. Update one row using full format (wrong JSON function used (2)) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2]
UPDATE t SET j = JSON_MERGE(JSON_REPLACE(j, '$[0]', 3), '[8]') WHERE i = 1
Warnings:
Warning	1287	'JSON_MERGE' is deprecated and will be removed in a future release. Please use JSON_MERGE_PRESERVE/JSON_MERGE_PATCH instead
# After update
i	j
1	[3, 2, 8]
# Decoded rows
UPDATE `test`.`t` SET j='[3, 2, 8]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[3, 2, 8]' WHERE i=1 AND j=CAST('[1, 2]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[3, 2, 8]' WHERE i=1;
---- 5. Update one row using full format (wrong JSON function used (3)) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2]
UPDATE t SET j = JSON_REPLACE(JSON_MERGE(j, '[8]'), '$[0]', 3) WHERE i = 1
Warnings:
Warning	1287	'JSON_MERGE' is deprecated and will be removed in a future release. Please use JSON_MERGE_PRESERVE/JSON_MERGE_PATCH instead
# After update
i	j
1	[3, 2, 8]
# Decoded rows
UPDATE `test`.`t` SET j='[3, 2, 8]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[3, 2, 8]' WHERE i=1 AND j=CAST('[1, 2]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[3, 2, 8]' WHERE i=1;
---- 6. Update one row using full format (full smaller than partial) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvwxyz', '$[0]', 3) WHERE i = 1
# After update
i	j
1	[3, 2]
# Decoded rows
UPDATE `test`.`t` SET j='[3, 2]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[3, 2]' WHERE i=1 AND j=CAST('[1, 2]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[3, 2]' WHERE i=1;
==== Single diffs ====
---- 7. Update one row (REPLACE using JSON_REPLACE in array) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_REPLACE(j, '$[0]', 7) WHERE i = 1
# After update
i	j
1	[7, {"a": 2}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 7) WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', 7) WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', 7) WHERE i=1;
---- 8. Update one row (REPLACE using JSON_SET in array) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_SET(j, '$[0]', "7") WHERE i = 1
# After update
i	j
1	["7", {"a": 2}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', '7') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', '7') WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', '7') WHERE i=1;
---- 9. Update one row (REPLACE using JSON_REPLACE in object) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_REPLACE(j, '$[1].a', CAST('[7]' AS JSON)) WHERE i = 1
# After update
i	j
1	[1, {"a": [7]}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[1].a', CAST('[7]' AS JSON)) WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1].a', CAST('[7]' AS JSON)) WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1].a', CAST('[7]' AS JSON)) WHERE i=1;
---- 10. Update one row (REPLACE using JSON_SET in object) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_SET(j, '$[1].a', CAST('{"a":7}' AS JSON)) WHERE i = 1
# After update
i	j
1	[1, {"a": {"a": 7}}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[1].a', CAST('{"a": 7}' AS JSON)) WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1].a', CAST('{"a": 7}' AS JSON)) WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1].a', CAST('{"a": 7}' AS JSON)) WHERE i=1;
---- 11. Update one row (INSERT using JSON_SET in array) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_SET(j, '$[2]', 3) WHERE i = 1
# After update
i	j
1	[1, {"a": 2}, 3]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_SET(j, '$[2]', 3) WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$[2]', 3) WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$[2]', 3) WHERE i=1;
---- 12. Update one row (INSERT using JSON_SET in object) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_SET(j, '$[1].b', CAST(4 AS DECIMAL)) WHERE i = 1
# After update
i	j
1	[1, {"a": 2, "b": 4}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_SET(j, '$[1].b', 4) WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$[1].b', 4) WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$[1].b', 4) WHERE i=1;
---- 13. Update one row (REMOVE using JSON_REMOVE in array) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_REMOVE(j, '$[1]') WHERE i = 1
# After update
i	j
1	[1]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REMOVE(j, '$[1]') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]') WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]') WHERE i=1;
---- 14. Update one row (REMOVE using JSON_REMOVE in object) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, {"a": 2}]
UPDATE t SET j = JSON_REMOVE(j, '$[1].a') WHERE i = 1
# After update
i	j
1	[1, {}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REMOVE(j, '$[1].a') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1].a') WHERE i=1 AND j=CAST('[1, {"a": 2}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1].a') WHERE i=1;
==== Multiple diffs from one function call ====
---- 15. Update one row (many different update types, using JSON_SET) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]
UPDATE t SET j = JSON_SET(j, '$[0]', 'one', '$[1]', 'two', '$[2].a', 'three', '$[2].b', 'four', '$[2].c', 'five', '$[2].d', 'six', '$[3]', 'seven', '$[4]', 'eight') WHERE i = 1
# After update
i	j
1	["one", "two", {"a": "three", "b": "four", "c": "five", "d": "six", "a long string that ensures that the diff format is smaller than the full format": ""}, "seven", "eight"]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_SET( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2].a', 'three', '$[2].b', 'four'), '$[2].c', 'five', '$[2].d', 'six'), '$[3]', 'seven', '$[4]', 'eight') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_SET( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2].a', 'three', '$[2].b', 'four'), '$[2].c', 'five', '$[2].d', 'six'), '$[3]', 'seven', '$[4]', 'eight') WHERE i=1 AND j=CAST('[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_SET( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2].a', 'three', '$[2].b', 'four'), '$[2].c', 'five', '$[2].d', 'six'), '$[3]', 'seven', '$[4]', 'eight') WHERE i=1;
---- 16. Update one row (many different update types, using JSON_REPLACE) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]
UPDATE t SET j = JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[3].a', 'three', '$[3].b', 'four', '$[0]', 'ONE', '$[1]', 'TWO', '$[3].a', 'THREE', '$[3].b', 'FOUR') WHERE i = 1
# After update
i	j
1	["ONE", "TWO", {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[0]', 'ONE', '$[1]', 'TWO') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[0]', 'ONE', '$[1]', 'TWO') WHERE i=1 AND j=CAST('[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[0]', 'ONE', '$[1]', 'TWO') WHERE i=1;
---- 17. Update one row (using JSON_REMOVE) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]
UPDATE t SET j = JSON_REMOVE(j, '$[1]', '$[2].b', '$[2].a', '$[0]') WHERE i = 1
# After update
i	j
1	[{"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REMOVE(j, '$[1]', '$[0]') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]', '$[0]') WHERE i=1 AND j=CAST('[1, 2, {"a": 3, "b": 4, "a long string that ensures that the diff format is smaller than the full format": ""}]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]', '$[0]') WHERE i=1;
==== Multiple diffs from multiple function calls ====
---- 18. Update one row (using JSON_SET, JSON_REPLACE, and JSON_REMOVE) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_REMOVE(JSON_SET(JSON_REPLACE(JSON_SET(j, '$[0]', 'one'), '$[1]', 'two', '$[2]', CAST('{"a": 1}' AS JSON)), '$[2].b', 2, '$[2].c', 3), '$[0]', '$[0]') WHERE i = 1
# After update
i	j
1	[{"a": 1, "b": 2, "c": 3}, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REMOVE( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2]', CAST('{"a": 1}' AS JSON)), '$[2].b', 2, '$[2].c', 3), '$[0]', '$[0]') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2]', CAST('{"a": 1}' AS JSON)), '$[2].b', 2, '$[2].c', 3), '$[0]', '$[0]') WHERE i=1 AND j=CAST('[1, 2, 3, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE( JSON_SET( JSON_REPLACE(j, '$[0]', 'one', '$[1]', 'two', '$[2]', CAST('{"a": 1}' AS JSON)), '$[2].b', 2, '$[2].c', 3), '$[0]', '$[0]') WHERE i=1;
==== NULL values ====
---- 19. Updating from non-NULL to NULL using JSON_SET ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3, 4]
UPDATE t SET j = JSON_SET(j, NULL, 'a') WHERE i = 1
# After update
i	j
1	NULL
# Decoded rows
UPDATE `test`.`t` SET j=NULL WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1 AND j=CAST('[1, 2, 3, 4]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1;
---- 20. Updating from non-NULL to NULL using JSON_REPLACE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3, 4]
UPDATE t SET j = JSON_REPLACE(j, NULL, 'a') WHERE i = 1
# After update
i	j
1	NULL
# Decoded rows
UPDATE `test`.`t` SET j=NULL WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1 AND j=CAST('[1, 2, 3, 4]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1;
---- 21. Updating from non-NULL to NULL using JSON_REMOVE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3, 4]
UPDATE t SET j = JSON_REMOVE(j, NULL) WHERE i = 1
# After update
i	j
1	NULL
# Decoded rows
UPDATE `test`.`t` SET j=NULL WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1 AND j=CAST('[1, 2, 3, 4]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=NULL WHERE i=1;
---- 22. Updating from NULL to non-NULL using JSON_SET ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	NULL
UPDATE t SET j = JSON_SET('{"a": "a"}', '$.b', j) WHERE i = 1
# After update
i	j
1	{"a": "a", "b": null}
# Decoded rows
UPDATE `test`.`t` SET j='{"a": "a", "b": null}' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='{"a": "a", "b": null}' WHERE i=1 AND j IS NULL;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='{"a": "a", "b": null}' WHERE i=1;
---- 23. Updating from NULL to non-NULL using JSON_REPLACE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	NULL
UPDATE t SET j = JSON_REPLACE('{"a": "a"}', '$.a', j) WHERE i = 1
# After update
i	j
1	{"a": null}
# Decoded rows
UPDATE `test`.`t` SET j='{"a": null}' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='{"a": null}' WHERE i=1 AND j IS NULL;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='{"a": null}' WHERE i=1;
---- 24. Updating from NULL to non-NULL using JSON_REMOVE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	NULL
UPDATE t SET j = JSON_REPLACE('{"a": "a", "b": "b"}', '$.b', 'BB') WHERE i = 1
# After update
i	j
1	{"a": "a", "b": "BB"}
# Decoded rows
UPDATE `test`.`t` SET j='{"a": "a", "b": "BB"}' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='{"a": "a", "b": "BB"}' WHERE i=1 AND j IS NULL;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='{"a": "a", "b": "BB"}' WHERE i=1;
==== No-op updates ====
---- 25. Making a no-op not mentioning the column ----
include/rpl_row_jsondiff_scenario.inc
* CREATE TABLE test.t (i INT PRIMARY KEY, j JSON, x INT)
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2  WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 26. Making a no-op setting the column to itself ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = j WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 27. Making a no-op setting the column to its own value (1) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = CONCAT(j, '') WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 28. Making a no-op setting the column to its own value (2) ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = '["a", {"b": "c"}]' WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 29. Making a no-op using JSON_SET inserting object in non-object or array element in non-array ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_SET(j, '$.a', 0, '$[1][2]', 1, '$[1].b.x', 2) WHERE i = 1
# After update
i	j	x
1	["a", [{"b": "c"}, 1]]	2
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[1]', CAST('[{"b": "c"}, 1]' AS JSON)), x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1]', CAST('[{"b": "c"}, 1]' AS JSON)), x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REPLACE(j, '$[1]', CAST('[{"b": "c"}, 1]' AS JSON)), x=2 WHERE i=1;
---- 30. Making a no-op using JSON_REPLACE with non-existing paths ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_REPLACE(j, '$[9]', 0, '$.x', 1, '$[1].x', 2) WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 31. Making a no-op removing a non-existing path, using JSON_REMOVE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_REMOVE(j, '$[9]', '$[1].x', '$.foo', '$[1][0]') WHERE i = 1
# After update
i	j	x
1	["a"]	2
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REMOVE(j, '$[1]'), x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]'), x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_REMOVE(j, '$[1]'), x=2 WHERE i=1;
---- 32. Making a no-op replacing a JSON value by itself, using JSON_SET ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_SET(j, '$[0]', 'a', '$[1].b', 'c', '$[0]', 'a') WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 33. Making a no-op replacing a JSON value by itself, using JSON_REPLACE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_REPLACE(j, '$[0]', 'a', '$[1].b', 'c', '$[0]', 'a') WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
---- 34. Making a no-op update using JSON_SET, JSON_REPLACE, and JSON_REMOVE ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j	x
1	["a", {"b": "c"}]	1
UPDATE t SET x = 2, j = JSON_SET(JSON_REMOVE(JSON_REPLACE(j,
'$[0]', 'a', '$[1].b', 'c', '$[0]', 'a'),
'$[9]', '$[1].x', '$.foo'),
'$[0]', 'a', '$[1].b', 'c', '$[0]', 'a') WHERE i = 1
# After update
i	j	x
1	["a", {"b": "c"}]	2
# Decoded rows
UPDATE `test`.`t` SET j=j, x=2 WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1 AND j=CAST('["a", {"b": "c"}]' AS JSON) AND x=1;
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=j, x=2 WHERE i=1;
==== Long paths ====
---- 35. Update using long path ----
include/rpl_row_jsondiff_scenario.inc
* CREATE TABLE test.t (i INT PRIMARY KEY, j JSON)
# Before update
i	j
1	{"abc": "def"}
UPDATE t SET j = JSON_SET(j, '$.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'ghi') WHERE i = 1
# After update
i	j
1	{"abc": "def", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "ghi"}
# Decoded rows
UPDATE `test`.`t` SET j=JSON_SET(j, '$.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'ghi') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'ghi') WHERE i=1 AND j=CAST('{"abc": "def"}' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'ghi') WHERE i=1;
---- 36. Update using long document ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	{"abc": "def"}
UPDATE t SET j = JSON_SET(j, '$.ghi', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') WHERE i = 1
# After update
i	j
1	{"abc": "def", "ghi": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
# Decoded rows
UPDATE `test`.`t` SET j=JSON_SET(j, '$.ghi', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$.ghi', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') WHERE i=1 AND j=CAST('{"abc": "def"}' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=JSON_SET(j, '$.ghi', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') WHERE i=1;
---- 37. Update using very long document ----
include/rpl_row_jsondiff_scenario.inc
==== Auto-wrapping ====
---- 38. Auto-wrap using JSON_SET ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	{"a": 1}
UPDATE t SET j = JSON_SET(j, '$[1]', 4711) WHERE i = 1
# After update
i	j
1	[{"a": 1}, 4711]
# Decoded rows
UPDATE `test`.`t` SET j='[{"a": 1}, 4711]' WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[{"a": 1}, 4711]' WHERE i=1 AND j=CAST('{"a": 1}' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[{"a": 1}, 4711]' WHERE i=1;
==== Multi-row updates ====
---- 39. Update two rows: both partial ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i = 2 OR i = 4 
# After update
i	j
1	[1, 2, 3]
2	[0, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[0, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4;
# Decoded rows, full image
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2 AND j=CAST('[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
UPDATE `test`.`t` SET i=4, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4 AND j=CAST('[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET i=4, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4;
---- 40. Update two rows: first partial, then full ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i = 2 OR i = 3 
# After update
i	j
1	[1, 2, 3]
2	[0, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[0, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET j='[0, 8, 9]' WHERE i=3;
# Decoded rows, full image
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2 AND j=CAST('[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3 AND j=CAST('[7, 8, 9]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3;
---- 41. Update two rows: first full, then partial ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i = 1 OR i = 2 
# After update
i	j
1	[0, 2, 3]
2	[0, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1 AND j=CAST('[1, 2, 3]' AS JSON);
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2 AND j=CAST('[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
---- 42. Update two rows: both full ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i = 1 OR i = 3 
# After update
i	j
1	[0, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[0, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET j='[0, 8, 9]' WHERE i=3;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1 AND j=CAST('[1, 2, 3]' AS JSON);
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3 AND j=CAST('[7, 8, 9]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3;
---- 43. Update four rows: full, partial, full, partial ----
include/rpl_row_jsondiff_scenario.inc
# Before update
i	j
1	[1, 2, 3]
2	[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[7, 8, 9]
4	[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
UPDATE t SET j = JSON_SET(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i IN (1, 2, 3, 4) 
# After update
i	j
1	[0, 2, 3]
2	[0, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]
3	[0, 8, 9]
4	[0, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]
# Decoded rows
UPDATE `test`.`t` SET j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET j='[0, 8, 9]' WHERE i=3;
UPDATE `test`.`t` SET j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1 AND j=CAST('[1, 2, 3]' AS JSON);
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2 AND j=CAST('[4, 5, 6, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3 AND j=CAST('[7, 8, 9]' AS JSON);
UPDATE `test`.`t` SET i=4, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4 AND j=CAST('[10, 11, 12, "a long string that ensures that the diff format is smaller than the full format"]' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j='[0, 2, 3]' WHERE i=1;
UPDATE `test`.`t` SET i=2, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=2;
UPDATE `test`.`t` SET i=3, j='[0, 8, 9]' WHERE i=3;
UPDATE `test`.`t` SET i=4, j=JSON_REPLACE(j, '$[0]', 'abcdefghijklmnopqrstuvxyz', '$[0]', 0) WHERE i=4;
==== Invalid paths ====
TODO
******** Multiple JSON columns ********
---- 44. Update after null and after non-modified column ----
include/rpl_row_jsondiff_scenario.inc
* CREATE TABLE test.t (i INT PRIMARY KEY, j JSON, k JSON, l JSON, m JSON)
# Before update
i	j	k	l	m
1	[1, 2, 3, 4]	[5, 6, 7, 8]	{"a": 1, "b": 2, "c": 3, "d": 4}	{"e": 8, "f": 6, "g": 7}
UPDATE t SET j = NULL, l = JSON_SET(l, '$.d', "DDD") 
# After update
i	j	k	l	m
1	NULL	[5, 6, 7, 8]	{"a": 1, "b": 2, "c": 3, "d": "DDD"}	{"e": 8, "f": 6, "g": 7}
# Decoded rows
UPDATE `test`.`t` SET j=NULL, l=JSON_REPLACE(l, '$.d', 'DDD') WHERE i=1;
# Decoded rows, full image
UPDATE `test`.`t` SET i=1, j=NULL, k=k, l=JSON_REPLACE(l, '$.d', 'DDD'), m=m WHERE i=1 AND j=CAST('[1, 2, 3, 4]' AS JSON) AND k=CAST('[5, 6, 7, 8]' AS JSON) AND l=CAST('{"a": 1, "b": 2, "c": 3, "d": 4}' AS JSON) AND m=CAST('{"e": 8, "f": 6, "g": 7}' AS JSON);
# Decoded rows, minimal image when master has full image
UPDATE `test`.`t` SET i=1, j=NULL, k=k, l=JSON_REPLACE(l, '$.d', 'DDD'), m=m WHERE i=1;
******** Differences between master and slave ********
TODO: applies ok, does not apply, and mix
######## CLEAN UP ########
include/rpl_for_each_server_stmt.inc [SET @@SESSION.BINLOG_ROW_IMAGE = FULL;
SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = '';
SET @@GLOBAL.BINLOG_ROW_IMAGE = FULL;
SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS = '';
SET SESSION SQL_LOG_BIN = 0; DROP TABLE test.t; SET SESSION SQL_LOG_BIN = 1;
]
include/rpl_stop_slaves.inc
include/end_replace_combination.inc [BOTH.BINLOG_FORMAT=ROW,MIXED,STATEMENT -> GLOBAL.SLAVE_ROWS_SEARCH_ALGORITHMS=INDEX_SCAN,HASH_SCAN,TABLE_SCAN]
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warnings:
Warning	1287	'@@slave_rows_search_algorithms' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
Warning	1287	'@@binlog_format' is deprecated and will be removed in a future release.
include/rpl_start_slaves.inc
include/rpl_end.inc