[ 
https://issues.apache.org/jira/browse/HBASE-22075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16798366#comment-16798366
 ] 

Josh Elser commented on HBASE-22075:
------------------------------------

{quote}This sounds like a case where we ought to be using procedures?
{quote}
Yeah, sounds like this should eventually be rewritten.

I'm having a hard time wrapping my head around this code, [~vrodionov]. I'm 
hoping you can clarify some of what this is doing... Just looking at 
{{PartitionedMobCompactor#compactMobFilesInBatch}}, we open a writer for the 
MOB file and then the reference file for that MOB file. The thing I don't 
understand is that we open a writer for that ref file, but we don't appear to 
_do_ anythign with it:
{code:java}
        writer = MobUtils
            .createWriter(conf, fs, column, 
partition.getPartitionId().getLatestDate(), tempPath,
                Long.MAX_VALUE, column.getCompactionCompressionType(),
                partition.getPartitionId().getStartKey(), 
compactionCacheConfig, cryptoContext,
                true);
        cleanupTmpMobFile = true;
        filePath = writer.getPath();
...
        // create a temp file and open a writer for it in the bulkloadPath
        refFileWriter = MobUtils.createRefFileWriter(conf, fs, column, 
bulkloadColumnPath,
            fileInfo.getSecond().longValue(), compactionCacheConfig, 
cryptoContext, true);
...
          for (Cell cell : cells) {
            // write the mob cell to the mob file.
            writer.append(cell);
            // write the new reference cell to the store file.
            Cell reference = MobUtils.createMobRefCell(cell, fileName, 
this.refCellTags);
            refFileWriter.append(reference);
            mobCells++;
          }
...
        if (cleanupBulkloadDirOfPartition) {
          // append metadata and bulkload info to the ref mob file, and close 
the writer.
          closeRefFileWriter(refFileWriter, fileInfo.getFirst(), 
request.selectionTime);
        }
...
        // bulkload the ref file
        bulkloadRefFile(connection, table, bulkloadPathOfPartition, 
filePath.getName()){code}
This looks to me that we end up bulk-loading the MOB file that we created, not 
the ref file? It's not clear to me what this is supposed to be doing.

Another question: In the case where we successfully created the new MOB file 
but the bulk loading of the ref file failed, how is deleting the new mob file 
causing data loss? The bulk load should be atomic, right? (Either all files are 
loaded or no files are loaded) I would think that if the bulk load of the ref 
file failed, we would be safe to get rid of that new MOB file because we still 
have all of the old MOB files.

> Potential data loss when MOB compaction fails
> ---------------------------------------------
>
>                 Key: HBASE-22075
>                 URL: https://issues.apache.org/jira/browse/HBASE-22075
>             Project: HBase
>          Issue Type: Bug
>          Components: mob
>    Affects Versions: 2.1.0, 2.0.0, 2.0.1, 2.1.1, 2.0.2, 2.0.3, 2.1.2, 2.0.4, 
> 2.1.3
>            Reporter: Vladimir Rodionov
>            Assignee: Vladimir Rodionov
>            Priority: Critical
>              Labels: mob
>             Fix For: 2.2.0, 2.0.5, 2.1.4
>
>         Attachments: HBASE-22075-v1.patch
>
>
> When MOB compaction fails during last step (bulk load of a newly created 
> reference file) there is a high chance of a data loss due to partially loaded 
> reference file, cells of which refer to (now) non-existent MOB file. The 
> newly created MOB file is deleted automatically in case of a MOB compaction 
> failure, but some cells with the references to this file might be loaded to 
> HBase. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to