1.0.622.verify.sql 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. SELECT COUNT(*) = 4 AS api_pull_tables_ready
  2. FROM information_schema.tables
  3. WHERE table_schema = DATABASE() AND engine = 'InnoDB'
  4. AND table_name IN ('mdp_connector_api_pull_profile', 'mdp_connector_api_pull_run',
  5. 'mdp_connector_api_pull_page', 'mdp_connector_api_pull_rate');
  6. SELECT COUNT(*) = 5 AS api_pull_unique_indexes_ready
  7. FROM (
  8. SELECT table_name, index_name, GROUP_CONCAT(column_name ORDER BY seq_in_index) AS key_columns
  9. FROM information_schema.statistics
  10. WHERE table_schema = DATABASE() AND non_unique = 0
  11. AND table_name IN ('mdp_connector_api_pull_profile', 'mdp_connector_api_pull_run',
  12. 'mdp_connector_api_pull_page', 'mdp_connector_api_pull_rate')
  13. GROUP BY table_name, index_name
  14. ) AS keys_found
  15. WHERE (table_name = 'mdp_connector_api_pull_profile' AND index_name = 'uk_api_pull_active'
  16. AND key_columns = 'tenant_id,factory_id,dataset_id,source_id,active_slot')
  17. OR (table_name = 'mdp_connector_api_pull_run' AND index_name = 'uk_api_pull_run_active'
  18. AND key_columns = 'tenant_id,factory_id,dataset_id,source_id,active_slot')
  19. OR (table_name = 'mdp_connector_api_pull_page' AND index_name = 'PRIMARY'
  20. AND key_columns = 'run_id,ordinal')
  21. OR (table_name = 'mdp_connector_api_pull_page' AND index_name = 'uk_api_pull_position'
  22. AND key_columns = 'run_id,position_sha256')
  23. OR (table_name = 'mdp_connector_api_pull_rate' AND index_name = 'PRIMARY'
  24. AND key_columns = 'tenant_id,source_id');
  25. SELECT COUNT(*) = 6 AS api_pull_replay_columns_ready
  26. FROM information_schema.columns
  27. WHERE table_schema = DATABASE()
  28. AND ((table_name = 'mdp_connector_api_pull_page'
  29. AND ((column_name = 'response_body' AND data_type = 'mediumblob' AND is_nullable = 'YES')
  30. OR (column_name = 'response_sha256' AND character_maximum_length = 64 AND collation_name = 'ascii_bin')
  31. OR (column_name = 'raw_batch_id' AND character_maximum_length = 36 AND is_nullable = 'YES')))
  32. OR (table_name = 'mdp_connector_api_pull_run'
  33. AND ((column_name = 'position_json' AND data_type = 'json' AND is_nullable = 'NO')
  34. OR (column_name = 'confirmed_until' AND data_type = 'datetime' AND datetime_precision = 6)
  35. OR (column_name = 'retry_at' AND data_type = 'datetime' AND datetime_precision = 6))));
  36. SELECT IF(COUNT(*)=2,1,0) AS capture_and_recovery_innodb
  37. FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND ENGINE='InnoDB'
  38. AND TABLE_NAME IN ('mdp_connector_api_pull_capture','mdp_connector_api_pull_recovery');
  39. SELECT IF(COUNT(*)=4,1,0) AS capture_order_and_unique_raw
  40. FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_connector_api_pull_capture'
  41. AND NON_UNIQUE=0 AND ((INDEX_NAME='PRIMARY' AND ((SEQ_IN_INDEX=1 AND COLUMN_NAME='run_id')
  42. OR (SEQ_IN_INDEX=2 AND COLUMN_NAME='ordinal') OR (SEQ_IN_INDEX=3 AND COLUMN_NAME='attempt')))
  43. OR (INDEX_NAME='uk_api_pull_capture_batch' AND SEQ_IN_INDEX=1 AND COLUMN_NAME='batch_id'));
  44. SELECT IF(COUNT(*)=3,1,0) AS recovery_history_order
  45. FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_connector_api_pull_recovery'
  46. AND INDEX_NAME='ix_api_pull_recovery_page'
  47. AND ((SEQ_IN_INDEX=1 AND COLUMN_NAME='run_id') OR (SEQ_IN_INDEX=2 AND COLUMN_NAME='ordinal')
  48. OR (SEQ_IN_INDEX=3 AND COLUMN_NAME='id'));
  49. SELECT IF(COUNT(*)=3,1,0) AS raw_reference_collation
  50. FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLLATION_NAME='ascii_bin'
  51. AND ((TABLE_NAME IN ('mdp_connector_api_pull_capture','mdp_ingest_raw_batch') AND COLUMN_NAME='batch_id')
  52. OR (TABLE_NAME='mdp_connector_api_pull_recovery' AND COLUMN_NAME='prior_batch_id'));