LookupVindex create

vtctldclient LookupVindex create #

Create the Lookup Vindex in the specified keyspace and backfill it with a VReplication workflow.

vtctldclient LookupVindex create

For creating and backfilling multiple Lookup Vindexes params-file can be used. params-file should be a JSON file with this format:

{
      <vindex_name>: {
            "lookup_vindex_type": <lookup_vindex_type>,
            "table_owner": <table_owner>,
            "table_owner_columns": [
                  <table_owner_column_1>,
                  <table_owner_column_2>
            ],
            "lookup_vindex_type": <lookup_vindex_type>,
            "table_name": <table_name> (optional),
            "table_vindex_type": <table_vindex_type> (optional),
            "ignore_nulls": <true|false> (optional)
      },
      ...
}

Examples #

vtctldclient --server localhost:15999 LookupVindex --name corder_lookup_vdx --table-keyspace customer create --keyspace customer --type consistent_lookup_unique --table-owner corder --table-owner-columns sku --table-name corder_lookup_tbl --table-vindex-type unicode_loose_xxhash

For creating and backfilling multiple Lookup Vindexes:

vtctldclient --server localhost:15999 LookupVindex --name "lookup_workflow1" --table-keyspace customer create --keyspace="customer" --params-file="vindex_params.json"

Here's an example for params-file:

{
    "corder_lookup": {
        "lookup_vindex_type": "consistent_lookup_unique",
        "table_owner": "corder",
        "table_owner_columns": [
            "sku"
        ],
    },
    "customer_lookup": {
        "lookup_vindex_type": "consistent_lookup_unique",
        "table_owner": "customer",
        "table_owner_columns": [
            "email"
        ]
    }
}

Options #

      --cells strings                      Cells to look in for source tablets to replicate from.
      --continue-after-copy-with-owner     Vindex will continue materialization after the backfill completes when an owner is provided. (default true)
  -h, --help                               help for create
      --ignore-nulls                       Do not add corresponding records in the lookup table if any of the owner table's 'from' fields are NULL.
      --keyspace string                    The keyspace to create the Lookup Vindex in. This is also where the table-owner must exist.
      --params-file string                 JSON file containing lookup vindex parameters. Use this for creating multiple lookup vindexes.
      --table-name string                  The name of the lookup table. If not specified, then it will be created using the same name as the Lookup Vindex.
      --table-owner string                 The table holding the data which we should use to backfill the Lookup Vindex. This must exist in the same keyspace as the Lookup Vindex.
      --table-owner-columns strings        The columns to read from the owner table. These will be used to build the hash which gets stored as the keyspace_id value in the lookup table.
      --table-vindex-type string           The primary vindex name/type to use for the lookup table, if the table-keyspace is sharded. If no value is provided then the default type will be used based on the table-owner-columns types.
      --tablet-types strings               Source tablet types to replicate from.
      --tablet-types-in-preference-order   When performing source tablet selection, look for candidates in the type order as they are listed in the tablet-types flag. (default true)
      --type string                        The type of Lookup Vindex to create.

Options inherited from parent commands #

      --action_timeout duration              timeout to use for the command (default 1h0m0s)
      --compact                              use compact format for otherwise verbose outputs
      --name string                          The name of the Lookup Vindex to create. This will also be the name of the VReplication workflow created to backfill the Lookup Vindex.
      --server string                        server to use for the connection (required)
      --table-keyspace string                The keyspace to create the lookup table in. This is also where the VReplication workflow is created to backfill the Lookup Vindex.
      --topo-global-root string              the path of the global topology data in the global topology server (default "/vitess/global")
      --topo-global-server-address strings   the address of the global topology server(s) (default [localhost:2379])
      --topo-implementation string           the topology implementation to use (default "etcd2")

SEE ALSO #

  • vtctldclient LookupVindex - Perform commands related to creating, backfilling, and externalizing Lookup Vindexes using VReplication workflows.