Skip to content

Instantly share code, notes, and snippets.

View bbeaudreault's full-sized avatar

Bryan Beaudreault bbeaudreault

View GitHub Profile
package vitessutil
import (
"fmt"
"encoding/json"
"time"
"github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman"
@bbeaudreault
bbeaudreault / validateSubquerySamePlan.go
Created August 4, 2017 18:24
validate that if a subquery it exists, it and any further subqueries are all part of the same plan.
func validateSubquerySamePlan(node sqlparser.SQLNode, outer *engine.Route, vschema VSchema) bool {
samePlan := true
inSubQuery := false
_ = sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) {
if _, ok := node.(*sqlparser.Subquery); ok {
inSubQuery = true
return true, nil
}
@bbeaudreault
bbeaudreault / 0001-Cache-costs-so-we-don-t-waste-so-much-time-recomputi.patch
Last active May 18, 2021 19:47
Cache costs so we don't waste so much time recomputing things that havent changed, written against hbase 1.2. This patch was written to be minimal diff as opposed to the most ideal/clean solution. It improved performance on our clusters by about 10x.
From bc5de4ffd41b7dbb88a51ad255af6b617e9282f8 Mon Sep 17 00:00:00 2001
From: Bryan Beaudreault <bbeaudreault@hubspot.com>
Date: Thu, 6 May 2021 10:39:05 -0400
Subject: [PATCH] Cache costs so we don't waste so much time recomputing things
that havent changed
---
.../master/balancer/BaseLoadBalancer.java | 22 +++++++
.../balancer/StochasticLoadBalancer.java | 65 ++++++++++++-------
.../balancer/TestStochasticLoadBalancer.java | 2 +-
@Test
public void testMergeEmptyWithMetaCache() throws Throwable {
TableName tableName = TableName.valueOf("MergeEmpty");
byte[] family = Bytes.toBytes("CF");
TableDescriptor td = TableDescriptorBuilder.newBuilder(tableName)
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).build();
TEST_UTIL.getAdmin().createTable(td, new byte[][] { Bytes.toBytes(2), Bytes.toBytes(5) });
TEST_UTIL.waitTableAvailable(tableName);
TEST_UTIL.waitUntilNoRegionsInTransition();
RegionInfo regionA = null;