MSCK REPAIR TABLE command adds partitions only after recreating the table.
MSCK Repair table does not add the partitions to the table but it lists the partitions not in the metastore. However, when I recreate the table and run the MSCK Repair table command, it works. But the next day I run the MSCK Repair table command to add the new partitions to the metastore it does not add the partitions. But if I recreate the table again and run the MSCK repair table command, then the partitions are added.
This issue suddenly started and I'm not sure what to make of it. Anyone with any idea on what might be going on is greatly appreciated.
Below is the message I receive when the repair table fails.
Partitions not in metastore:
prod_partner_visits:year=2021/month=06/day=09/hour=00
Partitions missing from filesystem:
prod_partner_visits:year=2021/month=06/day=09/hour=00
But I have that partition in the s3 bucket and it will add the partition when I recreate the athena table.
Below is the DDL of the table
CREATE EXTERNAL TABLE `prod_partner_visits`(
`visitortoken` string COMMENT 'from deserializer',
`timestamp` string COMMENT 'from deserializer',
`timeuuid` string COMMENT 'from deserializer',
`event` string COMMENT 'from deserializer',
`message` string COMMENT 'from deserializer'
)
PARTITIONED BY (
`year` int,
`month` int,
`day` int,
`hour` int
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
LOCATION 's3://partner-traffic-channel-prod/topics/prod-cp-channel-visit'
TBLPROPERTIES (
'has_encrypted_data'='false',
'transient_lastDdlTime'='1623329273'
)
generate create table ddl)? - Nicolas Busca