Friday, August 25, 2017

RCA: data type is incorrect

QA reported one issue during regression test. He added one Hbase backup configuration via GUI but the backup operation failed. HDFS backup is OK.

Looking into this issue, I found the data type is saved as "HDFS" in the configuration file which should be "HBASE" in the URL. It narrows down the problem.

Looking back to a recent checkin by a team member, I found this:
184:                   if ($scope.editdatamodel.bkCfg.type == "hbase") {
185:                        value = "/" + value;
186:                        basedir.replace("hdfs://", "hbase://");
187:                    }
Look at line 186. Yes, that's the root cause.  The javascript function 'replace' does not search and replace in place. It returns a NEW string.
https://www.w3schools.com/jsref/jsref_replace.asp

Solution:
    basedir = basedir.replace("hdfs://", "hbase://");

No comments: