av9ash/GitBugs huggingface dataset:
Bug: Support alternate compression for major and minor compactions
Status: Resolved | Priority: Minor | Resolution: Fixed
Created: 09/Apr/21 19:34

Resurrecting HBASE-2988. 

Currently we can specify a compression algorithm for a column family, or, optionally an alternative compression algorithm to use when compacting (as opposed to flushing). Extend this to optionally specify alternative compression algorithms for minor or major compactions. The interest here is specifically a separate alternative algorithm for major compactions, which might be an expensive but aggressively compressing algorithm like bzip2 or lzma (with custom patches).
Bug: Batch version of checkAndMutate on AsyncTable always returns false
Status: Resolved | Priority: Minor | Resolution: Duplicate
Created: 20/Apr/21 23:10
Affects Version/s: 2.4.1

Batch version of CheckAndMutate always returns false whereas non-batch version works fine. 

The code is like: 

```

AysncTable<?> table = connection.getTable(tableName, executorService);

...

// add r1

table.put(Arrays.asList(
 new Put(Bytes.toBytes("r1")).addColumn(COL_FAMILY, Bytes.toBytes("q1"), Bytes.toBytes("v1"))));

CheckAndMutate checkAndMutate1 = CheckAndMutate.newBuilder(Bytes.toBytes("r1"))
 .ifNotExists(COL_FAMILY, Bytes.toBytes("q1"))
 .build(new Put(Bytes.toBytes("r1")).addColumn(COL_FAMILY, Bytes.toBytes("q1"), Bytes.toBytes("v1")));

CheckAndMutate checkAndMutate2 = CheckAndMutate.newBuilder(Bytes.toBytes("r2"))
 .ifNotExists(COL_FAMILY, Bytes.toBytes("q2"))
 .build(new Put(Bytes.toBytes("r2")).addColumn(COL_FAMILY, Bytes.toBytes("q2"), Bytes.toBytes("v2")));

```

With batch version of checkAndMutate

```

List<CompletableFuture<CheckAndMutateResult>> results =
   table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));

System.out.println("first: " + results.get(0).join().isSuccess());  // false
System.out.println("second: " + results.get(1).join().isSuccess()); //false!

```

Even it returned false, the item was written to the table. 

 

With non-batch version of checkAndMutate

```

CompletableFuture<CheckAndMutateResult> result1 = table.checkAndMutate(checkAndMutate1);
 CompletableFuture<CheckAndMutateResult> result2 = table.checkAndMutate(checkAndMutate2);

System.out.println("first: " + result1.join().isSuccess()); // false 
 System.out.println("second: " + result2.join().isSuccess()); // true as expected

```

As expected r1 wasn't written to the table.
Bug: Add cacheBlocks option to RowCounter
Status: In Progress | Priority: Minor | Resolution: 
Created: 16/Apr/21 10:03

{{I want to preload the block cache quickly during performance testing,I find this:}}
 {{[#HBASE-25278 Add option to toggle CACHE_BLOCKS in count.rb]}}
 {{But it's too slow, adding cacheBlocks option to RowCounter maybe better for some case.}}
Bug: Use Class.asSubclass to fix the warning in StochasticLoadBalancer.loadCustomCostFunctions
Status: Resolved | Priority: Minor | Resolution: Fixed
Created: 15/Apr/21 03:39

{code}
 klass = (Class<? extends CostFunction>) Class.forName(c);
{code}
This will generated  a warning of unchecked casting, could simply use Class.forName(c).asSubclass(CostFunction.class).
Bug: Scan should be limited by read capacity unit quota if read size quota is not set
Status: Open | Priority: Minor | Resolution: 
Created: 06/Apr/21 06:45

Scan is currently limited by available size of quota, and quota size only considers the READ_SIZE type:
{code:java}
long maxQuotaResultSize = Math.min(maxScannerResultSize, quota.getReadAvailable());
{code}
If read size is not set, we should limit the result size by read capacity unit to avoid exceeding quota.
Bug: Improvement for some debug-logging guards
Status: Resolved | Priority: Minor | Resolution: Fixed
Created: 11/Apr/21 02:24

Some potential expensive debug-logging calls are partially guarded by `isXXXEnabled()`. Therefore,
- Moving some potential expensive statements into the adjacent `isDebugEnabled` in `NettyRpcDuplexHandler.java`
- Moving the `isTraceEnabled` up to the beginning of `printChoreDetails` and `printChoreServiceDetails` in `ChoreService.java `.
Bug: HBASE shell list_regions  doesn't work when region replica is enabled after merge regions
Status: Open | Priority: Minor | Resolution: 
Created: 07/Apr/21 10:42
Affects Version/s: 2.2.3

steps :
1.create 'Merget1', 'f1', \{REGION_REPLICATION => 2}

2. split 'Merget1','20'

3.list_regions 'Merget1'

4. merge_region 'EncodeRegionName1','EncodeRegionName2'  

5. when list_regions 'Merget1' getting undefined method

!image-2021-04-07-16-10-50-935.png!

 *Issue doesn't seems to occur for tables which do not have region replica enabled*
Bug: HBase RegionServer Canary reports failure if an online regionserver is hosting 0 regions
Status: Open | Priority: Minor | Resolution: 
Created: 02/Apr/21 19:39

The probability of this happening increases with system rsgroup enabled (i.e. an rsgroup dedicated to system tables, which have few regions) and paired with table-level load balancing. As long as the server is alive and able to accept/serve regions, we should not consider it an error case if it is currently serving no regions.
Bug: Get rid of null regioninfo in wrapped connection exceptions
Status: Resolved | Priority: Trivial | Resolution: Fixed
Created: 29/May/21 00:12
Affects Version/s: 2.4.4

I was debugging something and noticed this,

{noformat}
org.apache.hbase.thirdparty.com.google.protobuf.ServiceException: java.io.IOException: Call to address=localhost:59142null failed on local exception: java.io.IOException: Connection reset by peer
{noformat}

`null` there is regioninfo and because this call has nothing set on it, it was confusing where that null is coming from, added recently via HBASE-25735.
Bug: graceful_stop.sh unable to restore the balance state
Status: Resolved | Priority: Blocker | Resolution: Fixed
Created: 05/Aug/22 13:08
Affects Version/s: 2.4.13

When executing the command ’graceful_stop.sh --restart --reload‘, the balance state cannot be restored normally. Because the related command returned the wrong result:
{code:java}
HBASE_BALANCER_STATE=$(echo 'balance_switch false' | hbase shell -n | tail -1)
echo ${HBASE_BALANCER_STATE} 
hbase:002:0>
{code}
 

The information returned by  "echo 'balance_switch false' | hbase shell -n" is as follows:

hbase:001:0> balance_switch false  {color:#ff0000}#line 1{color}

2022-08-05 22:41:57,269 INFO  [RPCClient-NioEventLoopGroup-1-1] Configuration.deprecation: hbase.client.pause.cqtbe is deprecated. Instead, use hbase.client.pause.server.overloaded {color:#ff0000}#line 2{color}
Previous balancer state : true   {color:#ff0000}# line 3{color}
Took 0.6787 seconds {color:#ff0000}#line 4{color}
=> true  {color:#ff0000}#line 5{color}
hbase:002:0> {color:#ff0000}#line 6{color}

 

head -1 is {color:#172b4d}#line 1{color}: "hbase:001:0> balance_switch false"

tail -1 is {color:#172b4d}#line 6{color}: "hbase:002:0>"

 

{color:#172b4d}balance_switch.rb is as follows:{color}
{code:java}
def command(enableDisable)
  prev_state = !!admin.balance_switch(enableDisable)
  formatter.row(["Previous balancer state : #{prev_state}"])
  prev_state
end{code}
#line 3 and #line 5 of 'true'  represent the previous balance status.

So we can use the value of {color:#172b4d}#line 5{color}  as the state of the previous balance.
Bug: The ReplicationLogCleaner is not thread safe but can be called from different threads at the same time
Status: Resolved | Priority: Critical | Resolution: Fixed
Created: 24/Aug/22 02:43

In preClean method we will update the class fields and then use them in the getDeletableFiles method. This implies that we will have only one cleaner run at the same time.

But actually, in MasterRpcServices.runCleanerChore, we will call execute the HFileCleaner and LogCleaner directly, not in the cleanerChore thread.

This could cause data loss for replication, which is a very serious problem.
Bug: Add default implementation for Connection$getClusterId
Status: Resolved | Priority: Critical | Resolution: Fixed
Created: 08/Aug/22 11:12
Affects Version/s: 2.4.14

The getClusterId method was added to Connection for delegation token based auth. This interface is InterfaceAudience.Public so it breaks client compatibility. Hbase connections builds fail with the latest 2.4.14-SNAPSHOT version and downstream applications relying on Connection interface will fail to work on these versions.
Bug: BlockingRpcClient will hang for 20 seconds when SASL is enabled after finishing negotiation
Status: Resolved | Priority: Critical | Resolution: Fixed
Created: 14/Jul/22 13:43

Found this when implementing HBASE-27185. When running TestSecureIPC, if BlockingRpcClient is used, the tests will spend much more time comparing to NettyRpcClient.

The problem is that, for the normal kerberos authentication, the last step is client send a reply to server, so after server receives the last token, it will not write anything back but expect client to send connection header.

In HBASE-24579, for reading the error message, we added a readReply after the SaslClient indicates that the negotiation is completed. But as said above, for normal cases, we will not write anything back from server side, so the client will hang there and only throw an exception when timeout is reached, which is 20 seconds.

This nearly makes the BlockingRpcClient unusable when sasl is enabled, as it will hang 20 seconds when connecting...
Bug: Add 2.5 Documentation to the website
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 31/Aug/22 13:46

Following the example from HBASE-24487, will create PR for both the main repo and the hbase-site repo.

Generating the site documentation from main repo, copy to site, as follows:
{noformat}
hbase $ git checkout rel/2.5.0
hbase $ mvn clean site site:stage -DskipTests
hbase-site $ git checkout asf-site
hbase-site $ cp -r ../hbase/target/staging ./2.5
hbase-site $ git add 2.5
{noformat}

Then, update the site structure to include a reference to the new content, following https://github.com/apache/hbase/pull/2060
Bug: Add validation of request user and groups from TLS certificate
Status: In Progress | Priority: Major | Resolution: 
Created: 24/Aug/22 17:48
Affects Version/s: 2.6.0

When using mTLS for client authentication, we can allow the user to configure certain certificate fields as a means for validating the passed username on the ConnectionHeader. We can further look to inject groups for the user into the request context, which can be used for downstream authz in (for example) AuthManager/AccessChecker/etc.

I would propose two new configs:
{code:java}
<property>
  <name>hbase.rpc.tls.certificate.username.oid</name>
  <value></value>
  <description>When specified and TLS enabled, the client's SSL certificate will be inspected for an OID of this value. A value must be found and the value must match the username passed in the ConnectionHeader. For example, can be set to "CN" and we will use the CommonName of the certificate to validate the username.</description>
</property>
<property>
  <name>hbase.rpc.tls.certificate.group.oid</name>
  <value></value>
  <description>When specified and TLS enabled, the client's SSL certificate will be inspected for OIDs of this value. If one or more values are found, they will be used as the user's groups for use in hbase authz.</description>
</property>{code}
I think this would only apply when AuthenticationMethod is SIMPLE (no kerberos).
Bug: RegionServer should be aborted when WAL.sync throws TimeoutIOException
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 21/Jul/22 03:15
Affects Version/s: 3.0.0-alpha-4

As HBASE-27223 said, if  {{WAL.sync}} get a timeout exception, we should abort the region server, as the design of WAL sync, is to succeed or die, there is no 'failure'. It is usually not a big deal is because we set a very large default value(5 minutes) for {{AbstractFSWAL.WAL_SYNC_TIMEOUT_MS}}, usually the WAL system will abort the region server if it can not finish the sync within 5 minutes.

In the PR, only the {{WAL.sync}}  timeout in {{HRegion#doWALAppend}} ,regionServer is always aborted. For {{WALUtil.writeMarker}}, it is just record the internal state and  seems it is no need to always abort the regionServer when {{WAL.sync}} timeout，it is the internal state transition that determines whether regionServer is aborted.
Bug: Abort RS when the hostname is different from master seen
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 26/Aug/22 10:44
Affects Version/s: 2.5.3

For HRegionServer#handleReportForDutyResponse, when the hostname is different from the regionserver and master side, both the two conditions should abort RS.
{code:java}
if (
  !StringUtils.isBlank(useThisHostnameInstead)
    && !hostnameFromMasterPOV.equals(useThisHostnameInstead)
) {
  String msg = "Master passed us a different hostname to use; was="
    + this.useThisHostnameInstead + ", but now=" + hostnameFromMasterPOV;
  LOG.error(msg);
  throw new IOException(msg);
}
if (
  StringUtils.isBlank(useThisHostnameInstead)
    && !hostnameFromMasterPOV.equals(rpcServices.getSocketAddress().getHostName())
) {
  String msg = "Master passed us a different hostname to use; was="
    + rpcServices.getSocketAddress().getHostName() + ", but now=" + hostnameFromMasterPOV;
  LOG.error(msg);
} {code}
Bug: region.jsp shows incorrect size for split reference hfiles
Status: Open | Priority: Major | Resolution: 
Created: 29/Jul/22 11:23

When a region is split, the resulting daughter regions each refer back to original store files for the original region. When viewing the region.jsp page in the RegionServer UI, these show a size  of 0. This is because the region.jsp is directly checking the FileSystem length for the given storefile path, which isn't aware of references/links. We should be able to update region.jsp to call a variant of HStore.getStorefilesSize, which handles this complexity.
Bug: Create admin/shell api for reloading just HMaster configs
Status: Open | Priority: Major | Resolution: 
Created: 13/Sep/22 12:27

We have {{update_config}} and {{{}update_all_config{}}}. The former can do an individual host (RS or HMaster), the latter does all hosts in the cluster.  If you just want to reload HMaster(s) you need to go into JMX metrics to find the tag.ServerName for each HMaster, and then paste that into individual update_config calls.

We could either add a new {{update_hmaster_config}} or add an argument to the existing {{{}update_all_config 'hmaster'{}}}. Whatever way we go, we should add a corresponding method in Admin as well.
Bug: Still seeing 'Stuck' in static initialization creating RegionInfo instance
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 21/Sep/22 14:14

See https://issues.apache.org/jira/browse/HBASE-24896 for the original description. Despite having that fix, we are seeing this issue in a 2.4.6-based deploy. We recently started seeing it as we were moving to centos8. I'm not sure why the centos version would affect this, otherwise the hbase server version and java versions were not changing.

We're seeing this in a non-trivial number of new centos8 servers that we spin up. I'm pushing a hotfix which removes RegionInfo.UNDEFINED to see if that resolves our issue.

As mentioned in my last comments on that jira, it could be that this field is still an issue because according to [https://stackoverflow.com/questions/28631656/runnable-thread-state-but-in-object-wait:]

> Such deadlocks may be caused by a [typical bug|https://bugs.openjdk.org/browse/JDK-8037567] when a subclass is referenced from a static initializer.

If that's true, in this case MutableRegionInfo is a subclass/implementer of RegionInfo, so that could trigger it. Granted the linked bug is marked "Not An Issue".
Bug: Read blocks into off-heap if caching is disabled for read
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 24/Jul/22 19:21

Currently we decide whether a disk read {{shouldUseHeap}} based on three criteria:
 # If block cache is disabled, return false
 # If block cache is anything other than CombinedBlockCache, return true
 # Otherwise return false for DATA blocks and true for other blocks

The assumption here is we're making the decision based on which cache the block is likely to end up in. But if the read has caching disabled (i.e. setCacheBlocks(false)), it won't get into any cache. So we should return false in that case too.

The only caller to {{shouldUseHeap}} in HFileReaderImpl has a boolean {{cacheBlock}} available which determines if the read block should attempt to be cached. We can pass that boolean into the function. We should probably also account for cacheConf.shouldCacheBlockOnRead for the same reason.
Bug: HFile tool statistic sampling produces misleading results
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 19/Jul/22 13:20

HFile tool uses codahale metrics for collecting statistics about key/values in an HFile. We recently had a case where the statistics printed out that the max row size was only 25k. This was confusing because I was seeing bucket cache allocation failures for blocks as large as 1.5mb. 

Digging in, I was able to find the large row using the "-p" argument (which was obviously very verbose). Once I found the row, I saw the vlen was listed as ~1.5mb which made much more sense.

First thing I notice here is that default codahale metrics histogram is using ExponentiallyDecayingReservoir. This probably makes sense for a long-lived histogram, but the HFile tool is run at a point in time. It might be best to use UniformReservoir instead.

Secondly, we do not need sampling for min/max. Let's supplement the histogram with our own calculation which is guaranteed to be accurate for the entirety of the file.
Bug: Persist list of Hfiles names for which prefetch is done
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 22/Aug/22 16:04
Affects Version/s: 3.0.0-alpha-3

Persist list of Hfiles names for which prefetch is completed when persist for in-memory bucket cache mapping state is enabled.

We need to persist the Set, which contains a list of all the HFiles for which the prefetch has completed along with the In-memory state of the bucket cache so that when we restart and if any prefetch is scheduled again for the same HFile and we already have the in-memory state retrieved, we can skip the prefetch for it.
Bug: Update create-release to work with maven-gpg-plugin-3.0.1 and gnupg >= 2.1.x
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 22/Aug/22 15:40

I've run into some trouble with `create-release`. The issue seems to come down to changes to maven-release-plugin via MGPG-79 and working with the `agent-extra-socket`. After MGPG-79, maven-release-plugin uses `--pinentry-mode error` in a non-interactive setting, which is not permissible over the restricted permissions exposed via `agent-extra-socket`.
Bug: Auto merging small stripes in StripeCompactionPolicy
Status: Open | Priority: Major | Resolution: 
Created: 24/Aug/22 10:01
Affects Version/s: 2.4.13

Currently, stripes merge only happens when two stripes are empty, but that is not enough. With the data appending the stripes splits by splits, but with the data deleting, stripes might become smaller size while the stripes count is large. 

Auto merging small stripes can help to reduce the file count in the store and improve read effiecency.
Bug: Support to take the initiative to compact cold large files and compression diff hfiles after changing storefile compression algrithm 
Status: Open | Priority: Major | Resolution: 
Created: 24/Aug/22 09:54
Affects Version/s: 2.4.13

We can set switch to enable this feature, to make the compression algrithm changes be applied to all the existing store files, especially when we make a lower space usage compression algrithm change, e.g. from LZO to ZSTD can save more than 30% spaces.

All the compaction policies should support this feature.
Bug: Add cost function in balancer to consider the cost of building bucket cache before moving regions
Status: Reopened | Priority: Major | Resolution: 
Created: 23/Sep/22 16:16

HBase currently uses StochasticLoadBalancer to determine the cost of moving the regions from one RS to another. Each cost functions give a result between 0 and 1, with 0 being the lowest cost and 1 being the cost. The balancer iterates through each cost function and comes up with the total cost. Now, the balancer will create multiple balancing plans on random actions and try to compute the cost of each plan as if they are executed, if the cost of the plan is less than the initial cost, the plan is executed.

Implement a new "CacheAwareCostFunction" which takes into account if the region is fully cached and return the highest cost if the plan suggests moving this region.
Bug: Reduce reflection overhead in Filter deserialization
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 05/Aug/22 14:22

Running hbase 2.4.x, I recently profiled one of our clusters which does a very high volume of random reads. An astonishing 12% of CPU time was just spent deserializing in ProtobufUtil.toFilter.

One immediate thought would be to cache String -> Class mappings. Currently Class.forName shows up multiple times (6 in my example) in the profile, each time taking over 1%. I think this is partially due to using FilterList in this example.
Bug: The servername in the rsgroup table should be lowercase
Status: Open | Priority: Major | Resolution: 
Created: 25/Jul/22 13:27
Affects Version/s: 2.4.13

In HBASE-13995 and HBASE-24395, both mention that ServerName.getHostname() is case sensitive. 
 
Now the move_servers_rsgroup is still case sensitive. Servername is displayed in lowercase on the master ui, but uppercase is stored in the rsgroup table. I think the master ui should be consistent with the rsgroup table.
!27237.png!
Bug: FSHLog should retry writing WAL entries when syncs to HDFS failed.
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 21/Jul/22 03:32
Affects Version/s: 3.0.0-alpha-4

Just as HBASE-27223 said, basically, if the {{WAL}} write to HDFS fails, we do not know whether the data has been persistent or not. The implementation for {{AsyncFSWAL}}, is to open a new writer and try to write the WAL entries again, and then adding logic in WAL split and replay to deal with duplicate entries. But for {{FSHLog}}, it does not have the same logic with {{AsyncFSWAL}}, when {{ProtobufLogWriter.append}} and {{ProtobufLogWriter.sync}} failed, {{FSHLog.sync}} immediately throws the exception thrown by {{ProtobufLogWriter.append}} and {{ProtobufLogWriter.sync}} , we should implement the same retry logic as {{AsyncFSWAL}}, so {{WAL.sync}} could only throw  {{TimeoutIOException}} and we could uniformly abort the RegionServer when  {{WAL.sync}} failed.

The basic idea is because both {{FSHLog.RingBufferEventHandler}} and {{AsyncFSWAL.consumeExecutor}} are single-thread,  we could reuse the logic in {{AsyncWAL}} and move the most code in {{AsyncWAL}} upward to {{AbstractFSWAL}} , and just adapting the {{SyncRunner}} in {{FSHLog}} to the logic in {{AsyncWriter.sync}}. Once we do that, most logic in {{AsyncWAL}} and {{FSHLog}} are unified, just how to sync the {{writer}} is different.
Bug: [hbase-connectors] Fail to build hbase-connectors because of checkstyle error
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 04/Jul/22 13:22

We set failOnViolation to true but in pre commit, we will use "-Dcheckstyle.skip=true" when running mvninstall so we can not find the problem in pre commit, but when we run 'mvn install' locally, the build will fail.
Bug: Add a new procedure type for implementing some global operations such as migration
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 26/Sep/22 15:53

When implementing HBASE-27218, I need to implement a special procedure for migrating the replication queue data, but there is no support for this type of procedure, we only support server/table/peer, but this procedure can not fit any of them.

So let's implement a new type of procedure.