Skip to content

Commit 9f39403

Browse files
committed
As getClusterSuffixFromConfig() changed we need to change the code for file deletion
1 parent 081f0c4 commit 9f39403

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AbstractReadOnlyController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import java.io.FileNotFoundException;
2121
import java.io.IOException;
22-
import java.nio.charset.StandardCharsets;
22+
import java.util.Arrays;
2323
import org.apache.commons.io.IOUtils;
2424
import org.apache.hadoop.fs.FSDataInputStream;
2525
import org.apache.hadoop.fs.FileSystem;
@@ -64,9 +64,9 @@ public static void manageActiveClusterIdFile(boolean readOnlyEnabled, MasterFile
6464
LOG.debug("Global read-only mode is being ENABLED. Deleting active cluster file: {}",
6565
activeClusterFile);
6666
try (FSDataInputStream in = fs.open(activeClusterFile)) {
67-
String actualClusterFileData = IOUtils.toString(in, StandardCharsets.UTF_8);
68-
String expectedClusterFileData = mfs.getActiveClusterSuffix().toString();
69-
if (actualClusterFileData.equals(expectedClusterFileData)) {
67+
byte[] actualClusterFileData = IOUtils.toByteArray(in);
68+
byte[] expectedClusterFileData = mfs.getActiveClusterSuffix().toByteArray();
69+
if (Arrays.equals(actualClusterFileData, expectedClusterFileData)) {
7070
fs.delete(activeClusterFile, false);
7171
LOG.info("Successfully deleted active cluster file: {}", activeClusterFile);
7272
} else {

0 commit comments

Comments
 (0)