From 047f9b482cbccb0cc0f5583c8ff2feb0fdfb76de Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Tue, 28 Feb 2023 21:35:03 +0200 Subject: [PATCH 1/5] Online DDL: enforce ALGORITHM=COPY on shadow table Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/onlineddl/executor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 8cc42a317cf..a5f0d63890d 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -1171,6 +1171,9 @@ func (e *Executor) validateAndEditAlterTableStatement(ctx context.Context, onlin for i := range alterTable.AlterOptions { opt := alterTable.AlterOptions[i] switch opt := opt.(type) { + case sqlparser.AlgorithmValue: + // we do not pass ALGORITHM. We choose our own ALGORITHM. + continue case *sqlparser.AddIndexDefinition: if opt.IndexDefinition.Info.Fulltext { countAddFullTextStatements++ @@ -1189,6 +1192,7 @@ func (e *Executor) validateAndEditAlterTableStatement(ctx context.Context, onlin redactedOptions = append(redactedOptions, opt) } alterTable.AlterOptions = redactedOptions + alterTable.AlterOptions = append(alterTable.AlterOptions, sqlparser.AlgorithmValue("COPY")) return alters, nil } From ff885880de7677727e6bbac4f31be787ebdbd3de Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Tue, 28 Feb 2023 22:32:51 +0200 Subject: [PATCH 2/5] unit tests Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/onlineddl/executor.go | 2 +- go/vt/vttablet/onlineddl/executor_test.go | 24 +++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index a5f0d63890d..05ab5a72004 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -1182,7 +1182,7 @@ func (e *Executor) validateAndEditAlterTableStatement(ctx context.Context, onlin // in the same statement extraAlterTable := &sqlparser.AlterTable{ Table: alterTable.Table, - AlterOptions: []sqlparser.AlterOption{opt}, + AlterOptions: []sqlparser.AlterOption{opt, sqlparser.AlgorithmValue("COPY")}, } alters = append(alters, extraAlterTable) continue diff --git a/go/vt/vttablet/onlineddl/executor_test.go b/go/vt/vttablet/onlineddl/executor_test.go index e4a8e352026..927bb92728f 100644 --- a/go/vt/vttablet/onlineddl/executor_test.go +++ b/go/vt/vttablet/onlineddl/executor_test.go @@ -182,51 +182,51 @@ func TestValidateAndEditAlterTableStatement(t *testing.T) { }{ { alter: "alter table t add column i int", - expect: []string{"alter table t add column i int"}, + expect: []string{"alter table t add column i int, algorithm = COPY"}, }, { alter: "alter table t add column i int, add fulltext key name1_ft (name1)", - expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1)"}, + expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = COPY"}, }, { alter: "alter table t add column i int, add fulltext key name1_ft (name1), add fulltext key name2_ft (name2)", - expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1)", "alter table t add fulltext key name2_ft (name2)"}, + expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = COPY", "alter table t add fulltext key name2_ft (name2), algorithm = COPY"}, }, { alter: "alter table t add fulltext key name0_ft (name0), add column i int, add fulltext key name1_ft (name1), add fulltext key name2_ft (name2)", - expect: []string{"alter table t add fulltext key name0_ft (name0), add column i int", "alter table t add fulltext key name1_ft (name1)", "alter table t add fulltext key name2_ft (name2)"}, + expect: []string{"alter table t add fulltext key name0_ft (name0), add column i int, algorithm = COPY", "alter table t add fulltext key name1_ft (name1), algorithm = COPY", "alter table t add fulltext key name2_ft (name2), algorithm = COPY"}, }, { alter: "alter table t add constraint check (id != 1)", - expect: []string{"alter table t add constraint chk_aulpn7bjeortljhguy86phdn9 check (id != 1)"}, + expect: []string{"alter table t add constraint chk_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, }, { alter: "alter table t add constraint t_chk_1 check (id != 1)", - expect: []string{"alter table t add constraint chk_1_aulpn7bjeortljhguy86phdn9 check (id != 1)"}, + expect: []string{"alter table t add constraint chk_1_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, }, { alter: "alter table t add constraint some_check check (id != 1)", - expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1)"}, + expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, }, { alter: "alter table t add constraint some_check check (id != 1), add constraint another_check check (id != 2)", - expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), add constraint another_check_4fa197273p3w96267pzm3gfi3 check (id != 2)"}, + expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), add constraint another_check_4fa197273p3w96267pzm3gfi3 check (id != 2), algorithm = COPY"}, }, { alter: "alter table t add foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint fk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action"}, + expect: []string{"alter table t add constraint fk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, }, { alter: "alter table t add constraint myfk foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint myfk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action"}, + expect: []string{"alter table t add constraint myfk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, }, { alter: "alter table t add constraint t_fk_1 foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action"}, + expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, }, { alter: "alter table t add constraint t_fk_1 foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check check (id != 1)", - expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1)"}, + expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, }, } for _, tc := range tt { From df6f3bb1f30012841bd7320959fbdcccaa28a3f4 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 1 Mar 2023 06:55:11 +0200 Subject: [PATCH 3/5] sqlparser: make ALGORITHM values constants, use in Online DDL Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/sqlparser/constants.go | 6 ++++++ go/vt/sqlparser/parse_test.go | 7 +++++++ go/vt/sqlparser/sql.go | 8 ++++---- go/vt/sqlparser/sql.y | 8 ++++---- go/vt/vttablet/onlineddl/executor.go | 5 +++-- go/vt/vttablet/onlineddl/executor_test.go | 24 +++++++++++------------ 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/go/vt/sqlparser/constants.go b/go/vt/sqlparser/constants.go index 8331060c0ff..81f2e067563 100644 --- a/go/vt/sqlparser/constants.go +++ b/go/vt/sqlparser/constants.go @@ -65,6 +65,12 @@ const ( AddSequenceStr = "add sequence" AddAutoIncStr = "add auto_increment" + // ALTER TABLE ALGORITHM string. + DefaultStr = "default" + CopyStr = "copy" + InplaceStr = "inplace" + InstantStr = "instant" + // Partition and subpartition type strings HashTypeStr = "hash" KeyTypeStr = "key" diff --git a/go/vt/sqlparser/parse_test.go b/go/vt/sqlparser/parse_test.go index 5f74a5e67dc..af585130684 100644 --- a/go/vt/sqlparser/parse_test.go +++ b/go/vt/sqlparser/parse_test.go @@ -1246,6 +1246,13 @@ var ( input: "alter table a convert to character set utf32", }, { input: "alter table `By` add column foo int, algorithm = default", + }, { + input: "alter table `By` add column foo int, algorithm = copy", + }, { + input: "alter table `By` add column foo int, algorithm = inplace", + }, { + input: "alter table `By` add column foo int, algorithm = INPLACE", + output: "alter table `By` add column foo int, algorithm = inplace", }, { input: "alter table `By` add column foo int, algorithm = instant", }, { diff --git a/go/vt/sqlparser/sql.go b/go/vt/sqlparser/sql.go index c9bb09ec11b..507a204a3a4 100644 --- a/go/vt/sqlparser/sql.go +++ b/go/vt/sqlparser/sql.go @@ -12719,7 +12719,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3100 { - yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) + yyLOCAL = AlgorithmValue(DefaultStr) } yyVAL.union = yyLOCAL case 562: @@ -12727,7 +12727,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3104 { - yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) + yyLOCAL = AlgorithmValue(InplaceStr) } yyVAL.union = yyLOCAL case 563: @@ -12735,7 +12735,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3108 { - yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) + yyLOCAL = AlgorithmValue(CopyStr) } yyVAL.union = yyLOCAL case 564: @@ -12743,7 +12743,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3112 { - yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) + yyLOCAL = AlgorithmValue(InstantStr) } yyVAL.union = yyLOCAL case 565: diff --git a/go/vt/sqlparser/sql.y b/go/vt/sqlparser/sql.y index 57b0aebf856..db956400cb6 100644 --- a/go/vt/sqlparser/sql.y +++ b/go/vt/sqlparser/sql.y @@ -3098,19 +3098,19 @@ alter_commands_modifier_list: alter_commands_modifier: ALGORITHM equal_opt DEFAULT { - $$ = AlgorithmValue(string($3)) + $$ = AlgorithmValue(DefaultStr) } | ALGORITHM equal_opt INPLACE { - $$ = AlgorithmValue(string($3)) + $$ = AlgorithmValue(InplaceStr) } | ALGORITHM equal_opt COPY { - $$ = AlgorithmValue(string($3)) + $$ = AlgorithmValue(CopyStr) } | ALGORITHM equal_opt INSTANT { - $$ = AlgorithmValue(string($3)) + $$ = AlgorithmValue(InstantStr) } | LOCK equal_opt DEFAULT { diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 05ab5a72004..56a2e945167 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -102,6 +102,7 @@ var vexecInsertTemplates = []string{ var emptyResult = &sqltypes.Result{} var acceptableDropTableIfExistsErrorCodes = []mysql.ErrorCode{mysql.ERCantFindFile, mysql.ERNoSuchTable} +var copyAlgorithm = sqlparser.AlgorithmValue(sqlparser.CopyStr) var ( ghostOverridePath string @@ -1182,7 +1183,7 @@ func (e *Executor) validateAndEditAlterTableStatement(ctx context.Context, onlin // in the same statement extraAlterTable := &sqlparser.AlterTable{ Table: alterTable.Table, - AlterOptions: []sqlparser.AlterOption{opt, sqlparser.AlgorithmValue("COPY")}, + AlterOptions: []sqlparser.AlterOption{opt, copyAlgorithm}, } alters = append(alters, extraAlterTable) continue @@ -1192,7 +1193,7 @@ func (e *Executor) validateAndEditAlterTableStatement(ctx context.Context, onlin redactedOptions = append(redactedOptions, opt) } alterTable.AlterOptions = redactedOptions - alterTable.AlterOptions = append(alterTable.AlterOptions, sqlparser.AlgorithmValue("COPY")) + alterTable.AlterOptions = append(alterTable.AlterOptions, copyAlgorithm) return alters, nil } diff --git a/go/vt/vttablet/onlineddl/executor_test.go b/go/vt/vttablet/onlineddl/executor_test.go index 927bb92728f..2cf94be2d20 100644 --- a/go/vt/vttablet/onlineddl/executor_test.go +++ b/go/vt/vttablet/onlineddl/executor_test.go @@ -182,51 +182,51 @@ func TestValidateAndEditAlterTableStatement(t *testing.T) { }{ { alter: "alter table t add column i int", - expect: []string{"alter table t add column i int, algorithm = COPY"}, + expect: []string{"alter table t add column i int, algorithm = copy"}, }, { alter: "alter table t add column i int, add fulltext key name1_ft (name1)", - expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = COPY"}, + expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = copy"}, }, { alter: "alter table t add column i int, add fulltext key name1_ft (name1), add fulltext key name2_ft (name2)", - expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = COPY", "alter table t add fulltext key name2_ft (name2), algorithm = COPY"}, + expect: []string{"alter table t add column i int, add fulltext key name1_ft (name1), algorithm = copy", "alter table t add fulltext key name2_ft (name2), algorithm = copy"}, }, { alter: "alter table t add fulltext key name0_ft (name0), add column i int, add fulltext key name1_ft (name1), add fulltext key name2_ft (name2)", - expect: []string{"alter table t add fulltext key name0_ft (name0), add column i int, algorithm = COPY", "alter table t add fulltext key name1_ft (name1), algorithm = COPY", "alter table t add fulltext key name2_ft (name2), algorithm = COPY"}, + expect: []string{"alter table t add fulltext key name0_ft (name0), add column i int, algorithm = copy", "alter table t add fulltext key name1_ft (name1), algorithm = copy", "alter table t add fulltext key name2_ft (name2), algorithm = copy"}, }, { alter: "alter table t add constraint check (id != 1)", - expect: []string{"alter table t add constraint chk_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, + expect: []string{"alter table t add constraint chk_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = copy"}, }, { alter: "alter table t add constraint t_chk_1 check (id != 1)", - expect: []string{"alter table t add constraint chk_1_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, + expect: []string{"alter table t add constraint chk_1_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = copy"}, }, { alter: "alter table t add constraint some_check check (id != 1)", - expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, + expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = copy"}, }, { alter: "alter table t add constraint some_check check (id != 1), add constraint another_check check (id != 2)", - expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), add constraint another_check_4fa197273p3w96267pzm3gfi3 check (id != 2), algorithm = COPY"}, + expect: []string{"alter table t add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), add constraint another_check_4fa197273p3w96267pzm3gfi3 check (id != 2), algorithm = copy"}, }, { alter: "alter table t add foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint fk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, + expect: []string{"alter table t add constraint fk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = copy"}, }, { alter: "alter table t add constraint myfk foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint myfk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, + expect: []string{"alter table t add constraint myfk_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = copy"}, }, { alter: "alter table t add constraint t_fk_1 foreign key (parent_id) references onlineddl_test_parent (id) on delete no action", - expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = COPY"}, + expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, algorithm = copy"}, }, { alter: "alter table t add constraint t_fk_1 foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check check (id != 1)", - expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = COPY"}, + expect: []string{"alter table t add constraint fk_1_6fmhzdlya89128u5j3xapq34i foreign key (parent_id) references onlineddl_test_parent (id) on delete no action, add constraint some_check_aulpn7bjeortljhguy86phdn9 check (id != 1), algorithm = copy"}, }, } for _, tc := range tt { From cbaefc9eacb9a33fbe3a35cfd600867e2b29526a Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 1 Mar 2023 08:23:37 +0200 Subject: [PATCH 4/5] algorithm format Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/sqlparser/ast_format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/sqlparser/ast_format.go b/go/vt/sqlparser/ast_format.go index 7cf0a140de3..898e4c45f91 100644 --- a/go/vt/sqlparser/ast_format.go +++ b/go/vt/sqlparser/ast_format.go @@ -2204,7 +2204,7 @@ func (node *AddColumns) Format(buf *TrackedBuffer) { // Format formats the node. func (node AlgorithmValue) Format(buf *TrackedBuffer) { - buf.astPrintf(node, "algorithm = %s", string(node)) + buf.astPrintf(node, "algorithm = %#s", string(node)) } // Format formats the node From 0dabeed9f9d1fe83c207681d68488fa16fa8d2cd Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 1 Mar 2023 11:13:45 +0200 Subject: [PATCH 5/5] revert change to sql.y Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/sqlparser/parse_test.go | 3 +-- go/vt/sqlparser/sql.go | 8 ++++---- go/vt/sqlparser/sql.y | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/go/vt/sqlparser/parse_test.go b/go/vt/sqlparser/parse_test.go index af585130684..d48b75dd745 100644 --- a/go/vt/sqlparser/parse_test.go +++ b/go/vt/sqlparser/parse_test.go @@ -1251,8 +1251,7 @@ var ( }, { input: "alter table `By` add column foo int, algorithm = inplace", }, { - input: "alter table `By` add column foo int, algorithm = INPLACE", - output: "alter table `By` add column foo int, algorithm = inplace", + input: "alter table `By` add column foo int, algorithm = INPLACE", }, { input: "alter table `By` add column foo int, algorithm = instant", }, { diff --git a/go/vt/sqlparser/sql.go b/go/vt/sqlparser/sql.go index 507a204a3a4..c9bb09ec11b 100644 --- a/go/vt/sqlparser/sql.go +++ b/go/vt/sqlparser/sql.go @@ -12719,7 +12719,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3100 { - yyLOCAL = AlgorithmValue(DefaultStr) + yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) } yyVAL.union = yyLOCAL case 562: @@ -12727,7 +12727,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3104 { - yyLOCAL = AlgorithmValue(InplaceStr) + yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) } yyVAL.union = yyLOCAL case 563: @@ -12735,7 +12735,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3108 { - yyLOCAL = AlgorithmValue(CopyStr) + yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) } yyVAL.union = yyLOCAL case 564: @@ -12743,7 +12743,7 @@ yydefault: var yyLOCAL AlterOption //line sql.y:3112 { - yyLOCAL = AlgorithmValue(InstantStr) + yyLOCAL = AlgorithmValue(string(yyDollar[3].str)) } yyVAL.union = yyLOCAL case 565: diff --git a/go/vt/sqlparser/sql.y b/go/vt/sqlparser/sql.y index db956400cb6..57b0aebf856 100644 --- a/go/vt/sqlparser/sql.y +++ b/go/vt/sqlparser/sql.y @@ -3098,19 +3098,19 @@ alter_commands_modifier_list: alter_commands_modifier: ALGORITHM equal_opt DEFAULT { - $$ = AlgorithmValue(DefaultStr) + $$ = AlgorithmValue(string($3)) } | ALGORITHM equal_opt INPLACE { - $$ = AlgorithmValue(InplaceStr) + $$ = AlgorithmValue(string($3)) } | ALGORITHM equal_opt COPY { - $$ = AlgorithmValue(CopyStr) + $$ = AlgorithmValue(string($3)) } | ALGORITHM equal_opt INSTANT { - $$ = AlgorithmValue(InstantStr) + $$ = AlgorithmValue(string($3)) } | LOCK equal_opt DEFAULT {