airborne12 commented on issue #71271:
URL: https://github.com/apache/doris/issues/71271#issuecomment-7369138318

   Reproduced on master. The cause is as described above, with one correction: 
a full clone into an existing tablet and a disk migration on one BE also go 
through `convert_rowset_ids` and are affected. Only a clone into a new tablet 
is not.
   
   Fix: #71334. Clone and migration keep the index ids unchanged. Restore is 
unchanged.
   
   Why not #70585:
   1. It decides that an operation is a clone when the snapshot's tablet_id 
equals the local tablet_id. A restore into an existing partition of the same 
table also has equal tablet ids, so that restore also stops remapping.
   2. It changes restore to match indexes by full definition. The same index 
can have different properties in the backup and in the target: in the #57074 
log, `idx_ngrambf` has `lower_case` only in the backup. Then no index matches, 
the source id is kept, and cloud restore fails the meta-service schema check 
again, which is the bug that #57074 fixed.
   
   The restore remapping is tracked in #70583.
   
   Affected: 4.0.2+ and 4.1.x, which have the index id rewrite added by #57074 
(#58660 on 4.0). 3.1 does not rewrite index ids on clone.
   
   Repair. Upgrading the BE does not repair replicas that are already broken.
   
   1. Find the broken replicas. The script needs `curl`, `jq` and access to the 
BE HTTP port. Each line it prints is one broken replica.
   
   ```bash
   # MYSQL="mysql -h<fe_host> -P<query_port> -u<user> -p<password>" ./check.sh 
<db>.<table>
   $MYSQL --batch -e "SHOW TABLETS FROM $1" |
     awk -F'\t' 'NR == 1 {for (i = 1; i <= NF; i++) col[$i] = i; next}
                 {print $col["TabletId"], $col["BackendId"], $col["MetaUrl"]}' |
     while read -r tablet be url; do
       if ! json=$(curl -sf "$url"); then
         echo "tablet_id=$tablet backend_id=$be CHECK_FAILED"
         continue
       fi
       bad=$(echo "$json" | jq -r '.rs_metas[]?
             | select([(.tablet_schema.index // [])[] | 
"\(.index_id)/\(.index_suffix_name // "")"]
                      | length != (unique | length))
             | "\(.start_version)-\(.end_version)"' | paste -sd, -)
       if [ -n "$bad" ]; then echo "tablet_id=$tablet backend_id=$be 
bad_rowsets=$bad"; fi
     done
   ```
   
   2. Drop each replica that the script lists:
   
   ```sql
   ADMIN SET REPLICA STATUS PROPERTIES ("tablet_id" = "<tablet_id>", 
"backend_id" = "<backend_id>", "status" = "drop");
   ```
   
   FE makes a new replica from a healthy replica. The new replica is a clone 
into a new tablet, so it keeps the index ids. If the script lists every replica 
of a tablet, do not drop any of them.
   
   3. Run step 1 again. It must print nothing. `SHOW TABLETS` must show the 
same version on all replicas, with `LstFailedVersion` = -1.
   
   Do not use `"status" = "bad"`. The next tablet report from the BE resets it.
   
   Tested on a master build with the same table layout (MoW, sequence column, 
V3, 3 BEs, 3 replicas). The replicas were rebuilt in about 2 s. After that, 
queries with both analyzers and cumulative compaction worked on every replica.
   
   Until the fix is deployed, any incremental clone can break a replica again. 
Run the check again after each BE restart.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to