[Index Backfill] Failing to update index permissions causes index to stuck #4930
Closed
Description
i've added this snippet:
--- src/yb/master/backfill_index.cc (revision be6b1d633b3cbebed15f4b69bb913cfbac48904f)
+++ src/yb/master/backfill_index.cc (date 1593555973572)
@@ -204,6 +204,9 @@
TRACE("Locking indexed table");
auto l = indexed_table->LockForWrite();
auto &indexed_table_data = *l->mutable_data();
+ if (rand() % 100 > 50) {
+ indexed_table_data.pb.set_version(indexed_table_data.pb.version() + 1);
+ }
if (current_version && *current_version != indexed_table_data.pb.version()) {
LOG(INFO) << "The table schema version "
<< "seems to have already been updated to " << indexed_table_data.pb.version()
in UpdateIndexPermission
to simulate probability of table schema version mismatch. If this happens, index backfill process is interrupted and never resumed.
YCQL command eventually times out:
ycqlsh> CREATE INDEX indexed_i ON k.indexed(v);
ServerError: Server Error. Timed out waiting for Table Creation
CREATE INDEX indexed_i ON k.indexed(v);
^^^^^^^^
(ql error -2)
yb-master also sees the indexed table as ALTERING:
This affects both YCQL and YSQL