github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/pkg/shardddl/optimism/doc.go (about)

     1  // Copyright 2020 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package optimism
    15  
    16  // this pkg is used to support shard DDL in optimistic mode.
    17  // for the basic mechanism to support shard DDL,
    18  // please see pkg/shardddl/pessimism/doc.go.
    19  //
    20  // some highlight differences with pessimistic mode:
    21  // - only one level of shard group exists, it includes all upstream tables from all replica sources.
    22  //   and these tables are all handled in DM-master uniformly (no shard group handled in DM-worker).
    23  // - no sequence order of DDLs from different tables required,
    24  //   but schema versions after applied these DDLs from tables must be compatible now.
    25  // - one shard DDL lock often constructed from multiple DDLs or schema versions,
    26  //   so one table _done_ a lock operation doesn't mean the table has done that part of the lock,
    27  //   and we call the lock _done_ operations until all tables reach the same schema & _done_ the last operation.
    28  //
    29  // some functions are not supported now, but need to be supported later.
    30  // - handle some types of conflicts automatically.
    31  // - revert tracked schema if fail to handle the shard DDL.
    32  // - all shard tables always get the initial downstream schema (not the updated one by DDL from another table).