blob: 2c5d5bbac9b3a686399659f2632124fccd6030bb [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Developing the Avatica Go Client</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Jekyll v3.7.3">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
<link rel="stylesheet" href="/avatica/css/screen.css">
<link rel="icon" type="image/x-icon" href="/avatica/favicon.ico">
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="wrap">
<header role="banner">
<nav class="mobile-nav show-on-mobiles">
<ul>
<li class="">
<a href="/avatica/">Home</a>
</li>
<li class="">
<a href="/avatica/downloads/">Download</a>
</li>
<li class="">
<a href="/avatica/community/">Community</a>
</li>
<li class="current">
<a href="/avatica/develop/">Develop</a>
</li>
<li class="">
<a href="/avatica/news/">News</a>
</li>
<li class="">
<a href="/avatica/docs/">Docs</a>
</li>
</ul>
</nav>
<div class="grid">
<div class="unit one-third center-on-mobiles">
<h1>
<a href="/avatica/">
<span class="sr-only">Apache Calcite Avatica</span>
<img src="/avatica/img/logo.png" width="226" height="140" alt="Calcite Logo">
</a>
</h1>
</div>
<nav class="main-nav unit two-thirds hide-on-mobiles">
<ul>
<li class="">
<a href="/avatica/">Home</a>
</li>
<li class="">
<a href="/avatica/downloads/">Download</a>
</li>
<li class="">
<a href="/avatica/community/">Community</a>
</li>
<li class="current">
<a href="/avatica/develop/">Develop</a>
</li>
<li class="">
<a href="/avatica/news/">News</a>
</li>
<li class="">
<a href="/avatica/docs/">Docs</a>
</li>
</ul>
</nav>
</div>
</header>
<section class="standalone">
<div class="grid">
<div class="unit whole">
<article>
<h1>Developing the Avatica Go Client</h1>
<!--
-->
<ul id="markdown-toc">
<li><a href="#issues" id="markdown-toc-issues">Issues</a></li>
<li><a href="#updating-protobuf-definitions" id="markdown-toc-updating-protobuf-definitions">Updating protobuf definitions</a></li>
<li><a href="#testing" id="markdown-toc-testing">Testing</a> <ul>
<li><a href="#easy-way" id="markdown-toc-easy-way">Easy way</a></li>
<li><a href="#manual-set-up" id="markdown-toc-manual-set-up">Manual set up</a></li>
</ul>
</li>
<li><a href="#releasing" id="markdown-toc-releasing">Releasing</a></li>
<li><a href="#important-things-to-note-before-uploading-a-release" id="markdown-toc-important-things-to-note-before-uploading-a-release">Important things to note before uploading a release</a></li>
<li><a href="#uploading-release-artifacts-to-dev-for-voting" id="markdown-toc-uploading-release-artifacts-to-dev-for-voting">Uploading release artifacts to dev for voting</a></li>
<li><a href="#promoting-a-release-after-voting" id="markdown-toc-promoting-a-release-after-voting">Promoting a release after voting</a></li>
</ul>
<h2 id="issues">Issues</h2>
<p>To file issues, please use the <a href="https://issues.apache.org/jira/projects/CALCITE/issues">Calcite JIRA</a> and select <code class="highlighter-rouge">avatica-go</code>
as the component.</p>
<h2 id="updating-protobuf-definitions">Updating protobuf definitions</h2>
<p>To update the procotol buffer definitions, update <code class="highlighter-rouge">AVATICA_VER</code> in <code class="highlighter-rouge">gen-protobuf.bat</code> and <code class="highlighter-rouge">gen-protobuf.sh</code> to match
the version you want to generate protobufs for and then run the appropriate script for your platform.</p>
<h2 id="testing">Testing</h2>
<p>The test suite takes around 4 minutes to run if you run both the Avatica HSQLDB and Apache Phoenix tests.</p>
<h3 id="easy-way">Easy way</h3>
<ol>
<li>
<p>Install <a href="https://docs.docker.com/install/">docker</a> and <a href="https://docs.docker.com/compose/install/">docker-compose</a>.</p>
</li>
<li>
<p>From the root of the repository, run <code class="highlighter-rouge">docker-compose up --build</code>.</p>
</li>
</ol>
<h3 id="manual-set-up">Manual set up</h3>
<ol>
<li>Install <a href="https://golang.org/doc/install">Go</a>.</li>
</ol>
<p>For Go 1.10 and below, install the dependencies (skip these steps if using Go 1.11 and above):
1a. Install <a href="https://github.com/golang/dep">dep</a>: <code class="highlighter-rouge">go get -u github.com/golang/dep/cmd/dep</code></p>
<p>1b. Install dependencies by running <code class="highlighter-rouge">dep ensure -v</code> from the root of the repository.</p>
<ol>
<li>The test suite requires access to an instance of Avatica running HSQLDB and an instance of Apache Phoenix running the
Phoenix Query Server.</li>
</ol>
<p>You should then set the <code class="highlighter-rouge">HSQLDB_HOST</code> and <code class="highlighter-rouge">PHOENIX_HOST</code> environment variables. For example:</p>
<figure class="highlight"><pre><code class="language-shell" data-lang="shell">HSQLDB_HOST: http://hsqldb:8765
PHOENIX_HOST: http://phoenix:8765</code></pre></figure>
<ol>
<li>
<p>To select the test suite, export <code class="highlighter-rouge">AVATICA_FLAVOR=HSQLDB</code> for Avatica HSQLDB or <code class="highlighter-rouge">AVATICA_FLAVOR=PHOENIX</code> for Phoenix.</p>
</li>
<li>
<p>Then run <code class="highlighter-rouge">go test -v ./...</code> from the root of the repository to execute the test suite.</p>
</li>
</ol>
<h2 id="releasing">Releasing</h2>
<p>If you have not set up a GPG signing key, set one up by following these <a href="https://www.apache.org/dev/openpgp.html#generate-key">instructions</a>.</p>
<p>If this release is a new major version (we are releasing 4.0.0 vs the current version 3.0.0), update the version in the
import path in <code class="highlighter-rouge">go.mod</code>. The import paths in the various sample code snippets should also be updated.</p>
<p>Since we need to support Go modules, tags must be prefixed with a <code class="highlighter-rouge">v</code>. For example, tag as <code class="highlighter-rouge">v3.1.0</code> rather than <code class="highlighter-rouge">3.1.0</code>.</p>
<p>From the root of the repository, run <code class="highlighter-rouge">./make-release-artifacts.sh</code>.</p>
<p>You will be asked to select the tag to build release artifacts for. The latest tag is automatically selected if no tag is selected.</p>
<p>The release artifacts will be placed in a folder named for the release within the <code class="highlighter-rouge">dist/</code> folder.</p>
<h2 id="important-things-to-note-before-uploading-a-release">Important things to note before uploading a release</h2>
<p>The name of the release folder must be in the following format: <code class="highlighter-rouge">apache-calcite-avatica-go-$version</code>. The version must
include release candidate identifiers such as <code class="highlighter-rouge">-rc0</code>, if they are present.</p>
<p>The files inside the release folder must have any release candidate identifiers such as <code class="highlighter-rouge">-rc1</code> removed, even if the
release is a release candidate. <code class="highlighter-rouge">src</code> must also be added to the filename.</p>
<p>For example, if we are uploading the <code class="highlighter-rouge">apache-calcite-avatica-go-3.0.0-rc1</code> folder, the files must be named
<code class="highlighter-rouge">apache-calcite-acatica-go-3.0.0.-srctar.gz</code>. Note the inclusion of <code class="highlighter-rouge">src</code> in the filename.</p>
<p>The tar.gz must be named <code class="highlighter-rouge">apache-calcite-avatica-go-$version-src.tar.gz</code>.</p>
<p>There must be a GPG signature for the tar.gz named: <code class="highlighter-rouge">apache-calcite-avatica-go-$version-src.tar.gz.asc</code></p>
<p>There must be a SHA256 hash for the tar.gz named: <code class="highlighter-rouge">apache-calcite-avatica-go-$version-src.tar.gz.sha256</code></p>
<h2 id="uploading-release-artifacts-to-dev-for-voting">Uploading release artifacts to dev for voting</h2>
<p><code class="highlighter-rouge">svn</code> must be installed in order to upload release artifacts.</p>
<ol>
<li>
<p>Check out the Calcite dev release subdirectory: <code class="highlighter-rouge">svn co "https://dist.apache.org/repos/dist/dev/calcite/" calcite-dev</code>.</p>
</li>
<li>
<p>Move the release folder under <code class="highlighter-rouge">dist/</code> into the <code class="highlighter-rouge">calcite-dev</code> folder.</p>
</li>
<li>
<p>Add the new release to the svn repository: <code class="highlighter-rouge">svn add apache-calcite-avatica-go-3.0.0-rc0</code>. Remember to change the folder name to the
correct release in the command.</p>
</li>
<li>
<p>Commit to upload the artifacts: <code class="highlighter-rouge">svn commit -m "apache-calcite-avatica-go-3.0.0-rc0" --username yourapacheusername --force-log</code>
Note the use of <code class="highlighter-rouge">--force-log</code> to suppress the svn warning, because the commit message is the same as the name of the directory.</p>
</li>
</ol>
<h2 id="promoting-a-release-after-voting">Promoting a release after voting</h2>
<p><code class="highlighter-rouge">svn</code> must be installed in order to upload release artifacts.</p>
<p>NOTE: Only official releases that has passed a vote may be uploaded to the release directory.</p>
<ol>
<li>
<p>Check out the Calcite release directory: <code class="highlighter-rouge">svn co "https://dist.apache.org/repos/dist/release/calcite/" calcite-release</code>.</p>
</li>
<li>
<p>Copy the release into the <code class="highlighter-rouge">calcite-release</code> folder. Remember to check the name of the release’s folder to ensure that it is in
the correct format.</p>
</li>
<li>
<p>Add the release to the svn repository: <code class="highlighter-rouge">svn add apache-calcite-avatica-go-3.0.0</code>. Remember to change the folder name to the
correct release in the command.</p>
</li>
<li>
<p>Commit to upload the artifacts: <code class="highlighter-rouge">svn commit -m "Release apache-calcite-avatica-go-3.0.0" --username yourapacheusername</code>.</p>
</li>
</ol>
</article>
</div>
<div class="clear"></div>
</div>
</section>
<footer role="contentinfo">
<div id="poweredby">
<a href="http://www.apache.org/">
<span class="sr-only">Apache</span>
<img src="/avatica/img/feather.png" width="190" height="77" alt="Apache Logo"></a>
</div>
<div id="copyright">
<p>The contents of this website are &copy;&nbsp;2019
<a href="https://www.apache.org/">Apache Software Foundation</a>
under the terms of
the <a href="https://www.apache.org/licenses/LICENSE-2.0.html">
Apache&nbsp;License&nbsp;v2</a>. Apache Calcite and its logo are
trademarks of the Apache Software Foundation.</p>
</div>
</footer>
<script>
var anchorForId = function (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
anchor.title = "Permalink";
return anchor;
};
var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];
if (typeof header.id !== "undefined" && header.id !== "") {
header.appendChild(anchorForId(header.id));
}
}
};
document.onreadystatechange = function () {
if (this.readyState === "complete") {
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
if (!contentBlock) {
return;
}
for (var level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
}
};
</script>
</body>
</html>