github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/lightning_duplicate_detection/run.sh (about)

     1  #!/bin/sh
     2  #
     3  # Copyright 2021 PingCAP, Inc.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  # skip unstable test for temporary
    17  exit 0
    18  
    19  set -eux
    20  
    21  check_cluster_version 4 0 0 'local backend' || exit 0
    22  
    23  LOG_FILE1="$TEST_DIR/lightning-duplicate-detection1.log"
    24  LOG_FILE2="$TEST_DIR/lightning-duplicate-detection2.log"
    25  
    26  run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_detection.sorted1" \
    27    --enable-checkpoint=1 --log-file "$LOG_FILE1" --config "tests/$TEST_NAME/config1.toml" && exit 1 &
    28  run_lightning --backend local --sorted-kv-dir "$TEST_DIR/lightning_duplicate_detection.sorted2" \
    29    --enable-checkpoint=1 --log-file "$LOG_FILE2" --config "tests/$TEST_NAME/config2.toml" && exit 1 &
    30  
    31  wait
    32  ## a. Primary key conflict in table `ta`. There are 10 pairs of conflicts in each file and 5 pairs of conflicts in both files.
    33  #grep -q "restore table \`dup_detect\`.\`ta\` failed: .*duplicate detected" "$LOG_FILE"
    34  #
    35  ## b. Unique key conflict in table `tb`. There are 10 pairs of conflicts in each file and 5 pairs of conflicts in both files.
    36  #grep -q "restore table \`dup_detect\`.\`tb\` failed: .*duplicate detected" "$LOG_FILE"
    37  #
    38  ## c. Primary key conflict in table `tc`. There are 10 rows with the same key in each file and 10 rows with the same key in both files.
    39  #grep -q "restore table \`dup_detect\`.\`tc\` failed: .*duplicate detected" "$LOG_FILE"
    40  #
    41  ## d. Unique key conflict in table `td`. There are 10 rows with the same key in each file and 10 rows with the same key in both files.
    42  #grep -q "restore table \`dup_detect\`.\`td\` failed: .*duplicate detected" "$LOG_FILE"
    43  #
    44  ## e. Identical rows in table `te`. There are 10 identical rows in each file and 10 identical rows in both files.
    45  #grep -q "restore table \`dup_detect\`.\`te\` failed: .*duplicate detected" "$LOG_FILE"
    46  #
    47  ## f. No conflicts in table `tf`.
    48  #grep -Eq "restore table completed.*table=\`dup_detect\`.\`tf\`" "$LOG_FILE"