Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-15404

Rework distributed configuration flow

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha3
    • None

    Description

      Based on prototyping carried out within IGNITE-15374 it's requited to rework distributed configuration flow processing:

      1. Use configuration registry instead of meta storage manager.
        1. Use configuration manager for internal configuration processing. Blocked by IGNITE-15047
        2. Use configuration manager in order to retrieve distributed up-to-date values.
        3. Use configuration listeners instead of meta storage watches.
      2. Favor one-step table creation (calculate assignments and inner schema together with initial table configuration update).

      Please pay attention that during prototyping plenty of bugs were found that should be fixed during refactoring. To name some:

      1. Columns validation is skipped if column was added or removed during alterTable() See onConfigurationChanged() for more details.
        if (!newTbl.columns().namedListKeys().equals(oldTbl.columns().namedListKeys()))
            return true;
        
      1. table identified ignores update counter
        UUID tblId = new UUID(ctx.storageRevision(), 0L);
        

      Of course in addition to fixing known issues we will introduce new bugs during refactoring.

      Following items were implemented:

      1. Unnecessary phases of assignment calculation and schema preparation as a reaction on distributed event were simplified to in-place calculation within table creation:

       

      clusterCfgMgr
          .configurationRegistry()
          .getConfiguration(TablesConfiguration.KEY)
          .tables()
          .change(
              change -> change.create(
                  name,
                  (ch) -> {
                      tableInitChange.accept(ch);
                      ((ExtendedTableChange)ch).
                          // Table id specification.
                          changeId(tblId.toString()).
                          // Affinity assignments calculation.
                          changeAssignments(
                              ByteUtils.toBytes(
                                  AffinityService.calculateAssignments(
                                      baselineMgr.nodes(),
                                      ch.partitions(),
                                      ch.replicas()
                                  )
                              )
                          ).
                          // Table schema preparation.
                          changeSchemas(
                              schemasCh -> schemasCh.create(
                                  String.valueOf(INITIAL_SCHEMA_VERSION),
                                  schemaCh -> schemaCh.changeSchema(
                                      ByteUtils.toBytes(
                                          SchemaService.prepareSchemaDescriptor(
                                              ((ExtendedTableView)ch).schemas().size(),
                                              ch
                                          )
                                      )
                                  )
                              )
                          );
                  }
              )
          )
      

       

      Besides obvious that allowed to simplify AffinityManager and SchemaManager that were converted to simple stateless services.

      2. Same is about table id: instead of using meta storage revision and update counter (this wasn't implemented though) explicit table id generation was used. This is the main reason for the large number of changed files.

      3. Inner local events were substituted by common Futures within create/alter/dropTable.

      Few more tickets were created for further improvements:

      IGNITE-15414 Schema validation refactoring with configuration validators.

      IGNITE-15480 Refactor index column mapping based on column id automatically generated on column creation with the help of internal configuration extensions.

      IGNITE-15485 Support table rename operation.

      Some tickets for further refactoring are still awaited:

      IGNITE-15409 Listener with any placeholders

      IGNITE-15412 Configuration registry: add ability to retrieve distributed value That will allow to remove metastorage from table manager completely and get rid of current verison of TableManager#tableNamesConfigured

       

      Attachments

        Issue Links

          Activity

            People

              alapin Alexander Lapin
              alapin Alexander Lapin
              Vladislav Pyatkov Vladislav Pyatkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 9h 10m
                  9h 10m