Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
cockroachdb/cockroach
AALEKH/cockroach
Abioy/cockroach
AflenChen/cockroach
Arifur794/cockroach
CodEnFisH/cockroach
DilipLukose/cockroach
El-Coder/cockroach
Frank-Jin/cockroach
GavinHwa/cockroach
GokulSrinivas/cockroach
GrayMissing/cockroach
HanumathRao/cockroach
HengWang/cockroach
HunterChen/cockroach
InsaneYoungStunner/cockroach
Kevin-GuanJian/cockroach
Linicks/cockroach
PragashSiva/cockroach
RaduBerinde/cockroach
SandyZeng/cockroach
Viewtiful/cockroach
XuWanHong/cockroach-1
Zemnmez/cockroach
a-robinson/cockroach
abhishekgahlot/cockroach
alex/cockroach
alisheikh/cockroach
anchal-agrawal/cockroach
andradeandrey/cockroach
angel1991521/cockroach
ansonism/cockroach
axfcampos/cockroach
banks/cockroach
bdarnell/cockroach
bdotdub/cockroach
bigrats/cockroach
bigxing/cockroach
bobpattersonjr/cockroach
bowlofstew/cockroach
brandenyoon/cockroach
briliant1991/cockroach
bussiere/cockroach
bydsky/cockroach
cDoru/cockroach
cainiao1989/cockroach
cdsalmons/cockroach
chagge/cockroach
chunshengster/cockroach
cleverdeng/cockroach
clm971910/cockroach
cn15810092493/cockroach
connecteev/cockroach
dallasmarlow/cockroach
darkseed/cockroach
db-production/cockroach
dfrsg/cockroach
diegode/cockroach
domluna/cockroach
eagle518/cockroach
easyfmxu/cockroach
eclectice/cockroach
elvin-du/cockroach
embark/cockroach
erriapo/cockroach
es-chow/cockroach
esaul/cockroach
flyingliang/cockroach
gaowenbin/cockroach
ghostsun/cockroach
gqf2008/cockroach
grimreaper/cockroach
gstarnberger/cockroach
gude/cockroach
guiquanz/cockroach
hannibalhuang/cockroach
hanshenu/cockroach
hanwoody/cockroach
hcxiong/cockroach
hollis/cockroach
hubt/cockroach
hunslater/cockroach
iamima/cockroach
icattlecoder/cockroach
ikarzali/cockroach
ilovejs/cockroach
jackylk/cockroach
jamesgraves/cockroach
jamiepg1/cockroach
jay23jack/cockroach
jess-edwards/cockroach
jinguoxing/cockroach
jmank88/cockroach
joezxy/cockroach
joliny/cockroach
jonathanmarvens/cockroach
josephwinston/cockroach
josephyzhou/cockroach
joshuawatson/cockroach
jrcjc123/cockroach
jsanc623/cockroach
kanasite/cockroach
kebohiki/cockroach
kkaneda/cockroach
kortschak/cockroach
kritivasas/cockroach
kuguobing/cockroach
lemonhall/cockroach
leomzhong/cockroach
lessc0de/cockroach
lianhuiwang/cockroach
liuzongquan/cockroach
lostz/cockroach
lshmouse/cockroach
luan-cestari/cockroach
lupengfeige/cockroach
mabdullah353/cockroach
mackjoner/cockroach
maniksurtani/cockroach
manithnuon/cockroach
markreg/cockroach
matadorhong/cockroach
meshileya/cockroach
mindis/cockroach
mixiong/cockroach
mjibson/cockroach
mobilipia/cockroach
mohae/cockroach
mrunix/cockroach
msmakhlouf/cockroach
nanderoo/cockroach
neuroradiology/cockroach
neutony/cockroach
nikelius/cockroach
nimishzynga/cockroach
nkgfirecream/cockroach
nmarasoiu/cockroach
ofonimefrancis/cockroach
oldmantaiter/cockroach
ollyblue/cockroach
petermattis/cockroach
picolonet/storage
pinterb/cockroach
pramendra/cockroach
putaozhuose/cockroach
r00tjimmy/cockroach
ramgtv/cockroach
rayleyva/cockroach
sandeepmukho/cockroach
sawanoboly/cockroach
scrooph/cockroach
sdboyer/cockroach
shafiahmed/cockroach
shanyechen/cockroach
shilezi/cockroach
silky/cockroach
slavau/cockroach
sunya123/cockroach
superneo/cockroach
swarbiv/cockroach
sxhao/cockroach
tamird/cockroach
therob3000/cockroach
timwee/cockroach
tml/cockroach
tomzhang/cockroach
toshisam/cockroach
trebogeer/cockroach
treemantris/cockroach
tristartom/cockroach
truthwzl/cockroach
tschottdorf/cockroach
udybrill/cockroach
umegaya/cockroach
vikram/cockroach
vivekmenezes/cockroach
vvydier/cockroach
waderly/cockroach
walkingsparrow/cockroach
wangtuanjie/cockroach
wheelcomplex/cockroach
willmadison/cockroach
wulinjun4/cockroach
wuyu201321060203/cockroach
wycg1984/cockroach
xiaoyulei/cockroach
yacki/cockroach
yananzhi/cockroach
yangyaoweng/cockroach
yanniyang/cockroach
yekeqiang/cockroach
yemaocheng/cockroach
yonglehou/cockroach
zeeshanali/cockroach
zhaixuezhong/cockroach
zhangchn/cockroach
zhanglei/cockroach
zhonghai/cockroach
zimmermamc/cockroach
zofuthan/cockroach
Nothing to show
Choose a Head Repository
cockroachdb/cockroach
AALEKH/cockroach
Abioy/cockroach
AflenChen/cockroach
Arifur794/cockroach
CodEnFisH/cockroach
DilipLukose/cockroach
El-Coder/cockroach
Frank-Jin/cockroach
GavinHwa/cockroach
GokulSrinivas/cockroach
GrayMissing/cockroach
HanumathRao/cockroach
HengWang/cockroach
HunterChen/cockroach
InsaneYoungStunner/cockroach
Kevin-GuanJian/cockroach
Linicks/cockroach
PragashSiva/cockroach
RaduBerinde/cockroach
SandyZeng/cockroach
Viewtiful/cockroach
XuWanHong/cockroach-1
Zemnmez/cockroach
a-robinson/cockroach
abhishekgahlot/cockroach
alex/cockroach
alisheikh/cockroach
anchal-agrawal/cockroach
andradeandrey/cockroach
angel1991521/cockroach
ansonism/cockroach
axfcampos/cockroach
banks/cockroach
bdarnell/cockroach
bdotdub/cockroach
bigrats/cockroach
bigxing/cockroach
bobpattersonjr/cockroach
bowlofstew/cockroach
brandenyoon/cockroach
briliant1991/cockroach
bussiere/cockroach
bydsky/cockroach
cDoru/cockroach
cainiao1989/cockroach
cdsalmons/cockroach
chagge/cockroach
chunshengster/cockroach
cleverdeng/cockroach
clm971910/cockroach
cn15810092493/cockroach
connecteev/cockroach
dallasmarlow/cockroach
darkseed/cockroach
db-production/cockroach
dfrsg/cockroach
diegode/cockroach
domluna/cockroach
eagle518/cockroach
easyfmxu/cockroach
eclectice/cockroach
elvin-du/cockroach
embark/cockroach
erriapo/cockroach
es-chow/cockroach
esaul/cockroach
flyingliang/cockroach
gaowenbin/cockroach
ghostsun/cockroach
gqf2008/cockroach
grimreaper/cockroach
gstarnberger/cockroach
gude/cockroach
guiquanz/cockroach
hannibalhuang/cockroach
hanshenu/cockroach
hanwoody/cockroach
hcxiong/cockroach
hollis/cockroach
hubt/cockroach
hunslater/cockroach
iamima/cockroach
icattlecoder/cockroach
ikarzali/cockroach
ilovejs/cockroach
jackylk/cockroach
jamesgraves/cockroach
jamiepg1/cockroach
jay23jack/cockroach
jess-edwards/cockroach
jinguoxing/cockroach
jmank88/cockroach
joezxy/cockroach
joliny/cockroach
jonathanmarvens/cockroach
josephwinston/cockroach
josephyzhou/cockroach
joshuawatson/cockroach
jrcjc123/cockroach
jsanc623/cockroach
kanasite/cockroach
kebohiki/cockroach
kkaneda/cockroach
kortschak/cockroach
kritivasas/cockroach
kuguobing/cockroach
lemonhall/cockroach
leomzhong/cockroach
lessc0de/cockroach
lianhuiwang/cockroach
liuzongquan/cockroach
lostz/cockroach
lshmouse/cockroach
luan-cestari/cockroach
lupengfeige/cockroach
mabdullah353/cockroach
mackjoner/cockroach
maniksurtani/cockroach
manithnuon/cockroach
markreg/cockroach
matadorhong/cockroach
meshileya/cockroach
mindis/cockroach
mixiong/cockroach
mjibson/cockroach
mobilipia/cockroach
mohae/cockroach
mrunix/cockroach
msmakhlouf/cockroach
nanderoo/cockroach
neuroradiology/cockroach
neutony/cockroach
nikelius/cockroach
nimishzynga/cockroach
nkgfirecream/cockroach
nmarasoiu/cockroach
ofonimefrancis/cockroach
oldmantaiter/cockroach
ollyblue/cockroach
petermattis/cockroach
picolonet/storage
pinterb/cockroach
pramendra/cockroach
putaozhuose/cockroach
r00tjimmy/cockroach
ramgtv/cockroach
rayleyva/cockroach
sandeepmukho/cockroach
sawanoboly/cockroach
scrooph/cockroach
sdboyer/cockroach
shafiahmed/cockroach
shanyechen/cockroach
shilezi/cockroach
silky/cockroach
slavau/cockroach
sunya123/cockroach
superneo/cockroach
swarbiv/cockroach
sxhao/cockroach
tamird/cockroach
therob3000/cockroach
timwee/cockroach
tml/cockroach
tomzhang/cockroach
toshisam/cockroach
trebogeer/cockroach
treemantris/cockroach
tristartom/cockroach
truthwzl/cockroach
tschottdorf/cockroach
udybrill/cockroach
umegaya/cockroach
vikram/cockroach
vivekmenezes/cockroach
vvydier/cockroach
waderly/cockroach
walkingsparrow/cockroach
wangtuanjie/cockroach
wheelcomplex/cockroach
willmadison/cockroach
wulinjun4/cockroach
wuyu201321060203/cockroach
wycg1984/cockroach
xiaoyulei/cockroach
yacki/cockroach
yananzhi/cockroach
yangyaoweng/cockroach
yanniyang/cockroach
yekeqiang/cockroach
yemaocheng/cockroach
yonglehou/cockroach
zeeshanali/cockroach
zhaixuezhong/cockroach
zhangchn/cockroach
zhanglei/cockroach
zhonghai/cockroach
zimmermamc/cockroach
zofuthan/cockroach
Nothing to show
Checking mergeability… Don’t worry, you can still create the pull request.
Commits on May 04, 2017
1.0rc2 cherrypick: sql, distsql: don't create unnecessary ident aggre…
…gators

Cherrypicking #15688 for #15660

The groupNode code was creating unnecessary `IdentAggregators`, even for
constant values. This is not only inefficient, but it doesn't work
correctly in the case where there are no rows to be processed.

Fixes #15686.
Updates #12525.
1.0rc2 cherrypick: server: let periodic reporter manage periodic stat…
…s reset

Cherrypick #15570 for #15660

letting the executor run its own periodic stats clear would potentially
allow a clear immediately before a report to result in an empty, useless report.

combining the reset into the existing loop lets us ensure reports happen
before resets.
server: add uptime to diagnostic metrics report
server: pass `now` to periodic check helpers -- passing in `now` should make these easier to test.
server: pull mocked reporting server into helper
Merge pull request #15698 from cockroachdb/marc/cherry_pick_15679
server: change default value for metrics reporting
Merge pull request #15701 from cockroachdb/marc/cherrypick_15570
1.0rc2 cherrypick: server: let periodic reporter manage periodic stat…
Merge pull request #15699 from cockroachdb/marc/cherry_pick_15688
1.0rc2 cherrypick: sql, distsql: don't create unnecessary ident aggre…
1.0rc2 cherrypick: build: disable jemalloc profiling in musl builds
Cherrypick #15675 for #15660.

Seems like a reasonable fix, and we're also picking other release-upload
changes.
1.0rc2 cherrypick: cmd/release-upload: suffix windows binaries with .exe
Cherrypick #15676 for #15660
We're picking up other release-upload changes.
Merge pull request #15703 from cockroachdb/marc/cherrypick_15675
1.0rc2 cherrypick: build: disable jemalloc profiling in musl builds
Merge pull request #15704 from cockroachdb/marc/cherrypick_15676
1.0rc2 cherrypick: cmd/release-upload: suffix windows binaries with .exe
1.0rc2 cherrypick: build: switch release-upload on whether a tag is p…
…resent

Cherrypick #15694 for #15660.

Release builds currently operate in two modes: the bleeding-edge mode
where the latest binary on master is built, and the actual release mode
where binaries for a tagged SHA are built. To allow for multiple release
branches, check for the presence of a tag instead of hardcoding that
"master" means bleeding-edge mode. Now, the presence of a tag means
actual release mode, and the lack of a tag means bleeding-edge mode.

Additionally upload non-master bleeding-edge binaries to a subfolder of
the "cockroach" bucket.

Since these scripts build and upload bleeding-edge binaries, not just
release binaries, also update their names to "publish-artifacts" to
better reflect their purpose.
Merge pull request #15706 from cockroachdb/marc/cherrypick_15694
1.0rc2 cherrypick: build: switch release-upload on whether a tag is p…
Commits on May 08, 2017
1.0X cherrypick: build: allow custom bucket name for binaries
Cherrypicking #15757.

We really need to test the entire binary-building pipeline for releases.
We can simply duplicate the teamcity build rule with
"--bucket=binaries-test.cockroachdb.com".
1.0X cherrypick: build: allow archive Makefile vars to be overriden o…
…n the command line

Cherry-picking #15718.

When building the source archive, Make magically propagates the values
of `prefix`, `bindir`, and `INSTALL` down to the root Makefile.
However, since they're not listed in build/variables.mk, the root
Makefile will quit with a "variable not recognized" error if they're
overriden on the command line. This means it's impossible to run `make
install prefix=/not/usr/local` in the source archive.

Fix this by listing build/archive/contents/Makefile as a file to
consider when generating build/variables.mk.
1.0X cherrypick: cmd/publish-artifacts: properly seek to start of file
Cherrypicking #15731.

Fixes an issue where the Windows "latest" archive was empty because the
binary file wasn't being correctly rewound after the versioned archived
was written on Windows.

Closes #15727.
Merge pull request #15758 from cockroachdb/marc/cherrypick_15718
1.0X cherrypick: build: allow archive Makefile vars to be overriden o…
Merge pull request #15759 from cockroachdb/marc/cherrypick_15731
1.0X cherrypick: cmd/publish-artifacts: properly seek to start of file
Merge pull request #15762 from cockroachdb/marc/cherrypick_15757
1.0X cherrypick: build: allow custom bucket name for binaries
1.0x cherrypick: build: separate S3 binary upload from docker.
Cherrypicking #15768

This is to be able to call just the S3 upload from the test release
pipeline.
Merge pull request #15776 from cockroachdb/marc/cherrypick_15768
1.0x cherrypick: build: separate S3 binary upload from docker.
Commits on May 09, 2017
Merge pull request #15784 from a-robinson/cherrypick_15781
1.0x cherrypick: storage: Add env var for configuring raft election timeout ticks
Commits on May 15, 2017
1.0.1 cherrypick: cli: don't prompt for password twice when using it.
Cherrypick #15690 for 1.0.1

Fixes #15656

We used the same function to prompt for a password when setting it and
when using it.
This resulted in password prompts to setup a connection to ask for it
twice which is just plain silly.

Instead, split the function into two, only prompting twice when setting
a password.

We really need a test for all this stuff. The stdin behavior means that
we'll want to use the interactive tests. I'll try to add it to this PR,
this will ideally go into 1.0.
Merge pull request #15919 from cockroachdb/marc/cherrypick_15690
1.0.1 cherrypick: cli: don't prompt for password twice when using it.
David Eisenstat and mberhault
sql: allow CREATE USER WITH PASSWORD from CLI transaction
The CLI parses and serializes the CREATE USER statement before sending
it to the server, which previously caused the password string to be
redacted by stars.

This commit is part of a push to ensure that Serialize is a right
inverse for Parse.
sql: fix two problems with groupNode optimization for MIN/MAX
This commit fixes the two problems described in #15725:
 - we don't always apply the IS NOT NULL constraint when we use the single-row
   optimization.
 - we incorrectly use the optimization when there is a GROUP BY.

Fixes #15725.
Merge pull request #15911 from cockroachdb/marc/cp_15693
cherrypick: sql: allow CREATE USER WITH PASSWORD from CLI trans…
log: make symlinks best-effort
On Windows, symlink creation requires special privileges[0]. To avoid
unexpected and unnecessary failures there, make our symlink creation
failures log to stderr instead of taking down the process.

Fixes #15814.

[0] https://docs.microsoft.com/en-us/windows/device-security/security-policy-settings/create-symbolic-links
ui: include favicons
Our favicons are generated into a subdirectory in pkg/ui/dist, which
our go-bindata invocation was not previously including, resulting in
missing favicons for our users! Fixed by adding the elipsis postfix as
described in the go-bindata readme.

Fixes #15891.
log: eagerly panic on missing Windows APIs
This provides a more descriptive error message to the user than the
panic which occurs when time.Now is first called (likely with a bunch
of other goroutines flying around).

Closes #15887.
Merge pull request #15912 from cockroachdb/marc/cherrypick_15735
cherrypick: sql: fix two problems with groupNode optimization for MIN/MAX
server: catch incomplete available memory detection by gosigar
If gosigar is told by a syscall there is 0 available memory, consider
this information as false even if there was no error.

Upstream issue: elastic/gosigar#72
sql: fix panic on creation of views with arrays
Previously, the view creation code couldn't cleanly handle unsupported
column types.
Merge pull request #15920 from cockroachdb/marc/cherrypick_15901
cherrypick: log: eagerly panic on missing Windows APIs
Merge pull request #15913 from cockroachdb/marc/cherrypick_15804
cherrypick: sql: fix panic on creation of views with arrays
Merge pull request #15914 from cockroachdb/marc/cherrypick_15841
cherrypick: server: catch incomplete available memory detection by gosigar
Merge pull request #15924 from cockroachdb/marc/cherrypick_15724
cherrypick: server: make the --insecure warning more explicit.
sql/parser: avoid float -> unsigned conversions
While investigating this, I discovered that our current `round`
implementation is quite dubious, and does not rely on any referenced
source material or any material that I could find. I also found that
Postgres does not implement 2-ary `round` where the first argument is
a float.

The above is addressed by:
- replacing `round(float)` with a transcription of Postgres' `rint`.
- replacing `round(float, int)` with an implementation that round-trips
  through apd. This is likely much slower, but likely correct.

Updates #14405.
Merge pull request #15915 from cockroachdb/marc/cherrypick_15847
cherrypick: sql/parser: avoid float -> unsigned conversions
David Eisenstat and mberhault
sql/parser: use encodeSQLIdent for locales
In case the locale happens to be a reserved identifier.
David Eisenstat and mberhault
parser: parse collation locales properly
Previously, the parser introduced unwanted quotes for locales that are
not normalized identifiers. BCP 47 locales do not contain dots (`.`), so
the switch from `any_name` to `unrestricted_name` will not affect any
valid SQL statements.
Merge pull request #15917 from cockroachdb/marc/cherrypick_15879
cherrypick: parser: parse collation locales properly
gossip: Fix updateNodeAddress to not ignore certain updates
Previously, if node b moved to node c's address (effectively
replacing node c), existing nodes would not remove node c's descriptor
from gossip because node b's ID was already known. This could cause
problems upon node restart, because the restarting node would be given
two node descriptors for the same address, which could cause panics if
it processed them before initializing its own node ID.

Fixes #15856
Commits on May 16, 2017
Merge pull request #15937 from cockroachdb/marc/cherrypick_15928
cherrypick: gossip: Fix updateNodeAddress to not ignore certain updates
build: disable RocksDB assertions, except on race builds
In the transition to the new Make-based build system for C dependencies
(4d72e12), RocksDB assertions were inadvertently enabled for all builds.
Restore the old behavior, which only enabled assertions for race builds
(cockroachdb/c-rocksdb#27).

Fixes #15604.
Merge pull request #15955 from cockroachdb/marc/cherrypick_15943
cherrypic: build: disable RocksDB assertions, except on race builds
Merge pull request #15960 from cockroachdb/marc/cherrypick_15952
cherrypick: c-deps: fix RocksDB on Windows without assertions
kv: rename DistSQLRetryableError to UnhandledRetryableError
This recognizes that DistSQLRetryableError were seen by layers above the
TxnCoordSender for non-transactional request. The previous thinking had
been that the TxnCoordSender converts all lower-level retryable errors
into HandledRetryableError, but that wasn't the case for
non-transactional requests.

This also adds a test for retryable errors in non-transactional
requests.
server: retry store id allocation on the correct error
Fixes #15870

The code was retrying on an error only meant for transactional requests,
even though it was performing non-transactional requests.
Commits on May 17, 2017
Merge pull request #15969 from cockroachdb/marc/cherrypick_15925
cherrypick: sql: prevent scanNode from returning more rows than its hardLimit.
Merge pull request #15973 from andreimatei/release-1.0
cherrypick: server: retry store id allocation on the correct error
sql: don't try to drop views twice
Previously, if a single view depended on the same table twice via a
union, or if a single view depended on multiple tables, dropping the
database that contained them would fail because the drop routine would
try to drop the view more than once.
Merge pull request #15983 from cockroachdb/marc/cherrypick_15968
cherrypick: sql: don't try to drop views twice
David Eisenstat and mberhault
sql: propagate view names to dataSourceInfo
It is currently impossible to fully qualify a column that comes from a
view, e.g.,

    root@:26257/test> CREATE TABLE test (a int, b int);
    CREATE TABLE
    root@:26257/test> CREATE VIEW Caps AS SELECT a, b FROM test;
    CREATE VIEW
    root@:26257/test> SELECT sum(Caps.a) FROM Caps GROUP BY b;
    pq: source name "caps" not found in FROM clause

This is because the view gets replaced by an anonymous subquery. Give
the dataSourceInfo corresponding to that subquery its proper name.

Fixes #15951.
Merge pull request #15984 from cockroachdb/marc/cherrypick_15974
cherrypick: sql: propagate view names to dataSourceInfo
storage: overhaul GCQueue.shouldQueue
TL;DR: use a scale-invariant `shouldQueue` for the GC Queue to avoid it running
in a tight loop without actually deleting anything. Adjust this scalable score
so that GC is delayed when a large proportion of the data in the replica is
live. Slightly perturb returned scores to avoid groups of replicas becoming
eligible for GC at the same time repeatedly.

Closes #15897.

--

When a key of size `B` is deleted at timestamp `T` or superseded by a newer
version, it henceforth is accounted for in the range's `GCBytesAge`. At time
`S`, its contribution to age will be `B*seconds(S-T)`. The aggregate
`GCBytesAge` of all deleted versions in the cluster is what the GC queue at
the time of writing bases its `shouldQueue` method on.

If a replica is queued to have its old values garbage collected, its contents
are scanned. However, the values which are deleted follow a criterion that
isn't immediately connected to `GCBytesAge`: We (basically) delete everything
that's older than the Replica's `TTLSeconds`.

Thus, it's not obvious that garbage collection has the effect of reducing the
metric that we use to consider the replica for the next GC cycle, and it seems
that we messed it up.

The previous metric used for queueing: `GCBytesAge/(1<<20 * ttl)` does not
have the right scaling. For example, consider that a value of size `1mb` is
overwritten with a newer version. After `ttl` seconds, it contributes `1mb` to
`GCBytesAge`, and so the replica has a score of `1`, i.e. (roughly) the range
becomes interesting to the GC queue. When GC runs, it will delete value that
are `ttl` old, which our value is. But a Replica is ~64mb, so picture that
you have 64mb of key-value data all at the same timestamp, and they become
superseded. Already after `ttl/64`, the metric becomes 1, but they keys won't
be GC'able for another (63*ttl)/64. Thus, GC will run "all the time" long
before it can actually have an effect.

The metric with correct scaling must thus take into account the size of the
range. What size exactly? Any data that isn't live (i.e. isn't readable by
a scan from the far future). That's `KeyBytes + ms.ValBytes - ms.LiveBytes`,
which is also known as `GCBytes` in the code. Hence, the better metric is
`GCBytesAge/(ttl*GCBytes)`.

Using this metric guarantees that after truncation, `GCBytesAge` is at most
`ttl*GCBytes` (where `GCBytes` has been updated), i.e. the new metric is at
most 1.

To visualize this, picture a rectangular frame of width `ttl` and height
`GCBytes` (i.e. the horizontal dimension is time, the vertical one bytes),
where the right boundary of the frame corresponds to age zero.
Each non-live key is a domino aligned with the right side of the frame, its
width equal to its size, and its height given by the duration (in seconds) it's
been non-live.

The combined surface of the dominos is then `GCBytesAge`, and the claim is that
if the total sum of domino heights (i.e. sizes) is `GCBytes`, and the surface
is larger than `ttl*GCBytes` by some positive `X`, then after removing the
dominos that cross the line `x=-ttl` (i.e. `ttl` to the left from the right
side of the frame), at least a surface area of `X` has been removed.

```           x=-ttl                 GCBytes=1+4
                |           3 (age)
                |          +-------+
                |          | keep  | 1 (bytes)
                |          +-------+
           +-----------------------+
           |                       |
           |        remove         | 3 (bytes)
           |                       |
           +-----------------------+
                |   7 (age)
```

This is true because

```
deletable area  = total area       - nondeletable area
                = X + ttl*GCBytes  - nondeletable area
               >= X + ttl*GCBytes  - ttl*(bytes in nondeletable area)
                = X + ttl*(GCBytes - bytes in nondeletable area)
               >= X.
```

Or, in other words, you can only hope to put `ttl*GCBytes` of area in the
"safe" rectangle. Once you've done that, everything else you put is going to be
deleted.

This means that running GC will always result in a `GCBytesAge` of `<=
ttl*GCBytes`, and that a decent trigger for GC is a multiple of `ttl*GCBytes`.

Limitations:

- The intent portion of `shouldQueue` could be another time bomb if it fires
  continuously for some reason.
Merge pull request #16006 from cockroachdb/marc/cherrypick_15897
cherrypick: storage: overhaul GCQueue.shouldQueue
Commits on May 18, 2017
Merge pull request #16012 from cockroachdb/marc/cherrypick_16003
cherrypick: ui: Fix js time formatting - print seconds, not fractional seconds
sql: fix panic in generators with null arguments
Previously, null arguments to generate_series or unnest could produce
panics.
Merge pull request #16017 from cockroachdb/marc/cherrypick_15992
cherrypick: sql: fix panic in generators with null arguments
sql: bugfix in FuncExpr.CopyNode
Previously, `FuncExpr.CopyNode` contained a bug that caused the copy to
share the `WindowDef` of the original expression, which caused
`FuncExprs` to no longer be immutable if they were copied and their
`WindowDef` modified.
storage: extract error from assertReplicaState
The 1.0.1 ship may already have sailed, but if it has not,
then let us consider whether we want to get this in to get
more information on #16004 in the wild.
Merge pull request #16022 from cockroachdb/marc/cherrypick_16013
cherrypick: storage: extract error from assertReplicaState
storage: panic instead of Fatal to surface assertion
I messed this up in #16013 and changed the handler for `panic`, not
the one for `Fatal`. Instead of trying to fumble another set of edits,
I think it is acceptable to panic on this particular error for 1.0.1,
which should properly get us what we want sent to sentry.io.
Merge pull request #16027 from cockroachdb/marc/cherrypick_16025
storage: panic instead of Fatal to surface assertion
Commits on May 30, 2017
cmd: fix archive headers.
Use FileInfoHeader rather than manually filling in the header.
This ensures that all appropriate fields are set.

Prior to this, timestamps are all zero, resulting in silly `ls` outputs.
cli: Fix handling of unset system range zone config fields
We need to fall back to the default zone config if they aren't fully
specified.
Merge pull request #16212 from a-robinson/release-1.0
cherrypick: cli: Fix handling of unset system range zone config fields
tracing: fix snowball tracing when tracing disabled
Snowball tracing is used for `EXPLAIN (TRACE)` and
`sql.trace.txn.enable_threshold` and it does not work when tracing is disabled
(which is the default).

The problem is in `JoinRemoteTrace`: when tracing is disabled, the `Tracer` we
get is a `NoopTracer` which can't `Extract` the context. Fix this by using a
separate basictracer just for extraction.

Also improve `TestExplainTrace` to use a cluster and to test with tracing both
enabled and disabled. Verified the test fails without the rest of the change.

Verified that lightstep traces still work.

Fixes #16035.
storage: only down-replicate if a replacement is available
Only down-replicate for removal of a replica on a dead node if a
suitable replacement target exists.

Fixes #16097
storage: disable key access assertions in non-race builds #16131
Discovered in #16068. Using a SpanSetBatch incurs a `O(#spans)` overhead for
each engine operation, which quickly results in quadratic runtime for Raft
command evaluation.

Benchmark:

```
make bench PKG=./pkg/sql/ BENCHES='BenchmarkSQL/^Cockroach/Insert$$/count=100' TESTFLAGS='-count 10 -cpuprofile cpu.out -benchmem' 2>/dev/null | tee $(git rev-parse HEAD)
```

```
benchstat 61d1ee4 ad1116d
name                               old time/op    new time/op    delta
SQL/Cockroach/Insert/count=100-4     2.50ms ±14%    2.28ms ±31%   -8.53%  (p=0.013 n=10+9)
SQL/Cockroach/Insert/count=1000-4    33.5ms ± 7%    18.4ms ±17%  -45.19%  (p=0.000 n=10+10)

name                               old alloc/op   new alloc/op   delta
SQL/Cockroach/Insert/count=100-4     1.13MB ± 1%    1.13MB ± 1%     ~     (p=0.190 n=10+10)
SQL/Cockroach/Insert/count=1000-4    10.7MB ± 2%    10.5MB ± 0%   -1.89%  (p=0.000 n=10+10)

name                               old allocs/op  new allocs/op  delta
SQL/Cockroach/Insert/count=100-4      2.91k ±37%     2.91k ±34%     ~     (p=0.670 n=10+10)
SQL/Cockroach/Insert/count=1000-4     30.4k ±34%     20.7k ± 0%  -31.94%  (p=0.000 n=10+7)
```
Merge pull request #16219 from tschottdorf/cp-disable-assertions
cherry-pick: storage: disable key access assertions in non-race builds #16131
knz
Commits on May 31, 2017
knz
Merge pull request #16221 from knz/cherry_pick_16209
cherry-pick: server: report more configuration upon initialization.
Merge pull request #16218 from petermattis/pmattis/cherrypick_16139
cherry-pick: storage: only down-replicate if a replacement is available
Merge pull request #16217 from RaduBerinde/radu/cherrypick_16036
cherrypick: tracing: fix snowball tracing when tracing disabled
cherry-pick: storage: declare fewer spans during GC
If a GCRequest does not modify the GC threshold timestamps, it does
not need to declare their keys. This is useful because it allows the
GC queue to send a very small request with the threshold adjustments
first, and then a larger request that does not need to declare the
threshold keys and does less harm if it's slow.

We should additionally limit the size of each "big" `GCRequest`, but
that fits well in a follow-up PR.

cc @cockroachdb/release
Merge pull request #16231 from tschottdorf/cp-queue-deblock
cherry-pick: storage: declare fewer spans during GC
dt
log: pass runtime.Error through crash reports
panics thrown by the runtime itself are usually tagged with the RuntimeError method so they
implement the runtime.Error interface.
Merge pull request #16244 from a-robinson/cherrypick_16224
cherrypick: migrations: Handle CPut unexpected value errors gracefully
Commits on Jun 01, 2017
dt
Merge pull request #16248 from dt/panic
cherrypick: log: pass runtime.Error through crash reports
Commits on Jun 02, 2017
encoding: correct large decimal decoding
The nonsorting decimal value encode method uses binary.PutUvarint
to encode the length encoded. The decode path was using
DecodeNonsortingUvarint, which is different but happened to be correct
for values < 0x80 (which is most decimals, luckily). Add a correct
decode function and use it correctly in the decode and peek functions.

Rename functions so they describe if they use the Stdlib binary
methods to encode or decode.

Fixes #16081
Commits on Jun 05, 2017
knz
sql: fix the behavior of DISTINCT
Prior to this patch, distinctNode would incorrectly propagate the flag
that indicates whether data was needed for columns from its consumer
to its source. This is incorrect because distinctNode itself needs
data for *all* columns to bucket the unique values.

This patch addresses the issue by ensuring all columns of the source
are marked as "needed".
sql: fix two OFFSET bugs in distsql
1. In distsql physical planning for a limit, we were erroneously
adjusting the limit when there was an OFFSET, in one case.
2. At runtime, the sorter processor was not correctly accounting for an
OFFSET when configuring a limit on the top-K sorting strategy.

Fixes #16090
distsqlrun: remane sorter.limit to sorter.count
... to distance from the SQL syntax LIMIT.
dt
sql: don't try to add index in ALTER...ADD FK
ALTER...ADD FOREIGN KEY reuses the index resolution and modification logic used in CREATE TABLE...FOREIGN KEY.

However, as of 668f3c7, that logic included *adding* the required source index to the table if it didn't exist.
This is fine during CREATE TABLE, but is *not* fine for an existing table, when index additions need to go though
the schema change process to be staged, backfilled, etc correctly.
sql/pgwire: unify pgwire/datum date parsing code
Previously, pgwire had a separate timestamp parsing routine from the one
used by normal datum parsing. This produced inconsistencies where some
timestamps could be parsed in normal SQL execution but not pgwire
prepared statement execution.

Now, pgwire delegates to `ParseDTimestamp` and `ParseDTimestampTZ`
instead of its own parser.

Date parsing is now unified with timestamp and timestamptz parsing as
well, eliminating another potential source of parse inconsistencies.
Merge pull request #16284 from mjibson/cherrypick-16152
cherrypick: encoding: correct large decimal decoding
Merge pull request #16326 from justinj/int2vec-cherrypick
cherrypick: sql: INT2VECTOR should be 0-indexed
knz
Merge pull request #16318 from knz/20170605-merge-16307
cherrypick: sql: fix the behavior of DISTINCT
storage: adjust {declined,failed} reservation timeouts
The declined and failed reservation timeouts were unintentionally
flipped in #15619 which accidentally fixed #15370. The fix was due to
using a non-zero timeout for declined reservations. Revert #15619 but
provide a 1s timeout for declined reservations.

Fixes #15370
sql: error on result type changes in prepared statements
Fix a panic when the number of results change in a pgwire prepared
statement. This is not the full fix for this bug, but it is the most
we have decided to do for the 1.0 branch. This adds a few known bugs,
all of which are fixed in the master branch:

1. Prepared statements of the form `INSERT ... RETURNING *` where a
schema change is done after the prepare act inconsistently. They will
succeed to write the data, but also return an error if the number of
columns has increased. If the number of columns is the same but the
types have changed, they will write the data and not return an error.
2. PREPARE/EXECUTE statements (that is, statements where PREPARE
and EXECUTE appear in the text of the statement) incorrectly allow
changes in result types due to schema changes between executions.

Fixes #16062
See #16089 for the full fix
Merge pull request #16327 from jordanlewis/cherrypick-16049
cherrypick: sql/pgwire: unify pgwire/datum date parsing code
dt
Merge pull request #16333 from dt/cherrypick-fkidx
cherrypick: sql: don't try to add index in ALTER...ADD FK
Merge pull request #16328 from petermattis/pmattis/cherry-pick-16325
cherrypick: storage: adjust {declined,failed} reservation timeouts
Merge pull request #16330 from tamird/cherrypick-16133
cherrypick: build: upgrade to go1.8.3
Merge pull request #16335 from mjibson/cherrypick-16089
sql: error on result type changes in prepared statements
sql: fix limit + index-join bug
If we have a limit that needs to be applied *after* the index join, it is
incorrect to set a hard limit on the index scan. This change fixes this by
checking the filter in the table node. Note that this bug existed for a while
but it only had functional consequences since #15925.

Fixes #16313.
Merge pull request #16315 from andreimatei/release-1.0
cherrypick: sql: fix two OFFSET bugs in distsql
Commits on Jun 06, 2017
Merge pull request #16353 from a-robinson/cherrypick_16347
cherrypick: storage: Don't require system config for all types of queues
sql: allow BEGIN READ WRITE
lib/pq recently added support for the Go 1.8 txn options, which
include a field for read only/write transactions. In the default
(read write) case, the string "READ WRITE" is added to the BEGIN
statement. Add workaround support for this syntax by ignoring it,
since it doesn't change anything. A complete fix for this will be
added to the master branch later.

See #16309
Commits on Jun 07, 2017
build: only push docker images in the release build
This introduces some coupling to TeamCity, but this stuff is already
quite tightly coupled.

Closes #16267.
Merge pull request #16374 from a-robinson/cherrypick_16279
cherrypick:build: only push docker images in the release build
sqlccl: actually sanitize backup descriptions
We weren't properly sanitizing credentials in incremental URLs.
Merge pull request #16386 from benesch/cherrypick_16370
cherrypick: sqlccl: actually sanitize backup descriptions
Commits on Jun 10, 2017
pkg/sql: group by mutation bugfix
Previously, the `GROUP BY` planner would erroneously store the typed
version of its `HAVING` clause back on its original parsed AST. It's
invalid to mutate the original parsed AST.
Commits on Jun 12, 2017
Merge pull request #16444 from jordanlewis/cherry-pick-16434
cherry-pick: pkg/sql: group by mutation bugfix
sql: regtype casts now use the full type parser
Previously, string casts to regtype such as 'foo'::regtype used a custom
parser to match the string with the correct type OID. This led to a few
problems, such as missing the mapping for longer type names such as
`character varying` as well as improperly parsing parameterized types
such as `decimal(10,2)`.

Rather than fix our separate parser, we now just delegate this type
parsing to the full SQL parser and interpret the results.

If our standard type parser fails, we fall back to the previous method
of searching pg_type. That's required since we don't provide syntax for
every type whose OID we understand - such as `float4`.
Merge pull request #16480 from jordanlewis/cherry-pick-16476
cherrypick: sql: regtype casts now use the full type parser
Commits on Jun 13, 2017
cherry-pick: sql: support set client_encoding='unicode'
PostgreSQL treats this as a synonym to utf8 - we should too.
Commits on Jun 14, 2017
Merge pull request #16513 from jordanlewis/cherry-pick-16511
cherry-pick: sql: support set client_encoding='unicode'
Commits on Jun 20, 2017
knz
knz
Merge pull request #16617 from knz/20170620-cherrypick-16616
cherrypick: pgerror: fix a string formatting bug
cherrypick: sql: add missing IN tuple op for OIDs
Previously, users couldn't evaluate expressions that checked if an OID
value was inside of an OID tuple. This omission was an accident and is
now corrected.
Merge pull request #16645 from jordanlewis/cherry-pick-oid-tuple-cmp
cherrypick: sql: add missing IN tuple op for OIDs
Commits on Jun 26, 2017
storage: fix maintenance of TimestampCache.bytes
We were failing to update TimestampCache.bytes correctly when performing
in-place modifications of cache entries.

Fixes #15950
Commits on Jun 27, 2017
Merge pull request #16711 from petermattis/pmattis/cherrypick_16503
cherry-pick: storage: fix maintenance of TimestampCache.bytes
storage/engine: Limit batch size in MVCC GC
When there is a lot of garbage to collect, a single run of
MVCCGarbageCollect on the node liveness range can last long enough
that leases expire, leading to cascading unavailability.

Fixes #16565
Merge pull request #16735 from bdarnell/cherrypick-gc-limit
cherrypick: storage/engine: Limit batch size in MVCC GC
storage: Resolve intents in batches
When a transaction commits, it tries to resolve all the intents it
wrote in a single call to resolveIntents. The DistSender takes this
batch and splits it up into one batch per range, inserting
NoopRequests, leading to quadratic memory usage (mainly because the
RequestUnion that wraps around the NoopRequest is huge). This has been
observed as a problem in production environments.

Mitigate this by splitting intents into reasonably-sized batches. This
is a quick fix intended for 1.0.3.
storage: wait long enough in resolveIntents
The previous code would release the WaitGroup before passing the
error to the channel, which means that the caller would be very
likely to never receive it. Luckily, this was caught in #16684
and is fixed in this commit. The bug was introduced in #16632.

`make stressrace PKG=./pkg/storage TESTS=TestEndTransactionDirectGCFailure`
would fail within the first 30 iters quickly before this change. Passes now.

Fixes #16684.
cherry-rewrite: storage: sprinkle log events through push txn queue
Motivated by reports of a user about transactions getting stuck
in the PushTxnQueue which will be easier to diagnose with this
additional information.

Had to rewrite this a bunch due to the enhancements that have landed
on master but not here. Consider this new code.
Merge pull request #16739 from bdarnell/cherrypick-intent-batch
cherry-pick: storage: Resolve intents in batches
Commits on Jun 28, 2017
knz
sql: fix a latent panic in the handling of UNION
If a unionNode was Close()d before it had exhausted its source operands
(in particular when EXPLAIN is applied on a UNION), the source operands
would not be both Close()d properly.

This would in turn cause a memory reporting leak, and subsequently an
assertion panic that the memory was not de-registered properly.
storage: don't perform intent resolution after a failed Raft application
This patch fixes a bug causing us to erroneously resolve intents when
the application of a Raft command returned an error. This meant that we
could have an erroring EndTransaction application, and still commit the
transaction's data.

Fixes #16724
Merge pull request #16775 from andreimatei/release-1.0
cherry-pick: storage: don't perform intent resolution after a failed Raft application
Merge pull request #16741 from tschottdorf/traces
cherry-rewrite: storage: sprinkle log events through push txn queue
Commits on Jun 29, 2017
knz
Merge pull request #16761 from knz/20170628-cherrypick-16757
cherrypick: sql: fix a latent panic in the handling of UNION
sql/parser: regclass casts must normalize input
Previously, table name inputs to regclass casts were not properly
normalized, leading to improper behavior. Table names that were not all
lowercase were not selectable via regclass casts unless they were
manually lowercased.
Merge pull request #16792 from jordanlewis/cherry-pick-regclass-fix
cherry-pick: sql/parser: regclass casts must normalize input
Commits on Jul 05, 2017
knz
sql: handle special characters in view column names
Prior to this patch, view descriptors would not be properly validated
if the source table's columns had names containing special characters.

This patch alleviates the issue by enforcing the proper escaping
mechanism.

Fixes #16813.
knz
sql: clean up IndexedVars, fix bug in CREATE TABLE AS
This patch changes the code that binds IndexedVars to a container to
ensure that only freshly-allocated IndexedVars are modified in-place.
The other container-less use of IndexedVars, namely ordinal references
of the form @n in the input syntax, are not any more modified
in-place; the BindIfUnbound method now returns a freshly allocated
object for those.

This in turn ensures that expressions coming from statements
containing ordinal references are not modified in-place, and become
suitable for multiple processing by analyzeExpr in different plan
contexts (previously, it was safe only when the same IndexedVar was
used in multiple expressions in the same plan context).

This in turns fixes a panic inducing bug in the handling of CREATE
TABLE AS, when the source select contained ordinal references.

Fixes #16814.
Commits on Jul 06, 2017
build: remove snappy build directory when rebuilding
This prevents cache pollution issues which are currently preventing
releases from building.
Merge pull request #16894 from tamird/remove-snappy-junk
build: remove snappy build directory when rebuilding
Commits on Jul 07, 2017
knz
Merge pull request #16783 from knz/20170629-cherrypick-16782
cherrypick: sql: restore sanity in the handling of special column names (#16815)
sql: accept ROLLBACK TO SAVEPOINT after any error
Before this patch, we accepted ROLLBACK TO SAVEPOINT after a retryable
error, or when the transaction was not in an error state. We did not
accept it if the sql txn was in the Aborted state (so, after a
non-retryable error). This was likely an oversight in #14538. Besides
consistency, this change is motivated by the desire of some client
libraries (the python one?) to always issue a ROLLBACK TO SAVEPOINT on
any error, and possibly follow it with a ROLLBACK on non-retryable
errors.

Touches cockroachdb/cockroachdb-python#27
Commits on Jul 11, 2017
knz
Merge pull request #16932 from knz/20170707-cherrypick-16846
cherrypick: sql: accept ROLLBACK TO SAVEPOINT after any error
build: hardcode a known-good version of jsdoc
Through a multitude of issues in protobufjs, we are now experiencing
an issue where `pbts` randomly produces truncated partial output; the
primary culprit is dcodeIO/protobuf.js#716 -
protobufjs' CLI tools are overly clever in trying to minimize their
dependency surface, and do so by running `npm install` directly when
invoked (!!!). Somewhat predictably, since these packages are not
pinned by yarn in the way that all other packages are, we are now
seeing their versions float, leading to the proximate cause, which is
jsdoc moving to 3.5.0. For an undiagnosed reason, jsdoc 3.5.0 doesn't
cooperate with the way it is called from `pbts` (which is by shelling
out (!)).
Merge pull request #16981 from tamird/release-fix-js
cherry-pick: build: hardcode a known-good version of jsdoc
Commits on Jul 18, 2017
dt
sql: avoid mixing/clobbering reported stats buckets
previously we were iterating over collected stats and filling collected stats buckets by query.
unfortunately in doing so, we were ignoring the other flags (failed, distsql) that are used in
collection buckets, and thus only the last collection bucket as randomly iterated would be
reported for a given query.

in 1.1, this is fixed by just reporting all buckets as a list, structured. That was part of
a larger change though (protobuf-strucutured reporting, #16955). This is a much smaller change,
just mangling the string bucket keys by prepending single-char identifiers for the distsql and
failed flags, thus ensuring distinct keys.
dt
Merge pull request #17085 from dt/stats-backport
sql: avoid mixing/clobbering reported stats buckets
knz
sql: ensure that planToString doesn't cause panics with subqueries (a…
…gain)

(This bug only affects users running with --verbosity 3 or
--vmodule=plan=3.)

planToString really would like to print out a representation of the
logical plan containing the results of type checking. Now, when an
expression inside a logical plan contains a subquery, planToString()
must show a representation of this subquery *despite the fact that the
AST for the subquery was not modified by type checking*. There was a
bug in there, and this patch fixes it.

Some more details: consider that the result of type checking lives in
the logical plan for the subquery, not the input AST. For a subquery,
the AST and the subquery plan are two different things living
side-by-side inside the expression (as a sql.subquery{...} node). The
types inside the subquery are part of the subquery plan, not the
subquery AST.

For example, with `SELECT 1 WHERE 2 = (SELECT k IN kv)` the logical
plan contains a filter expression `2 = (...)` containing a subquery
`SELECT k in kv`. In the expression node (a `ComparisonExpr`) there is
a `subquery` node containing both the AST for `SELECT k in kv` and a
logical plan (a table scan with a single-column render).

What should planToString() output for the outer query, if it wants to
display the filter expression *and the types involved in the filter
expression*?

We could let it print just literally "`2[int] = (...)[int]`" ("two
square bracket int square bracket equal parenthesis *dot dot dot*
parenthesis square bracket int square bracket"), eliding the text of
the subquery, and only print the subquery plan below in the "flattened
tree" formatting (as it already does).

However, for the sake of readability, to remind the user that they are
looking at a subquery, planToString() also includes the text
representation of the subquery's SQL, ie. a rendering of its
AST. *However, it cannot request printing of types in that AST's
expressions!* That's because type checking did not modify the subquery
AST - the types live in the subquery plan, which is printed
separately. Requesting the types would cause a call to
`ResolvedType()` on many datums which disable this, as they should, as
an assertion against wrong use of expressions.

Prior to this patch the `Format` method for the `sql.subquery` node
was a bit sloppy about disabling the printing of types. This patch
solves the problem by ensuring that the printing of types in subquery
ASTs is always disabled.
sql/parser: missing case for bool in type switch
This is a partial cherry-pick from master, as we applied the same fix
there.
build: properly bust zcgo_flags_TARGET_TRIPLE.go files
zcgo_flags_TARGET_TRIPLE.go files go stale whenever a C/C++ dependency
is added, whenever a C/C++ dependency moves where it outputs its
libraries, or whenever the Makefile recipe for generating these files is
changed. According to the Makefile, however, they're never out-of-date.
This only worked because we hadn't yet hit any of the staleness
conditions.

On master, however, we upgraded to a version of snappy with a CMake
build system, and so snappy's library output directory changed. This
means switching from master to release-1.0 will result in
zcgo_flags_TARGET_TRIPLE.go files with the wrong library search path.

Fix this by giving zcgo_flags_TARGET_TRIPLE.go a prerequisite on
build/common.mk. This same fix was already applied to master as part of
PR #14840.
Commits on Jul 19, 2017
knz
Merge pull request #17093 from knz/20170718-cherrypick-17090
cherrypick: sql: ensure that planToString doesn't cause panics with subqueries
Merge pull request #17092 from jordanlewis/missing-bool
sql/parser: missing case for bool in type switch
Commits on Jul 20, 2017
Merge pull request #17096 from benesch/release-1.0-zcgo-flags-staleness
build: properly bust zcgo_flags_TARGET_TRIPLE.go files
storage: Update timestamp cache before updating a lease on a replica
- Before we would update the in-memory lease on a replica,
unlock it and then we would update the timestamp cache. This would
allow a replica to start processing requests for a lease without
first having taken into account reads served from the old lease
holder. We could see this by running:
make stress PKG=./pkg/sql/logictest
TESTS=TestParallel/subquery_retry_multinode STRESSFLAGS='-p 32'

This would fail because we would have duplicate values in a table
where inserts should have had monotonically increasing values.

- After this change the test passes. We also updated splitPostApply,
to send the current lease as the previous lease to leasePostApply to
prevent an update to the timestamp cache when a lease hasn't changed
hands.

Closes #16610
Merge pull request #17141 from m-schneider/cherrypickreplicafix
cherry-pick: storage: Update timestamp cache before updating a lease on a replica
Commits on Jul 28, 2017
knz
sql: ensure that planNodes are Close()d on error after expansion
Prior to this patch, if plan expansion would fail (e.g. due to an
expansion-time error like a column requested from a non-covering
index), the plan would be abandoned without being `Close()`d. However,
if the error would occur after some vtable was successfully expanded,
or some other `delayedNode` action causing some Closable state to
appear in the planNode, the abandonment was really a resource leak,
and detected as such with a panic.

This patch addresses the issue by ensuring `Close()` is invoked, even
upon error during plan expansion.
knz
Merge pull request #17281 from knz/20170728-cherrypick-17276
cherrypick: sql: ensure that planNodes are Close()d on error after expansion
Commits on Aug 03, 2017
Commits on Aug 04, 2017
Merge pull request #17385 from tschottdorf/cp-sendnext-10m
cherry-pick: base: bump DefaultSendNextTimeout from 500ms to 10m
Commits on Aug 15, 2017
security: Disable 3DES cipher suites
We require TLS 1.2, so these cipher suites will never be selected by a
regular peer. However, the fact that these ciphers are enabled can be
detected by security scanning software and is sometimes reported as a
vulnerability.

See https://forum.cockroachlabs.com/t/ssl-listeners-supported-ciphers-config/835
Merge pull request #17654 from bdarnell/cherry-pick-3des
cherrypick: security: Disable 3DES cipher suites
cherrypick: sql: bugfix to fks that use a partial index
Previously, tables with foreign key references that were a prefix of a
pre-existing index could have their foreign key constraints violated by
deletion from the referenced table.

This means that any tables created on 1.0 (and earlier) versions with
foreign key constraints on an index prefix might have constraint
violations if rows were deleted from the referenced table.

The tests missed this case because of an unhappy coincidence - the
proximal cause of the failure mode was that the key into the referencing
index was encoded with the full length of the referencing index, even
though the foreign key itself had less columns that that index. This
caused the key to contain `NULL` values at the end. The test case that
was supposed to guard against this problem had `NULL` values in the
referencing value at the end positions of the key, so a match was found
and the deletion was prevented.
cherrypick: sql: bugfix in SHOW CREATE TABLE for some fks
Previously, a table with a foreign key constraint on a set of columns
that's a prefix to a pre-existing index on that table had incorrect
output for `SHOW CREATE TABLE`. The output claimed that the foreign key
constraint included all of the columns of the index, instead of just the
correct prefix of it.
Merge pull request #17653 from jordanlewis/cherrypick-fk-fix
cherrypick: sql: two bugfixes to fks that use a partial index
knz
Merge pull request #17675 from knz/cherry-pick-17588
cherrypick: log: ensure Fatal calls are reported even if logs don't go to stderr
Commits on Aug 16, 2017
Commits on Aug 17, 2017
knz
Merge pull request #17681 from knz/20170816-cherry-pick-17680
cherrypick: sql: disallow AS OF SYSTEM TIME 0, add more AS OF tests
knz
Merge pull request #17689 from knz/20170816-cherry-pick-17683
cherrypick: log: allow panic to propagate on crash reporting timeouts
Commits on Aug 24, 2017
mvcc: continue scanning if MVCCReverseScan falls off end of range
Fixes #17825.

When an `mvccGetInternal` call scans off the end of a key range
while attempting to find a value at a certain timestamp,
`MVCCReverseScan` shouldn't stop scanning backwards. This change
fixes this behavior by ignoring the `iter.Valid` in `MVCCIterate`
until after the iterator has scanned to the previous key.
Merge pull request #17891 from nvanbenschoten/nvanbenschoten/cherry-p…
…ick-17868

cherrypick: mvcc: continue scanning if MVCCReverseScan falls off end of range
Commits on Aug 28, 2017
Commits on Aug 29, 2017
settings/cluster: impose a floor on the max raft command size
Enforce a reasonable lower bound on kv.raft.command.max_size. Any lower
than 4MB and your cluster is likely to be useless.
Commits on Aug 31, 2017
Merge pull request #18016 from benesch/cherrypick-17991
cherrypick: settings/cluster: impose a floor on the max raft command size
Commits on Sep 05, 2017
storage: fix quiescence when not leaseholder
Fix check for whether we own a valid lease.

Fixes #17741
Commits on Sep 06, 2017
Merge pull request #18218 from petermattis/pmattis/cherry-pick-quiesc…
…e-not-leaseholder

cherrypick (1.0.6): storage: fix quiescence when not leaseholder
storage: expose site of error return
Hopefully this can shed some light on #18084.
Merge pull request #18229 from tschottdorf/preemptive-18082
storage: storage: expose site of error return in preemptive snapshot path
sql: put parallel stmts behind environment variable in v1.0
Parallel statements were not safe for general use because of their
behavior when confronted with retryable errors. This was fixed in #17627,
but the fix is too big to cherry-pick back into v1.0.
Commits on Sep 07, 2017
Merge pull request #18002 from nvanbenschoten/nvanbenschoten/disallow…
…Parallel

sql: put parallel stmts behind environment variable in v1.0
storage: Log a help message if raft data is missing
A hacky stopgap to try to explain what's happening if someone runs
into #14231. It's not great, but seems better than leaving users with
a hard-to-understand raft error if they make a configuration mistake.
Merge pull request #18315 from bdarnell/cherrypick-close-http-body
cherrypick-1.0: server: Close HTTP response body after reporting diagnostics
Merge pull request #18282 from a-robinson/cherrypick_18172
cherrypick: storage: Log a help message if raft data is missing
Merge pull request #18272 from tschottdorf/log-18082-18084
storage: more logging for raft handling crashes
Merge pull request #18332 from nvanbenschoten/nvanbenschoten/reenable…
…-parallel

release-1.0: sql: don't throw error on parallel statements without env var
Merge pull request #18333 from a-robinson/debug-1.0
cherrypick-1.0: server: Fix incorrect help text for server.remote_debugging.mode
Merge pull request #18335 from bdarnell/cherrypick-redact-server-name
cherrypick-1.0: Redact hostnames in crash reports
Commits on Sep 08, 2017
kv: fix (the horribly broken) prev()
prev() was broken in two ways:

- it had a one-off where `prev([a, b), b)` would  return `b` instead of `KeyMin`.
- in one path it was assembling the return from the start keys, not the end keys, which is
  wrong. When keys `>= c` have been handled, and your remaining batch is `[a, b)`, it would
  erroneously return `a` instead of `b`.
Commits on Sep 09, 2017
Merge pull request #18385 from tschottdorf/cp1.0-prev
cherrypick-1.0: kv: fix (the horribly broken) prev()
storage/engine: reproduce RocksDB DeleteRange bug
Manually apply the fix to our RocksDB repo. The presence of the test
will prevent upgrading to a version of RocksDB that does not contain the
fix.

Fixes #18371
Merge pull request #18397 from petermattis/pmattis/rocksdb-delete-ran…
…ge-bug

storage/engine: reproduce RocksDB DeleteRange bug
Commits on Nov 03, 2017
build: Move issue-posting script from TC config to repo
This is cleaned up from the previous version and modified to work
for any project, not just merge-to-master.
Merge pull request #19773 from bdarnell/post-failures-1.0
cherrypick-1.0: build: Move issue-posting script from TC config to repo
Commits on Feb 10, 2018
util/log: don't panic
Previously, log.outputLogEntry could panic while holding the log mutex.
This would deadlock any goroutine that logged while recovering from the
panic, which is approximately all of the recover routines. Most
annoyingly, the crash reporter would deadlock, swallowing the cause of
the panic.

Avoid panicking while holding the log mutex and use l.exit instead,
which exists for this very purpose. In the process, enforce the
invariant that l.mu is held when l.exit is called. (The previous
behavior was, in fact, incorrect, as l.flushAll should not be called
without holding l.mu.)

Also add a Tcl test to ensure this doesn't break in the future.
Commits on Feb 11, 2018
sql: Throttle lease removal
Addresses #20451 for the release-1.0 branch
sql: Remove unused nearly-expired leases when acquiring a new one
This prevents a leak (only present in 1.0) of these leases, which
could accumulate into a huge amount of work when PurgeOldLeases is
called.

Fixes #20422
build: Work around testrace goroutine limit for release-1.0
Newer branches have a more sophisticated solution for this (#20542)
Merge pull request #22563 from bdarnell/1.0-backports
release-1.0: Backports and updates for table lease leak
Commits on Mar 29, 2018
build: add bors.toml
Teaches Bors to wait for a successful build on TeamCity before merging
approved PRs to master, and not to merge PRs labeled do-not-merge.

Contributes to #22499
Release note (build change): Begin using Bors to automate the process of
merging PRs to master.
Merge #24325
24325: cherrypick-1.0: build: add bors.toml r=bdarnell a=couchand

A cherry-pick of #24100.

Teaches Bors to wait for a successful build on TeamCity before merging
approved PRs to master, and not to merge PRs labeled do-not-merge.

Contributes to #22499
Release note (build change): Begin using Bors to automate the process of
merging PRs to master.

cc @cockroachdb/release @bdarnell @benesch
Commits on Apr 03, 2018
build: teach Bors about the CLA check
When introducing Bors in #24100, I only thought to include the TeamCity build
status, but since we require the license check for regular, GitHub-initiated
merges, this was a regression.  This change corrects that, adding the CLA to
the list of PR statuses to check before allowing `r+`.

Release note: None
Commits on Apr 06, 2018
Merge #24448
24448: cherrypick-1.0: build: teach Bors about the CLA check r=couchand a=couchand

A cherry-pick of #24420.

cc @bdarnell @benesch 

When introducing Bors in #24100, I only thought to include the TeamCity build
status, but since we require the license check for regular, GitHub-initiated
merges, this was a regression.  This change corrects that, adding the CLA to
the list of PR statuses to check before allowing `r+`.

Release note: None
Commits on Apr 11, 2018
build: give craig an avatar
At present, when GitHub apps create commits, they don't show up
with the app's avatar.  A workaround is to commit with an e-mail
address that has an associated gravatar.

Release note: None
build: move bors.toml into .github folder
Just to keep the root of the project a little cleaner.

Release note: None
craig[bot] and couchand
Merge #24673
24673: cherrypick-1.0: give craig an avatar, move bors.toml into .github r=couchand a=couchand

build: give craig an avatar

At present, when GitHub apps create commits, they don't show up
with the app's avatar.  A workaround is to commit with an e-mail
address that has an associated gravatar.

build: move bors.toml into .github folder

Just to keep the root of the project a little cleaner.

---

I hadn't planned on cherry-picking this, but figured it's a reasonable test that the branch protection is set up correctly.

cc: @cockroachdb/release @jordanlewis 

Co-authored-by: Andrew Couch <andrew@cockroachlabs.com>
Commits on Apr 24, 2018
build: GH label changes
- Robot -> O-robot
- test-failure -> C-test-failure

Release note: None
craig[bot] and jordanlewis
Merge #25056
25056: backport-1.0: build: GH label changes r=jordanlewis a=jordanlewis

Backport 1/1 commits from #25050.

/cc @cockroachdb/release

---

- Robot -> O-robot
- test-failure -> C-test-failure

@benesch do we need to backport this for it to work on other branches?

Release note: None



Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Showing with 10,642 additions and 6,917 deletions.
  1. +13 −0 .github/bors.toml
  2. +2 −2 build/Dockerfile
  3. +14 −5 build/common.mk
  4. +4 −1 build/protobuf.mk
  5. +2 −0 build/style_test.go
  6. +96 −0 build/teamcity-post-failures.py
  7. +6 −23 build/{teamcity-release-upload.sh → teamcity-publish-artifacts.sh}
  8. +31 −0 build/teamcity-publish-s3-binaries.sh
  9. +4 −0 build/teamcity-testrace.sh
  10. +4 −0 build/variables.mk
  11. +1 −1 c-deps/jemalloc-rebuild
  12. +90 −0 c-deps/rocksdb-0001-Fix-NDEBUG-windows.patch
  13. +65 −0 c-deps/rocksdb-0015-delete-range-bug.patch
  14. +1 −1 c-deps/rocksdb-rebuild
  15. BIN c-deps/rocksdb.src.tar.xz
  16. +3 −2 glide.lock
  17. +3 −2 glide.yaml
  18. +1 −1 pkg/acceptance/cluster/localcluster.go
  19. +9 −0 pkg/acceptance/java_test.go
  20. +18 −3 pkg/base/constants.go
  21. +7 −8 pkg/ccl/sqlccl/backup.go
  22. +17 −8 pkg/cli/cli_test.go
  23. +5 −2 pkg/cli/cliflags/flags.go
  24. +29 −4 pkg/cli/interactive_tests/test_missing_log_output.tcl
  25. +51 −8 pkg/cli/interactive_tests/test_secure.tcl
  26. +2 −1 pkg/cli/sql.go
  27. +1 −1 pkg/cli/sql_util.go
  28. +19 −1 pkg/cli/start.go
  29. +3 −3 pkg/cli/zone.go
  30. +1 −1 pkg/cmd/github-post/main.go
  31. +56 −1 pkg/cmd/metacheck/main.go
  32. +65 −31 pkg/cmd/{release-upload → publish-artifacts}/main.go
  33. +12 −5 pkg/gossip/gossip.go
  34. +53 −0 pkg/gossip/gossip_test.go
  35. +6 −3 pkg/internal/client/txn.go
  36. +33 −16 pkg/keys/keys.go
  37. +49 −10 pkg/kv/batch.go
  38. +134 −27 pkg/kv/batch_test.go
  39. +28 −0 pkg/kv/db_test.go
  40. +18 −2 pkg/migrations/migrations.go
  41. +1 −1 pkg/roachpb/api.pb.go
  42. +10 −9 pkg/roachpb/data.go
  43. +3 −3 pkg/roachpb/errors.go
  44. +153 −143 pkg/roachpb/errors.pb.go
  45. +20 −10 pkg/roachpb/errors.proto
  46. +18 −3 pkg/security/password.go
  47. +63 −20 pkg/security/tls.go
  48. +102 −48 pkg/server/config.go
  49. +2 −2 pkg/server/config_test.go
  50. +1 −1 pkg/server/debug.go
  51. +3 −2 pkg/server/node.go
  52. +1 −7 pkg/server/server.go
  53. +5 −0 pkg/server/testserver.go
  54. +44 −19 pkg/server/updates.go
  55. +92 −61 pkg/server/updates_test.go
  56. +1 −29 pkg/sql/app_stats.go
  57. +25 −24 pkg/sql/as_of_test.go
  58. +24 −4 pkg/sql/create.go
  59. +5 −5 pkg/sql/data_source.go
  60. +1 −1 pkg/sql/distsql_running.go
  61. +2 −1 pkg/sql/distsqlplan/physical_plan.go
  62. +1 −1 pkg/sql/distsqlrun/base.go
  63. +77 −77 pkg/sql/distsqlrun/data.pb.go
  64. +1 −1 pkg/sql/distsqlrun/data.proto
  65. +5 −3 pkg/sql/distsqlrun/expr.go
  66. +2 −1 pkg/sql/distsqlrun/processors.pb.go
  67. +2 −1 pkg/sql/distsqlrun/processors.proto
  68. +13 −4 pkg/sql/distsqlrun/sorter.go
  69. +4 −0 pkg/sql/drop.go
  70. +70 −39 pkg/sql/executor.go
  71. +6 −1 pkg/sql/generator.go
  72. +39 −48 pkg/sql/group.go
  73. +8 −4 pkg/sql/group_test.go
  74. +33 −3 pkg/sql/lease.go
  75. +3 −1 pkg/sql/limit_opt.go
  76. +1 −0 pkg/sql/logic_test.go
  77. +2 −7 pkg/sql/needed_columns.go
  78. +4 −0 pkg/sql/optimize.go
  79. +17 −0 pkg/sql/parallel_stmts.go
  80. +80 −26 pkg/sql/parser/builtins.go
  81. +3 −1 pkg/sql/parser/col_types.go
  82. +5 −1 pkg/sql/parser/constant_test.go
  83. +6 −1 pkg/sql/parser/create.go
  84. +78 −68 pkg/sql/parser/datum.go
  85. +51 −0 pkg/sql/parser/datum_test.go
  86. +7 −0 pkg/sql/parser/decimal.go
  87. +17 −2 pkg/sql/parser/eval.go
  88. +2 −2 pkg/sql/parser/eval_test.go
  89. +1 −1 pkg/sql/parser/expr.go
  90. +14 −0 pkg/sql/parser/format.go
  91. +69 −29 pkg/sql/parser/indexed_vars.go
  92. +1 −0 pkg/sql/parser/keywords.go
  93. +15 −0 pkg/sql/parser/parse.go
  94. +2 −0 pkg/sql/parser/parse_test.go
  95. +5,264 −5,184 pkg/sql/parser/sql.go
  96. +16 −9 pkg/sql/parser/sql.y
  97. +4 −0 pkg/sql/parser/walk.go
  98. +1 −1 pkg/sql/pgwire/pgerror/errors.go
  99. +3 −0 pkg/sql/pgwire/pgerror/errors_test.go
  100. +37 −0 pkg/sql/pgwire/pgwire_test.go
  101. +6 −30 pkg/sql/pgwire/types.go
  102. +3 −3 pkg/sql/pgwire/types_test.go
  103. +3 −0 pkg/sql/pgwire/v3.go
  104. +3 −0 pkg/sql/plan.go
  105. +32 −22 pkg/sql/render.go
  106. +11 −5 pkg/sql/scan.go
  107. +3 −7 pkg/sql/select_name_resolution.go
  108. +53 −8 pkg/sql/session.go
  109. +9 −6 pkg/sql/show.go
  110. +2 −2 pkg/sql/sqlbase/fk.go
  111. +2 −2 pkg/sql/sqlbase/structured_test.go
  112. +5 −7 pkg/sql/subquery.go
  113. +149 −61 pkg/sql/testdata/logic_test/aggregate
  114. +8 −5 pkg/sql/testdata/logic_test/builtin_function
  115. +14 −0 pkg/sql/testdata/logic_test/create_as
  116. +13 −0 pkg/sql/testdata/logic_test/decimal
  117. +14 −0 pkg/sql/testdata/logic_test/distinct
  118. +2 −2 pkg/sql/testdata/logic_test/distsql_agg
  119. +23 −0 pkg/sql/testdata/logic_test/drop_view
  120. +11 −15 pkg/sql/testdata/logic_test/explain_types
  121. +47 −2 pkg/sql/testdata/logic_test/fk
  122. +13 −0 pkg/sql/testdata/logic_test/generators
  123. +29 −0 pkg/sql/testdata/logic_test/limit
  124. +63 −0 pkg/sql/testdata/logic_test/name_escapes
  125. +28 −0 pkg/sql/testdata/logic_test/orms
  126. +8 −0 pkg/sql/testdata/logic_test/pg_catalog
  127. +11 −1 pkg/sql/testdata/logic_test/pgoidtype
  128. +8 −0 pkg/sql/testdata/logic_test/planning_errors
  129. +31 −0 pkg/sql/testdata/logic_test/prepare
  130. +10 −0 pkg/sql/testdata/logic_test/select
  131. +3 −0 pkg/sql/testdata/logic_test/set
  132. +51 −2 pkg/sql/testdata/logic_test/txn
  133. +18 −0 pkg/sql/testdata/logic_test/union
  134. +38 −0 pkg/sql/testdata/logic_test/views
  135. +3 −9 pkg/sql/testdata/logic_test/window
  136. +59 −35 pkg/sql/trace_test.go
  137. +10 −5 pkg/sql/txn.go
  138. +80 −80 pkg/sql/txn_restart_test.go
  139. +17 −33 pkg/sql/union.go
  140. +2 −1 pkg/sql/vars.go
  141. +8 −3 pkg/sql/window.go
  142. +17 −5 pkg/storage/allocator.go
  143. +85 −0 pkg/storage/allocator_test.go
  144. +20 −0 pkg/storage/build_default.go
  145. +20 −0 pkg/storage/build_race.go
  146. +22 −11 pkg/storage/client_raft_test.go
  147. +1 −0 pkg/storage/consistency_queue.go
  148. +4 −1 pkg/storage/engine/enginepb/mvcc.go
  149. +5 −5 pkg/storage/engine/enginepb/mvcc.pb.go
  150. +5 −6 pkg/storage/engine/enginepb/mvcc.proto
  151. +40 −17 pkg/storage/engine/mvcc.go
  152. +42 −3 pkg/storage/engine/mvcc_test.go
  153. +55 −0 pkg/storage/engine/rocksdb_test.go
  154. +261 −46 pkg/storage/gc_queue.go
  155. +301 −100 pkg/storage/gc_queue_test.go
  156. +57 −4 pkg/storage/intent_resolver.go
  157. +2 −0 pkg/storage/main_test.go
  158. +44 −35 pkg/storage/push_txn_queue.go
  159. +40 −20 pkg/storage/queue.go
  160. +83 −0 pkg/storage/queue_test.go
  161. +30 −1 pkg/storage/raft.go
  162. +1 −0 pkg/storage/raft_log_queue.go
  163. +3 −2 pkg/storage/raft_snapshot_queue.go
  164. +81 −48 pkg/storage/replica.go
  165. +65 −27 pkg/storage/replica_command.go
  166. +1 −0 pkg/storage/replica_gc_queue.go
  167. +56 −28 pkg/storage/replica_proposal.go
  168. +1 −1 pkg/storage/replica_state.go
  169. +136 −1 pkg/storage/replica_test.go
  170. +1 −0 pkg/storage/replicate_queue.go
  171. +10 −0 pkg/storage/span_set.go
  172. +1 −0 pkg/storage/split_queue.go
  173. +51 −12 pkg/storage/store.go
  174. +4 −2 pkg/storage/store_pool.go
  175. +3 −2 pkg/storage/store_test.go
  176. +13 −0 pkg/storage/timestamp_cache.go
  177. +9 −2 pkg/storage/timestamp_cache_test.go
  178. +2 −1 pkg/storage/ts_maintenance_queue.go
  179. +4 −0 pkg/testutils/serverutils/test_server_shim.go
  180. +1 −1 pkg/ui/Makefile
  181. +407 −14 pkg/ui/embedded.go
  182. +1 −1 pkg/ui/src/containers/nodeLogs.tsx
  183. +2 −2 pkg/ui/src/containers/timescale.tsx
  184. +2 −1 pkg/ui/webpack.config.js
  185. +9 −0 pkg/util/encoding/decimal_test.go
  186. +40 −22 pkg/util/encoding/encoding.go
  187. +4 −4 pkg/util/encoding/encoding_test.go
  188. +25 −15 pkg/util/log/clog.go
  189. +44 −4 pkg/util/log/crash_reporting.go
  190. +35 −0 pkg/util/log/crash_reporting_test.go
  191. +16 −2 pkg/util/log/file.go
  192. +0 −5 pkg/util/log/stderr_redirect_windows.go
  193. +8 −0 pkg/util/timeutil/now_windows.go
  194. +72 −37 pkg/util/tracing/tracer.go
  195. +1 −1 vendor
View
@@ -0,0 +1,13 @@
status = [
"GitHub CI (Cockroach)"
]
pr_status = [
"license/cla"
]
block_labels = [
"do-not-merge"
]
[committer]
name = "craig[bot]"
email = "bors@cockroachlabs.com"
View
@@ -104,8 +104,8 @@ RUN git clone --depth 1 https://github.com/tpoechtrager/osxcross.git \
# BEGIN https://github.com/docker-library/golang/blob/master/1.8/alpine/Dockerfile
COPY parallelbuilds-go1.8.patch /
RUN curl -fsSL https://storage.googleapis.com/golang/go1.8.1.src.tar.gz -o golang.tar.gz \
&& echo '33daf4c03f86120fdfdc66bddf6bfff4661c7ca11c5da473e537f4d69b470e57 golang.tar.gz' | sha256sum -c - \
RUN curl -fsSL https://storage.googleapis.com/golang/go1.8.3.src.tar.gz -o golang.tar.gz \
&& echo '5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6 golang.tar.gz' | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz \
&& cd /usr/local/go/src \
View
@@ -181,7 +181,7 @@ endif
# TARGET-NAME: [export] VARIABLE [:+?]=
#
# The additional complexity below handles whitespace and comments.
$(REPO_ROOT)/build/variables.mk: $(REPO_ROOT)/Makefile $(REPO_ROOT)/.go-version $(REPO_ROOT)/build/common.mk
$(REPO_ROOT)/build/variables.mk: $(REPO_ROOT)/Makefile $(REPO_ROOT)/.go-version $(REPO_ROOT)/build/common.mk $(REPO_ROOT)/build/archive/contents/Makefile
@echo '# This file is auto-generated by Make.' > $@
@echo '# DO NOT EDIT!' >> $@
@echo 'define VALID_VARS' >> $@
@@ -206,6 +206,8 @@ HOST_TRIPLE := $(shell $$($(GO) env CC) -dumpmachine)
CONFIGURE_FLAGS :=
CMAKE_FLAGS := $(if $(MINGW),-G 'MSYS Makefiles')
ENABLE_ROCKSDB_ASSERTIONS := $(findstring race,$(TAGS))
ifdef XHOST_TRIPLE
# Darwin wants clang, so special treatment is in order.
@@ -254,7 +256,7 @@ endif
JEMALLOC_DIR := $(BUILD_DIR)/jemalloc
PROTOBUF_DIR := $(BUILD_DIR)/protobuf
ROCKSDB_DIR := $(BUILD_DIR)/rocksdb
ROCKSDB_DIR := $(BUILD_DIR)/rocksdb$(if $(ENABLE_ROCKSDB_ASSERTIONS),_assert)
SNAPPY_DIR := $(BUILD_DIR)/snappy
# Can't share with protobuf because protoc is always built for the host.
PROTOC_DIR := $(GOPATH)/native/$(HOST_TRIPLE)/protobuf
@@ -292,7 +294,7 @@ CGO_FLAGS_FILES := $(CGO_UNSUFFIXED_FLAGS_FILES) $(CGO_SUFFIXED_FLAGS_FILES)
$(CGO_UNSUFFIXED_FLAGS_FILES): .ALWAYS_REBUILD
$(CGO_FLAGS_FILES):
$(CGO_FLAGS_FILES): $(REPO_ROOT)/build/common.mk
@echo 'GEN $@'
@echo '// GENERATED FILE DO NOT EDIT' > $@
@echo >> $@
@@ -346,7 +348,10 @@ $(JEMALLOC_DIR)/Makefile: $(C_DEPS_DIR)/jemalloc-rebuild $(JEMALLOC_SRC_DIR)/.ex
mkdir -p $(JEMALLOC_DIR)
@# NOTE: If you change the configure flags below, bump the version in
@# $(C_DEPS_DIR)/jemalloc-rebuild. See above for rationale.
cd $(JEMALLOC_DIR) && $(JEMALLOC_SRC_DIR)/configure $(CONFIGURE_FLAGS) --enable-prof
@#
@# jemalloc profiling deadlocks when built against musl. See
@# https://github.com/jemalloc/jemalloc/issues/585.
cd $(JEMALLOC_DIR) && $(JEMALLOC_SRC_DIR)/configure $(CONFIGURE_FLAGS) $(if $(findstring musl,$(TARGET_TRIPLE)),,--enable-prof)
$(PROTOBUF_DIR)/Makefile: $(C_DEPS_DIR)/protobuf-rebuild $(PROTOBUF_SRC_DIR)/.extracted
rm -rf $(PROTOBUF_DIR)
@@ -372,9 +377,13 @@ $(ROCKSDB_DIR)/Makefile: $(C_DEPS_DIR)/rocksdb-rebuild $(ROCKSDB_SRC_DIR)/.extra
cd $(ROCKSDB_DIR) && cmake $(CMAKE_FLAGS) $(ROCKSDB_SRC_DIR) \
$(if $(findstring release,$(TYPE)),,-DWITH_$(if $(findstring mingw,$(TARGET_TRIPLE)),AVX2,SSE42)=OFF) \
-DSNAPPY_LIBRARIES=$(SNAPPY_DIR)/.libs/libsnappy.a -DSNAPPY_INCLUDE_DIR=$(SNAPPY_SRC_DIR) -DWITH_SNAPPY=ON \
-DJEMALLOC_LIBRARIES=$(JEMALLOC_DIR)/lib/libjemalloc.a -DJEMALLOC_INCLUDE_DIR=$(JEMALLOC_DIR)/include -DWITH_JEMALLOC=ON
-DJEMALLOC_LIBRARIES=$(JEMALLOC_DIR)/lib/libjemalloc.a -DJEMALLOC_INCLUDE_DIR=$(JEMALLOC_DIR)/include -DWITH_JEMALLOC=ON \
$(if $(ENABLE_ROCKSDB_ASSERTIONS),,-DCMAKE_CXX_FLAGS=-DNDEBUG)
@# TODO(benesch): Tweak how we pass -DNDEBUG above when we upgrade to a
@# RocksDB release that includes https://github.com/facebook/rocksdb/pull/2300.
$(SNAPPY_DIR)/Makefile: $(C_DEPS_DIR)/snappy-rebuild $(SNAPPY_SRC_DIR)/.extracted
rm -rf $(SNAPPY_DIR)
mkdir -p $(SNAPPY_DIR)
@# NOTE: If you change the configure flags below, bump the version in
@# $(C_DEPS_DIR)/snappy-rebuild. See above for rationale.
View
@@ -113,7 +113,10 @@ $(UI_JS): $(GO_PROTOS) $(COREOS_RAFT_PROTOS) $(YARN_INSTALLED_TARGET)
echo '// GENERATED FILE DO NOT EDIT' > $@
pbjs -t static-module -w es6 --strict-long --keep-case --path $(ORG_ROOT) --path $(GOGO_PROTOBUF_PATH) --path $(COREOS_PATH) --path $(GRPC_GATEWAY_GOOGLEAPIS_PATH) $(GW_PROTOS) >> $@
$(UI_TS): $(UI_JS)
$(UI_TS): $(UI_JS) $(YARN_INSTALLED_TARGET)
# Install a known-good version of jsdoc; see
# https://github.com/dcodeIO/protobuf.js/issues/716.
(cd $(UI_ROOT)/node_modules/protobufjs/cli && npm install --silent jsdoc@3.4.3)
# Add comment recognized by reviewable.
echo '// GENERATED FILE DO NOT EDIT' > $@
pbts $(UI_JS) >> $@
View
@@ -458,6 +458,8 @@ func TestStyle(t *testing.T) {
"Eventf:1",
"ErrEvent:1",
"ErrEventf:1",
"NewError:1",
"NewErrorf:1",
"VEvent:2",
"VEventf:2",
"UnimplementedWithIssueErrorf:1",
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Post failures from the current teamcity job as github issues.
Requires the following environment variables:
- TC_API_PASSWORD
- TC_BUILD_BRANCH
- TC_BUILD_ID
- GITHUB_API_TOKEN
"""
import json
import os
import urllib.error
import urllib.request
import xml.etree.ElementTree as ET
from urllib.parse import urljoin, urlencode
BASEURL = "https://teamcity.cockroachdb.com/httpAuth/app/rest/"
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='TeamCity',
uri='https://teamcity.cockroachdb.com',
user='robot',
passwd=os.environ['TC_API_PASSWORD'])
opener = urllib.request.build_opener(auth_handler)
def tc_url(path, **params):
return urljoin(BASEURL, path) + '?' + urlencode(params)
def collect_build_results(build_id):
"""Yield a sequence of (name, log) pairs for all failed tests.
Looks at the given build ID and all its dependencies.
"""
dep_data = ET.parse(opener.open(tc_url('builds/{0}'.format(build_id),
fields='snapshot-dependencies(build(id,status))')))
for b in dep_data.findall("./snapshot-dependencies/build"):
if b.attrib['status'] != 'SUCCESS':
yield from collect_build_results(b.attrib['id'])
test_data = ET.parse(opener.open(tc_url('testOccurrences',
locator='count:100,status:FAILURE,build:(id:{0})'.format(build_id),
fields='testOccurrence(details,name,duration,build(buildType(name)))')))
for o in test_data.findall('./testOccurrence'):
test_name = '{0}/{1}'.format(o.find('build/buildType').attrib['name'], o.attrib['name'])
test_log = '--- FAIL: {0}/{1} ({2:.3f}s)\n{3}\n'.format(
o.find("build/buildType").attrib["name"],
o.attrib["name"],
int(o.attrib["duration"])/1000.,
o.find("details").text)
yield (test_name, test_log)
def create_issue(build_id, failed_tests):
"""Format a list of failed tests as an issue.
Returns a dict which should be encoded as json for posting to the
github API.
"""
return {
'title': 'teamcity: failed tests on {0}: {1}'.format(os.environ['TC_BUILD_BRANCH'],
', '.join(t[0] for t in failed_tests)),
'body': '''\
The following tests appear to have failed:
[#{0}](https://teamcity.cockroachdb.com/viewLog.html?buildId={0}):
```
{1:.60000}
```
Please assign, take a look and update the issue accordingly.
'''.format(build_id, ''.join(t[1] for t in failed_tests)),
'labels': ['C-test-failure', 'O-robot'],
}
def post_issue(issue):
req = urllib.request.Request(
'https://api.github.com/repos/cockroachdb/cockroach/issues',
data=json.dumps(issue).encode('utf-8'),
headers={'Authorization': 'token {0}'.format(os.environ['GITHUB_API_TOKEN'])})
opener.open(req).read()
if __name__ == '__main__':
build_id = os.environ['TC_BUILD_ID']
failed_tests = list(collect_build_results(build_id))
if failed_tests:
issue = create_issue(build_id, failed_tests)
post_issue(issue)
@@ -1,32 +1,15 @@
#!/usr/bin/env bash
set -euxo pipefail
export BUILDER_HIDE_GOPATH_SRC=1
echo 'starting release build'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
# Any arguments to this script are passed through unmodified to
# ./build/teamcity-publish-s3-binaries.
build/builder.sh go install ./pkg/cmd/release-upload
echo 'installed release builder'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
set -euxo pipefail
build/builder.sh env \
AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
TC_BUILD_BRANCH="$TC_BUILD_BRANCH" \
release-upload
export BUILDER_HIDE_GOPATH_SRC=1
echo 'built and uploaded artifacts'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
build/teamcity-publish-s3-binaries.sh "$@"
if [ "$TC_BUILD_BRANCH" != master ]; then
if [[ "$TC_BUILD_BRANCH" != *alpha* ]] && [ "$TEAMCITY_BUILDCONF_NAME" == 'Publish Releases' ]; then
image=docker.io/cockroachdb/cockroach
cp cockroach-linux-2.6.32-gnu-amd64 build/deploy/cockroach
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Any arguments to this script are passed through unmodified to
# ./pkg/cmd/publish-artifacts.
set -euxo pipefail
export BUILDER_HIDE_GOPATH_SRC=1
echo 'starting release build'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
build/builder.sh go install ./pkg/cmd/publish-artifacts
echo 'installed release builder'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
build/builder.sh env \
AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
TC_BUILD_BRANCH="$TC_BUILD_BRANCH" \
publish-artifacts "$@"
echo 'built and uploaded artifacts'
cat .buildinfo/tag || true
cat .buildinfo/rev || true
build/builder.sh git status
@@ -12,7 +12,11 @@ build/builder.sh env \
TARGET=stressrace \
github-pull-request-make
# Due to a limit on the number of running goroutines in the race
# detector, testrace fails when run on 16-CPU machines. Set GOMAXPROCS
# to work around this.
build/builder.sh env \
GOMAXPROCS=8 \
make testrace \
TESTFLAGS='-v' \
2>&1 \
View
@@ -25,6 +25,7 @@ define VALID_VARS
C_LIBS
C_LIBS_SRCS
DUPLFLAGS
ENABLE_ROCKSDB_ASSERTIONS
FILES
FIND_RELEVANT
GITHOOKS
@@ -37,6 +38,7 @@ define VALID_VARS
GOVERS
GO_INSTALL
HOST_TRIPLE
INSTALL
ISDARWIN
JEMALLOC_DIR
JEMALLOC_SRC_DIR
@@ -80,5 +82,7 @@ define VALID_VARS
XHOST_BIN_DIR
XHOST_TRIPLE
YARN_INSTALLED_TARGET
bindir
prefix
space
endef
View
@@ -1,4 +1,4 @@
Bump the version below when changing jemalloc configure flags. Search for "BUILD
ARTIFACT CACHING" in build/common.mk for rationale.
1
2
Oops, something went wrong.

No commit comments for this range