1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
| # 逐层介绍文件中都由什么构成 # deltacommit cat .hoodie/20210507163615.deltacommit { "partitionToWriteStats" : { -- 分区明细 "par1" : [ { -- 注意,这里是Json数组,我这一个分区只有一个文件所以只有一个对象 "fileId" : "de05d871-e8b5-4049-beb5-bed87e50586a", -- 每一个分区中文件分片的唯一标识 "path" : "par1/.de05d871-e8b5-4049-beb5-bed87e50586a_20210507163615.log.1_0-1-0", -- 写入的日志文件路径 "prevCommit" : "20210507163615", -- 上一次提交成功的标识,首次,所以指定自己 "numWrites" : 2, -- 写入记录数 "numDeletes" : 0, -- 删除记录数 "numUpdateWrites" : 0, -- 更新记录数 "numInserts" : 2, -- 插入记录数 "totalWriteBytes" : 1074, -- 总写入大小 "totalWriteErrors" : 0, -- 总写入错误数 "tempPath" : null, -- 临时路径 "partitionPath" : "par1", -- 分区路径 "totalLogRecords" : 0, -- 总日志记录数 "totalLogFilesCompacted" : 0, -- 总压缩日志文件数 "totalLogSizeCompacted" : 0, -- 总压缩日志大小 "totalUpdatedRecordsCompacted" : 0, -- 总压缩更新记录数 "totalLogBlocks" : 0, -- 总日志块数量 "totalCorruptLogBlock" : 0, -- 总损坏日志块数量 "totalRollbackBlocks" : 0, -- 总回滚块数量 "fileSizeInBytes" : 1074, -- 文件大小 "minEventTime" : null, -- 最小事件时间 "maxEventTime" : null, -- 最大事件时间 "logVersion" : 1, -- 日志版本 "logOffset" : 0, -- 日志偏移量 "baseFile" : "", -- 基本文件,每次读取baseFile和logFiles合并,就是实时数据 "logFiles" : [ ".de05d871-e8b5-4049-beb5-bed87e50586a_20210507163615.log.1_0-1-0" ] } ], "par2" : ..., "par3" : ..., "par4" : ... }, "compacted" : false, -- 是否压缩合并 "extraMetadata" : { -- 元数据信息 "schema" : "{\"type\":\"record\",\"name\":\"record\",\"fields\":[{\"name\":\"uuid\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"age\",\"type\":[\"null\",\"int\"],\"default\":null},{\"name\":\"ts\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null},{\"name\":\"partition\",\"type\":[\"null\",\"string\"],\"default\":null}]}" }, "operationType" : null, -- 操作类型 "totalCreateTime" : 0, "totalScanTime" : 0, "totalCompactedRecordsUpdated" : 0, "totalLogFilesCompacted" : 0, "totalLogFilesSize" : 0, "minAndMaxEventTime" : { "Optional.empty" : { "val" : null, "present" : false } }, "fileIdAndRelativePaths" : { -- fileId和对应的相对路径 "1208697c-3b27-4a48-9389-f345c137c763" : "par4/.1208697c-3b27-4a48-9389-f345c137c763_20210507163615.log.1_0-1-0", "de05d871-e8b5-4049-beb5-bed87e50586a" : "par1/.de05d871-e8b5-4049-beb5-bed87e50586a_20210507163615.log.1_0-1-0", "918a682e-caff-462a-93c0-8b18a178e809" : "par2/.918a682e-caff-462a-93c0-8b18a178e809_20210507163615.log.1_0-1-0", "cfd22631-84c7-4a79-8f90-6fc13a0bbb6d" : "par3/.cfd22631-84c7-4a79-8f90-6fc13a0bbb6d_20210507163615.log.1_0-1-0" }, "totalRecordsDeleted" : 0, "totalLogRecordsCompacted" : 0, "writePartitionPaths" : [ "par1", "par2", "par3", "par4" ], -- 写入的分区路径 "totalUpsertTime" : 3331 }
# compaction avro-tools tojson .hoodie/20210510175131.compaction.requested { "operations":{ "array":[ { "baseInstantTime":{ "string":"20210510174713" -- 基于什么操作 }, "deltaFilePaths":{ "array":[ ".39798d42-eb9f-46c7-aece-bdbe9fed3c45_20210510174713.log.1_0-1-0" -- log_file路径 ] }, "dataFilePath":null, base_file路径,第一次所以没有 "fileId":{ "string":"39798d42-eb9f-46c7-aece-bdbe9fed3c45" -- 文件id }, "partitionPath":{ "string":"par1" -- 分区 }, "metrics":{ -- 指标 "map":{ "TOTAL_LOG_FILES":"1.0", "TOTAL_IO_READ_MB":"0.0", "TOTAL_LOG_FILES_SIZE":"392692.0", "TOTAL_IO_WRITE_MB":"120.0", "TOTAL_IO_MB":"120.0" } }, "bootstrapFilePath":null -- 引导文件 }, ..., ... ] }, "extraMetadata":null, -- 元数据 "version":{ "int":2 -- 版本 } }
# commit cat .hoodie/20210510175131.commit { "partitionToWriteStats" : { "par1" : [ { "fileId" : "39798d42-eb9f-46c7-aece-bdbe9fed3c45", "path" : "par1/39798d42-eb9f-46c7-aece-bdbe9fed3c45_0-1-0_20210510175131.parquet", -- 合并压缩后的路径 "prevCommit" : "null", -- 之前的commit "numWrites" : 940, "numDeletes" : 0, "numUpdateWrites" : 0, "numInserts" : 940, "totalWriteBytes" : 612245, "totalWriteErrors" : 0, "tempPath" : null, "partitionPath" : "par1", "totalLogRecords" : 940, "totalLogFilesCompacted" : 1, "totalLogSizeCompacted" : 392692, "totalUpdatedRecordsCompacted" : 940, "totalLogBlocks" : 4, "totalCorruptLogBlock" : 0, "totalRollbackBlocks" : 0, "fileSizeInBytes" : 612245, "minEventTime" : null, "maxEventTime" : null }, { "fileId" : "75dff8c0-614a-43e9-83c7-452dfa1dc797", "path" : "par1/75dff8c0-614a-43e9-83c7-452dfa1dc797_0-1-0_20210510175131.parquet", "prevCommit" : "null", "numWrites" : 300, "numDeletes" : 0, "numUpdateWrites" : 0, "numInserts" : 300, "totalWriteBytes" : 493134, "totalWriteErrors" : 0, "tempPath" : null, "partitionPath" : "par1", "totalLogRecords" : 300, "totalLogFilesCompacted" : 1, "totalLogSizeCompacted" : 124976, "totalUpdatedRecordsCompacted" : 300, "totalLogBlocks" : 1, "totalCorruptLogBlock" : 0, "totalRollbackBlocks" : 0, "fileSizeInBytes" : 493134, "minEventTime" : null, "maxEventTime" : null }, { "fileId" : "0a0110a8-b26b-4595-b5fb-b2388263ac54", "path" : "par1/0a0110a8-b26b-4595-b5fb-b2388263ac54_0-1-0_20210510175131.parquet", "prevCommit" : "null", "numWrites" : 5, "numDeletes" : 0, "numUpdateWrites" : 0, "numInserts" : 5, "totalWriteBytes" : 437253, "totalWriteErrors" : 0, "tempPath" : null, "partitionPath" : "par1", "totalLogRecords" : 5, "totalLogFilesCompacted" : 1, "totalLogSizeCompacted" : 2918, "totalUpdatedRecordsCompacted" : 5, "totalLogBlocks" : 1, "totalCorruptLogBlock" : 0, "totalRollbackBlocks" : 0, "fileSizeInBytes" : 437253, "minEventTime" : null, "maxEventTime" : null } ] }, "compacted" : true, -- 是否合并压缩 "extraMetadata" : { "schema" : "{\"type\":\"record\",\"name\":\"record\",\"fields\":[{\"name\":\"uuid\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"age\",\"type\":[\"null\",\"int\"],\"default\":null},{\"name\":\"ts\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null},{\"name\":\"partition\",\"type\":[\"null\",\"string\"],\"default\":null}]}" }, "operationType" : "UNKNOWN", "totalUpsertTime" : 0, "totalCreateTime" : 0, "totalScanTime" : 225, "totalCompactedRecordsUpdated" : 1245, "totalLogFilesCompacted" : 3, "totalLogFilesSize" : 520586, "minAndMaxEventTime" : { "Optional.empty" : { "val" : null, "present" : false } }, "fileIdAndRelativePaths" : { -- 压缩后的文件路径 "39798d42-eb9f-46c7-aece-bdbe9fed3c45" : "par1/39798d42-eb9f-46c7-aece-bdbe9fed3c45_0-1-0_20210510175131.parquet", "75dff8c0-614a-43e9-83c7-452dfa1dc797" : "par1/75dff8c0-614a-43e9-83c7-452dfa1dc797_0-1-0_20210510175131.parquet", "0a0110a8-b26b-4595-b5fb-b2388263ac54" : "par1/0a0110a8-b26b-4595-b5fb-b2388263ac54_0-1-0_20210510175131.parquet" }, "totalRecordsDeleted" : 0, "totalLogRecordsCompacted" : 1245, "writePartitionPaths" : [ "par1" ] }
# rollback(取消任务再重新执行任务) avro-tools tojson t1/.hoodie/20210510181212.rollback { "startRollbackTime":"20210510181212", -- 开始rollback的时间 "timeTakenInMillis":33, -- rollback耗时 "totalFilesDeleted":0, -- 共删除文件 "commitsRollback":[ "20210510175331" -- 回滚操作 ], "partitionMetadata":{ -- 元数据 "par1":{ "partitionPath":"par1", "successDeleteFiles":[
], "failedDeleteFiles":[
], "rollbackLogFiles":{ "map":{
} }, "writtenLogFiles":{ "map":{
} } } }, "version":{ -- 版本 "int":1 }, "instantsRollback":[ -- 回滚操作 { "commitTime":"20210510175331", -- commit时间 "action":"deltacommit" -- commit类型 } ] }
# clean(清理) # clean.requested { "earliestInstantToRetain":{ -- 需要保留的操作,之前的操作将被清除掉 "org.apache.hudi.avro.model.HoodieActionInstant":{ "timestamp":"20210510181523", "action":"deltacommit", "state":"COMPLETED" } }, "policy":"KEEP_LATEST_COMMITS", -- 清理策略,保留最新的commit "filesToBeDeletedPerPartition":{ -- 每个分区被删除的文件 "map":{
} }, "version":{ "int":2 }, "filePathsToBeDeletedPerPartition":{ -- 每个分区被删除的文件 "map":{ "par1":[ { "filePath":{ "string":"hdfs://mac:9000/t1/par1/39798d42-eb9f-46c7-aece-bdbe9fed3c45_0-1-0_20210510175131.parquet" }, "isBootstrapBaseFile":{ "boolean":false } }, { "filePath":{ "string":"hdfs://mac:9000/t1/par1/.39798d42-eb9f-46c7-aece-bdbe9fed3c45_20210510175131.log.1_0-1-0" }, "isBootstrapBaseFile":{ "boolean":false } } ] } } }
# clean { "startCleanTime":"20210511090334", -- 开始清除时间 "timeTakenInMillis":618, -- 耗时 "totalFilesDeleted":2, -- 删除文件数 "earliestCommitToRetain":"20210510181523", -- 最早提交操作 "partitionMetadata":{ -- 分区元数据 "par1":{ "partitionPath":"par1", "policy":"KEEP_LATEST_COMMITS", "deletePathPatterns":[ -- 删除文件正则 "39798d42-eb9f-46c7-aece-bdbe9fed3c45_0-1-0_20210510175131.parquet", ".39798d42-eb9f-46c7-aece-bdbe9fed3c45_20210510175131.log.1_0-1-0" ], "successDeleteFiles":[ -- 成功删除文件 "39798d42-eb9f-46c7-aece-bdbe9fed3c45_0-1-0_20210510175131.parquet", ".39798d42-eb9f-46c7-aece-bdbe9fed3c45_20210510175131.log.1_0-1-0" ], "failedDeleteFiles":[
] } }, "version":{ "int":2 }, "bootstrapPartitionMetadata":{ "map":{
} } }
|