Skip to content

Instantly share code, notes, and snippets.

View nirbhayc's full-sized avatar

Nirbhay Choubey nirbhayc

  • Bloomberg LP
  • New York
View GitHub Profile
@nirbhayc
nirbhayc / tock-tock.go
Last active June 20, 2017 20:58
(Blog) A simple web server in Go
/* tick-tock.go */
package main
import (
"fmt"
"log"
"net/http"
"time"
)
diff --git a/sql/mdl.cc b/sql/mdl.cc
index d1f4cb7..56515d4 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -2113,7 +2113,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
find_deadlock();
struct timespec abs_timeout, abs_shortwait;
- set_timespec(abs_timeout, (ulonglong) lock_wait_timeout);
+ set_timespec_nsec(abs_timeout,
@nirbhayc
nirbhayc / crashme.go
Last active January 5, 2017 03:51
MDEV-9510
package main
import (
"database/sql"
"fmt"
"github.com/vaquita/mysql"
"math/rand"
"os"
"strconv"
"time"
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 5169b7c..b214a17 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2649,13 +2649,16 @@ mysql_execute_command(THD *thd)
}
/*
- Bail out if DB snapshot has not been installed. We however, allow SET,
- SHOW and SELECT queries (only if wsrep_dirty_reads is set).
@nirbhayc
nirbhayc / STRICT_TRANS_TABLES_and_SET
Created November 3, 2016 17:26
sql_mode='STRICT_TRANS_TABLES' & SET @@var=<out-of-range>
MariaDB [test]> select @@version;
+----------------------+
| @@version |
+----------------------+
| 10.2.3-MariaDB-debug |
+----------------------+
1 row in set (0.00 sec)
MariaDB [test]> select @@sql_mode;
+---------------------+
@nirbhayc
nirbhayc / error_warning_inconsistency
Created November 3, 2016 03:26
Error vs warning inconsistency with 'STRICT_TRANS_TABLES,NO_ZERO_DATE'
MariaDB [test]> show create table t1;
+-------+-------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-------------------------------------------------------------------------------------+
| t1 | CREATE TABLE `t1` (
`c1` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@nirbhayc
nirbhayc / building-myrocks
Created October 26, 2016 21:27
Building mariadb-myrocks from source.
1) Patch (ssh to https) : https://gist.github.com/nirbhayc/b5487506f53a66cc087c52c631b05d6a
2) sudo apt-get install g++ cmake libbz2-dev libaio-dev bison zlib1g-dev libsnappy-dev libgflags-dev \
libreadline6-dev libncurses5-dev libssl-dev liblz4-dev gdb git
3) git submodule init
4) git submodule update
5) mkdir b install
6) cd b
7) cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=system -DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=1 \
-DENABLE_DTRACE=0 -DWITHOUT_TOKUDB_STORAGE_ENGINE=1 -DCMAKE_INSTALL_PREFIX=../install && make -j2 install
** Note: -DWITHOUT_TOKUDB_STORAGE_ENGINE=1 added to avoid MDEV-10788
diff --git a/.gitmodules b/.gitmodules
index c49f2ca..6419657 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -3,4 +3,4 @@
url = https://github.com/MariaDB/mariadb-connector-c
[submodule "storage/rocksdb/rocksdb"]
path = storage/rocksdb/rocksdb
- url = [email protected]:facebook/rocksdb.git
+ url = https://github.com/facebook/rocksdb.git
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 33c8ed2..4b42d14 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3765,7 +3765,7 @@ class THD :public Statement,
void set_query(const CSET_STRING &string_arg)
{
mysql_mutex_lock(&LOCK_thd_data);
- set_query_inner(string_arg);
+ Statement::set_query_inner(string_arg);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index afa58af..66e7c60 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6022,7 +6022,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query() == 0);
- thd->reset_query_inner(); // Should not be needed
+ if (thd->query()) thd->reset_query(); // Should not be needed