Skip to content

Commit 74f9ec4

Browse files
craig[bot]tbgstevendanna
committed
144220: scripts: add gceworker.sh update-hosts r=tbg a=tbg This adds a line like this to /etc/hosts: 34.107.119.188 gceworker-tbg.local AFAIK we don't have a stable DNS entry for gceworkers, so this helps set up remote development in Goland, for example. Epic: none Release note: none 144232: crosscluster: disable write buffering r=yuzefovich,jeffswenson a=stevendanna The txnWriteBuffer does not yet support the OriginTimestamp and OriginID write options used by LDR. Soon, it will reject requests with these options set. This opts LDR out of this setting even in a cluster were the cluster setting has changed the default. Epic: none Release note: None Co-authored-by: Tobias Grieger <[email protected]> Co-authored-by: Steven Danna <[email protected]>
3 parents f8e37e8 + 959e3ca + 067ae46 commit 74f9ec4

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

pkg/crosscluster/logical/lww_kv_processor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ func (p *kvRowProcessor) processOneRow(
224224
refreshCount int,
225225
) error {
226226
if err := p.cfg.DB.KV().Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {
227+
txn.SetBufferedWritesEnabled(false)
227228
b := makeKVBatch(useLowPriority.Get(&p.cfg.Settings.SV), txn)
228229

229230
if err := p.addToBatch(ctx, txn, b, dstTableID, row, k, prevValue); err != nil {

pkg/crosscluster/logical/lww_row_processor.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ func (srp *sqlRowProcessor) GetLastRow() cdcevent.Row {
388388
}
389389

390390
var (
391-
forceGenericPlan = sessiondatapb.PlanCacheModeForceGeneric
392-
ieOverrideBase = sessiondata.InternalExecutorOverride{
391+
bufferedWritesEnabled = false
392+
forceGenericPlan = sessiondatapb.PlanCacheModeForceGeneric
393+
ieOverrideBase = sessiondata.InternalExecutorOverride{
393394
// The OriginIDForLogicalDataReplication session variable will bind the
394395
// origin ID 1 to each per-statement batch request header sent by the
395396
// internal executor. This metadata will be plumbed to the MVCCValueHeader
@@ -412,8 +413,9 @@ var (
412413
GrowStackSize: true,
413414
// We don't get any benefits from generating plan gists for internal
414415
// queries, so we disable them.
415-
DisablePlanGists: true,
416-
QualityOfService: &sessiondatapb.BulkLowQoS,
416+
DisablePlanGists: true,
417+
QualityOfService: &sessiondatapb.BulkLowQoS,
418+
BufferedWritesEnabled: &bufferedWritesEnabled,
417419
}
418420
)
419421

pkg/sql/internal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,9 @@ func applyOverrides(o sessiondata.InternalExecutorOverride, sd *sessiondata.Sess
962962
if o.DisablePlanGists {
963963
sd.DisablePlanGists = true
964964
}
965+
if o.BufferedWritesEnabled != nil {
966+
sd.BufferedWritesEnabled = *o.BufferedWritesEnabled
967+
}
965968

966969
if o.MultiOverride != "" {
967970
overrides := strings.Split(o.MultiOverride, ",")

pkg/sql/sessiondata/internal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ type InternalExecutorOverride struct {
8484
GrowStackSize bool
8585
// DisablePlanGists, if true, overrides the disable_plan_gists session var.
8686
DisablePlanGists bool
87+
// BufferedWritesEnabled, if set, controls whether the buffered writes KV transaction
88+
// protocol is used for user queries on the current session.
89+
BufferedWritesEnabled *bool
8790
}
8891

8992
// NoSessionDataOverride is the empty InternalExecutorOverride which does not

scripts/gceworker.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ if [[ "${cmd}" ]]; then
3030
shift
3131
fi
3232

33+
function get_ip() {
34+
gcloud compute instances describe --format="value(networkInterfaces[0].accessConfigs[0].natIP)" "${NAME}"
35+
}
36+
3337
function user_domain_suffix() {
3438
gcloud auth list --limit 1 --filter="status:ACTIVE account:@cockroachlabs.com" --format="value(account)" | sed 's/[@\.\-]/_/g'
3539
}
@@ -57,7 +61,7 @@ EOF
5761
}
5862

5963
function refresh_ssh_config() {
60-
IP=$($0 ip)
64+
IP=$(get_ip)
6165
if ! grep -q "${FQNAME}" ~/.ssh/config; then
6266
USER_DOMAIN_SUFFIX="$(user_domain_suffix)"
6367
echo "No alias found for ${FQNAME} in ~/.ssh/config. Creating one for ${USER_DOMAIN_SUFFIX} now with the instance external ip."
@@ -249,7 +253,7 @@ put)
249253
gcloud compute scp --recurse ${lpath} "${to}"
250254
;;
251255
ip)
252-
gcloud compute instances describe --format="value(networkInterfaces[0].accessConfigs[0].natIP)" "${NAME}"
256+
echo "$(get_ip)"
253257
;;
254258
sync)
255259
if ! hash unison 2>/dev/null; then
@@ -300,8 +304,17 @@ vscode)
300304
status)
301305
gcloud compute instances describe ${NAME} --format="table(name,status,lastStartTimestamp,lastStopTimestamp)"
302306
;;
307+
update-hosts)
308+
NEW_IP="$(get_ip)"
309+
HOSTS_FILE="/etc/hosts"
310+
311+
# Step 1: Remove any existing gceworker line.
312+
sudo sed -i '' "/${NAME}\.local/d" "${HOSTS_FILE}"
313+
# Step 2: Insert the new line at the end unconditionally
314+
echo "${NEW_IP} ${NAME}.local" | sudo tee -a ${HOSTS_FILE} > /dev/null
315+
;;
303316
*)
304-
echo "$0: unknown command: ${cmd}, use one of create, start, stop, resume, suspend, delete, status, ssh, get, put, or sync"
317+
echo "$0: unknown command: ${cmd}, use one of create, start, stop, resume, suspend, delete, status, ssh, get, put, sync, or update-hosts"
305318
exit 1
306319
;;
307320
esac

0 commit comments

Comments
 (0)