Tabletserver YAML parameters

This issue is an expansion of #5791, and covers the details of how we’ll use yaml to implement a hierarchy of parameters for initializing and customizing TabletServer components within a process.

Using the yaml approach, we intend to solve the following problems:

  • Multiple tablet servers need to exist within a process.
  • Badly named command line parameters: The new yaml specifications will have simpler and easier to remember parameter names.
  • Sections for improved readability.
  • Unreasonable default values: The new specs will introduce a simplified approach that will save the user from tweaking too many variables without knowing their consequences.
  • Repetition: If multiple TabletServers have to share the same parameter values, they should not be repeated.
  • Backward compatibility: The system must be backward compatible.

We will introduce two new command-line options that will be specified like this:

We’ll provide predefined “defaults” files that people can use as starting points. We’ll start with something simple like small.yaml, medium.yaml, and large.yaml.

We explored the use of protobufs for converting to and from yaml. However, the protobuf JSON implementation, which was required to correctly parse enums, was unable to preserve the original values for sub-objects. This was a showstopper for making defaults work.

The existing data structure will be converted into a struct with the new names and appropriate JSON tags.

The following section lists all the properties that can be specified in a yaml file along with the existing defaults.

During implementation, we’ll need to decide between creating a universal protobuf that represents this structure vs converting the original one into something more usable.

Note that certain properties (like tabletID) are only applicable to tablet-specific files.

  1. tabletID: zone-1234
  2. init:
  3. dbName: # init_db_name_override
  4. keyspace: # init_keyspace
  5. shard: # init_shard
  6. tabletType: # init_tablet_type
  7. timeoutSeconds: 60 # init_timeout
  8. db:
  9. socket: # db_socket
  10. host: # db_host
  11. port: 0 # db_port
  12. charSet: # db_charset
  13. flags: 0 # db_flags
  14. flavor: # db_flavor
  15. sslCa: # db_ssl_ca
  16. sslCaPath: # db_ssl_ca_path
  17. sslCert: # db_ssl_cert
  18. sslKey: # db_ssl_key
  19. serverName: # db_server_name
  20. connectTimeoutMilliseconds: 0 # db_connect_timeout_ms
  21. app:
  22. user: vt_app # db_app_user
  23. password: # db_app_password
  24. useSsl: true # db_app_use_ssl
  25. preferSocket: true
  26. dba:
  27. user: vt_dba # db_dba_user
  28. password: # db_dba_password
  29. useSsl: true # db_dba_use_ssl
  30. preferSocket: true
  31. filtered:
  32. password: # db_filtered_password
  33. useSsl: true # db_filtered_use_ssl
  34. preferSocket: true
  35. user: vt_repl # db_repl_user
  36. password: # db_repl_password
  37. useSsl: true # db_repl_use_ssl
  38. preferSocket: true
  39. appdebug:
  40. user: vt_appdebug # db_appdebug_user
  41. password: # db_appdebug_password
  42. useSsl: true # db_appdebug_use_ssl
  43. preferSocket: true
  44. allprivs:
  45. user: vt_allprivs # db_allprivs_user
  46. password: # db_allprivs_password
  47. useSsl: true # db_allprivs_use_ssl
  48. preferSocket: true
  49. oltpReadPool:
  50. size: 16 # queryserver-config-pool-size
  51. timeoutSeconds: 0 # queryserver-config-query-pool-timeout
  52. idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
  53. prefillParallelism: 0 # queryserver-config-pool-prefill-parallelism
  54. maxWaiters: 50000 # queryserver-config-query-pool-waiter-cap
  55. olapReadPool:
  56. size: 200 # queryserver-config-stream-pool-size
  57. timeoutSeconds: 0 # queryserver-config-query-pool-timeout
  58. idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
  59. prefillParallelism: 0 # queryserver-config-stream-pool-prefill-parallelism
  60. maxWaiters: 0
  61. txPool:
  62. size: 20 # queryserver-config-transaction-cap
  63. timeoutSeconds: 1 # queryserver-config-txpool-timeout
  64. idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
  65. prefillParallelism: 0 # queryserver-config-transaction-prefill-parallelism
  66. maxWaiters: 50000 # queryserver-config-txpool-waiter-cap
  67. oltp:
  68. txTimeoutSeconds: 30 # queryserver-config-transaction-timeout
  69. warnRows: 0 # queryserver-config-warn-result-size
  70. hotRowProtection:
  71. mode: disable|dryRun|enable # enable_hot_row_protection, enable_hot_row_protection_dry_run
  72. # Default value is same as txPool.size.
  73. maxQueueSize: 20 # hot_row_protection_max_queue_size
  74. maxGlobalQueueSize: 1000 # hot_row_protection_max_global_queue_size
  75. maxConcurrency: 5 # hot_row_protection_concurrent_transactions
  76. consolidator: enable|disable|notOnMaster # enable-consolidator, enable-consolidator-replicas
  77. heartbeatIntervalMilliseconds: 0 # heartbeat_enable, heartbeat_interval
  78. shutdownGracePeriodSeconds: 0 # transaction_shutdown_grace_period
  79. passthroughDML: false # queryserver-config-passthrough-dmls
  80. streamBufferSize: 32768 # queryserver-config-stream-buffer-size
  81. queryCacheSize: 5000 # queryserver-config-query-cache-size
  82. schemaReloadIntervalSeconds: 1800 # queryserver-config-schema-reload-time
  83. watchReplication: false # watch_replication_stream
  84. terseErrors: false # queryserver-config-terse-errors
  85. messagePostponeParallelism: 4 # queryserver-config-message-postpone-cap
  86. cacheResultFields: true # enable-query-plan-field-caching
  87. # The following flags are currently not supported.
  88. # enforce_strict_trans_tables
  89. # queryserver-config-strict-table-acl
  90. # queryserver-config-enable-table-acl-dry-run
  91. # queryserver-config-acl-exempt-acl
  92. # enable-tx-throttler
  93. # tx-throttler-config
  94. # tx-throttler-healthcheck-cells
  95. # enable_transaction_limit
  96. # enable_transaction_limit_dry_run
  97. # transaction_limit_per_user
  98. # transaction_limit_by_username
  99. # transaction_limit_by_principal
  100. # transaction_limit_by_subcomponent

There are also other global parameters. VTTablet has a total of 405 flags. We may have to later move some of them into these yamls.

We’ll use the unified tabletenv.TabletConfig data structure to load defaults as well as tablet-specific values. The following changes will be made:

  • TabletConfig will be changed to match the above specifications.
  • The existing flags will be changed to update the values in a global TabletConfig.
  • In case of type mismatch (like time.Duration vs a “Seconds” variable), an extra step will be performed after parsing to convert the flag variables into TabletConfig members.
  • The code will be changed to honor the new TabletConfig members.
  • After the flag.Parse step, a copy of the global Config will be used as input to load the defaults file. This means that any command line flags that are not overridden in the yaml files will be preserved. This behavior is needed to support backward compatibility in case we decide to move more flags into the yaml.
  • For each tablet entry, we create a copy of the result TabletConfig and read the tablet yaml into those, which will set the tablet-specific values. This will then be used to instantiate a TabletServer.

The exact format of the tablets.yaml file is not fully finalized. Our options are to allow a list of files where each is for a single tablet, or, to require only one file containing a dictionary of tablet-specific overrides.


<< VTTablet with RBR mode