From fc4c93fcfba0be39f0c4370df23d205ee1f36ce6 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Thu, 22 Nov 2018 22:04:44 +0800 Subject: [PATCH] *: preparation for Go1.11 module cherry pick (#8388) --- Gopkg.lock | 243 +- Gopkg.toml | 8 +- Makefile | 45 +- ast/ast.go | 61 +- ast/base.go | 14 +- ast/ddl.go | 4 +- ast/ddl_test.go | 2 +- ast/dml.go | 6 +- ast/dml_test.go | 2 +- ast/expressions.go | 114 +- ast/expressions_test.go | 7 +- ast/flag.go | 6 +- ast/flag_test.go | 4 +- ast/format_test.go | 4 +- ast/functions.go | 8 +- ast/functions_test.go | 9 +- ast/misc.go | 19 +- ast/misc_test.go | 15 +- ast/stats.go | 2 +- cmd/benchdb/main.go | 2 +- cmd/benchfilesort/main.go | 2 +- cmd/benchkv/main.go | 2 +- cmd/benchraw/main.go | 2 +- cmd/explaintest/main.go | 2 +- cmd/importer/db.go | 2 +- cmd/importer/parser.go | 8 +- cmd/importer/stats.go | 2 +- ddl/callback.go | 2 +- ddl/callback_test.go | 2 +- ddl/column.go | 4 +- ddl/column_change_test.go | 4 +- ddl/column_test.go | 10 +- ddl/db_change_test.go | 11 +- ddl/db_integration_test.go | 2 +- ddl/db_test.go | 10 +- ddl/ddl.go | 8 +- ddl/ddl_api.go | 8 +- ddl/ddl_test.go | 6 +- ddl/ddl_worker.go | 4 +- ddl/ddl_worker_test.go | 6 +- ddl/delete_range.go | 4 +- ddl/fail_db_test.go | 4 +- ddl/fail_test.go | 4 +- ddl/foreign_key.go | 2 +- ddl/foreign_key_test.go | 4 +- ddl/generated_column.go | 2 +- ddl/index.go | 6 +- ddl/index_change_test.go | 4 +- ddl/mock.go | 4 +- ddl/partition.go | 8 +- ddl/reorg.go | 6 +- ddl/reorg_test.go | 2 +- ddl/schema.go | 2 +- ddl/schema_test.go | 4 +- ddl/session_pool.go | 2 +- ddl/stat_test.go | 2 +- ddl/table.go | 2 +- ddl/table_split_test.go | 2 +- ddl/table_test.go | 4 +- ddl/util/event.go | 2 +- ddl/util/util.go | 2 +- distsql/distsql_test.go | 4 +- distsql/request_builder.go | 2 +- distsql/select_result.go | 2 +- distsql/stream.go | 2 +- domain/domain.go | 6 +- domain/domain_test.go | 4 +- domain/global_vars_cache.go | 2 +- domain/info.go | 2 +- domain/schema_checker_test.go | 2 +- domain/topn_slow_query.go | 2 +- executor/adapter.go | 19 +- executor/admin.go | 6 +- executor/admin_test.go | 2 +- executor/aggfuncs/aggfunc_test.go | 2 +- executor/aggfuncs/builder.go | 4 +- executor/aggfuncs/func_avg.go | 2 +- executor/aggfuncs/func_avg_test.go | 4 +- executor/aggregate.go | 2 +- executor/aggregate_test.go | 2 +- executor/analyze.go | 4 +- executor/analyze_test.go | 4 +- executor/batch_checker.go | 2 +- executor/builder.go | 6 +- executor/checksum.go | 2 +- executor/compiler.go | 2 +- executor/ddl.go | 6 +- executor/ddl_test.go | 6 +- executor/delete.go | 2 +- executor/distsql.go | 6 +- executor/distsql_test.go | 2 +- executor/errors.go | 4 +- executor/executor.go | 8 +- executor/executor_pkg_test.go | 6 +- executor/executor_test.go | 8 +- executor/grant.go | 6 +- executor/grant_test.go | 2 +- executor/index_lookup_join.go | 4 +- executor/insert.go | 2 +- executor/insert_common.go | 6 +- executor/insert_test.go | 2 +- executor/join.go | 2 +- executor/load_data.go | 2 +- executor/metrics_test.go | 2 +- executor/pkg_test.go | 4 +- executor/point_get.go | 4 +- executor/prepared.go | 19 +- executor/prepared_test.go | 2 +- executor/revoke.go | 4 +- executor/revoke_test.go | 2 +- executor/set.go | 6 +- executor/set_test.go | 2 +- executor/show.go | 12 +- executor/show_stats.go | 2 +- executor/show_test.go | 6 +- executor/simple.go | 10 +- executor/simple_test.go | 8 +- executor/statement_context_test.go | 2 +- executor/table_reader.go | 2 +- executor/trace.go | 2 +- executor/union_scan.go | 2 +- executor/update.go | 2 +- executor/write.go | 4 +- executor/write_test.go | 2 +- expression/aggregation/agg_to_pb.go | 2 +- expression/aggregation/agg_to_pb_test.go | 6 +- expression/aggregation/aggregation.go | 8 +- expression/aggregation/aggregation_test.go | 4 +- expression/aggregation/avg.go | 4 +- expression/aggregation/bench_test.go | 4 +- expression/aggregation/descriptor.go | 8 +- expression/bench_test.go | 8 +- expression/builtin.go | 8 +- expression/builtin_arithmetic.go | 4 +- expression/builtin_arithmetic_test.go | 4 +- expression/builtin_cast.go | 10 +- expression/builtin_cast_test.go | 6 +- expression/builtin_compare.go | 8 +- expression/builtin_compare_test.go | 4 +- expression/builtin_control.go | 4 +- expression/builtin_control_test.go | 2 +- expression/builtin_encryption.go | 4 +- expression/builtin_encryption_test.go | 4 +- expression/builtin_info.go | 2 +- expression/builtin_info_test.go | 8 +- expression/builtin_json.go | 4 +- expression/builtin_json_test.go | 2 +- expression/builtin_math.go | 2 +- expression/builtin_math_test.go | 6 +- expression/builtin_miscellaneous.go | 4 +- expression/builtin_miscellaneous_test.go | 2 +- expression/builtin_op.go | 4 +- expression/builtin_op_test.go | 2 +- expression/builtin_other.go | 2 +- expression/builtin_other_test.go | 4 +- expression/builtin_string.go | 6 +- expression/builtin_string_test.go | 8 +- expression/builtin_test.go | 8 +- expression/builtin_time.go | 4 +- expression/builtin_time_test.go | 6 +- expression/chunk_executor.go | 4 +- expression/column.go | 4 +- expression/column_test.go | 4 +- expression/constant.go | 4 +- expression/constant_fold.go | 2 +- expression/constant_propagation.go | 6 +- expression/constant_test.go | 6 +- expression/distsql_builtin.go | 4 +- expression/distsql_builtin_test.go | 2 +- expression/errors.go | 4 +- expression/evaluator_test.go | 10 +- expression/expr_to_pb.go | 8 +- expression/expr_to_pb_test.go | 6 +- expression/expression.go | 8 +- expression/expression_test.go | 6 +- expression/function_traits.go | 2 +- expression/function_traits_test.go | 2 +- expression/helper.go | 9 +- expression/helper_test.go | 6 +- expression/integration_test.go | 8 +- expression/scalar_function.go | 8 +- expression/scalar_function_test.go | 6 +- expression/schema.go | 2 +- expression/schema_test.go | 2 +- expression/simple_rewriter.go | 17 +- expression/typeinfer_test.go | 6 +- expression/util.go | 8 +- expression/util_test.go | 4 +- infoschema/builder.go | 2 +- infoschema/infoschema.go | 6 +- infoschema/infoschema_test.go | 4 +- infoschema/tables.go | 6 +- infoschema/tables_test.go | 2 +- kv/error.go | 4 +- kv/memdb_buffer.go | 2 +- kv/txn.go | 2 +- kv/union_store_test.go | 2 +- meta/autoid/autoid.go | 2 +- meta/autoid/autoid_test.go | 2 +- meta/meta.go | 6 +- meta/meta_test.go | 2 +- metrics/server.go | 2 +- model/ddl.go | 2 +- model/model.go | 7 +- model/model_test.go | 2 +- mysql/const_test.go | 4 +- owner/fail_test.go | 2 +- owner/manager.go | 2 +- parser/bench_test.go | 50 - parser/goyacc/main.go | 819 - perfschema/init.go | 6 +- perfschema/perfschema.go | 2 +- perfschema/tables.go | 2 +- planner/core/cache.go | 2 +- planner/core/cache_test.go | 2 +- planner/core/cacheable_checker.go | 7 +- planner/core/cacheable_checker_test.go | 9 +- planner/core/common_plans.go | 11 +- planner/core/errors.go | 4 +- planner/core/exhaust_physical_plans.go | 8 +- planner/core/expression_rewriter.go | 17 +- planner/core/expression_test.go | 8 +- planner/core/find_best_task.go | 4 +- planner/core/logical_plan_builder.go | 21 +- planner/core/logical_plan_test.go | 10 +- planner/core/logical_plans.go | 6 +- planner/core/logical_plans_test.go | 6 +- planner/core/optimizer.go | 2 +- planner/core/physical_plan_test.go | 4 +- planner/core/physical_plans.go | 4 +- planner/core/plan.go | 2 +- planner/core/plan_to_pb.go | 2 +- planner/core/plan_to_pb_test.go | 4 +- planner/core/planbuilder.go | 21 +- planner/core/planbuilder_test.go | 4 +- planner/core/point_get_plan.go | 13 +- planner/core/preprocess.go | 27 +- planner/core/preprocess_test.go | 6 +- planner/core/rule_aggregation_push_down.go | 6 +- planner/core/rule_build_key_info.go | 4 +- planner/core/rule_column_pruning.go | 4 +- planner/core/rule_decorrelate.go | 4 +- planner/core/rule_join_reorder.go | 2 +- planner/core/rule_max_min_eliminate.go | 4 +- planner/core/rule_predicate_push_down.go | 6 +- planner/core/task.go | 6 +- planner/core/trace.go | 2 +- planner/core/util.go | 2 +- privilege/privilege.go | 4 +- privilege/privileges/cache.go | 6 +- privilege/privileges/cache_test.go | 2 +- privilege/privileges/privileges.go | 6 +- privilege/privileges/privileges_test.go | 4 +- server/column.go | 2 +- server/conn.go | 22 +- server/conn_stmt.go | 2 +- server/conn_stmt_test.go | 4 +- server/conn_test.go | 2 +- server/driver.go | 2 +- server/driver_tidb.go | 11 +- server/driver_tidb_test.go | 8 +- server/http_handler.go | 4 +- server/http_handler_test.go | 4 +- server/http_status.go | 4 +- server/packetio.go | 4 +- server/server.go | 6 +- server/server_test.go | 5 +- server/statistics_handler.go | 2 +- server/tidb_test.go | 2 +- server/util.go | 2 +- server/util_test.go | 2 +- session/bench_test.go | 4 +- session/bootstrap.go | 6 +- session/bootstrap_test.go | 12 +- session/session.go | 48 +- session/session_test.go | 10 +- session/tidb.go | 19 +- session/tidb_test.go | 8 +- sessionctx/binloginfo/binloginfo.go | 2 +- sessionctx/binloginfo/binloginfo_test.go | 2 +- sessionctx/stmtctx/stmtctx.go | 2 +- sessionctx/variable/session.go | 8 +- sessionctx/variable/sysvar.go | 6 +- sessionctx/variable/tidb_vars.go | 3 +- sessionctx/variable/varsutil.go | 2 +- sessionctx/variable/varsutil_test.go | 4 +- statistics/bootstrap.go | 6 +- statistics/ddl.go | 9 +- statistics/ddl_test.go | 2 +- statistics/dump.go | 4 +- statistics/dump_test.go | 2 +- statistics/feedback.go | 2 +- statistics/feedback_test.go | 2 +- statistics/handle.go | 2 +- statistics/handle_test.go | 2 +- statistics/histogram.go | 6 +- statistics/sample.go | 20 +- statistics/sample_test.go | 6 +- statistics/scalar.go | 2 +- statistics/scalar_test.go | 2 +- statistics/selectivity.go | 4 +- statistics/selectivity_test.go | 4 +- statistics/statistics_test.go | 25 +- statistics/table.go | 4 +- statistics/update.go | 2 +- statistics/update_test.go | 4 +- store/mockstore/mocktikv/analyze.go | 12 +- store/mockstore/mocktikv/cop_handler_dag.go | 6 +- store/mockstore/mocktikv/executor.go | 4 +- store/mockstore/mocktikv/mvcc_leveldb.go | 2 +- store/mockstore/mocktikv/rpc.go | 2 +- store/tikv/2pc.go | 2 +- store/tikv/2pc_fail_test.go | 2 +- store/tikv/backoff.go | 4 +- store/tikv/client.go | 2 +- store/tikv/error.go | 4 +- store/tikv/gcworker/gc_worker.go | 2 +- store/tikv/isolation_test.go | 2 +- store/tikv/safepoint_test.go | 2 +- store/tikv/sql_fail_test.go | 2 +- store/tikv/tikv_test.go | 2 +- structure/structure.go | 2 +- table/column.go | 8 +- table/column_test.go | 6 +- table/index.go | 2 +- table/table.go | 6 +- table/tables/gen_expr.go | 6 +- table/tables/gen_expr_test.go | 2 +- table/tables/index.go | 4 +- table/tables/index_test.go | 4 +- table/tables/partition.go | 2 +- table/tables/tables.go | 4 +- table/tables/tables_test.go | 2 +- tablecodec/tablecodec.go | 4 +- tablecodec/tablecodec_test.go | 2 +- terror/terror.go | 2 +- tidb-server/main.go | 4 +- types/compare_test.go | 2 +- types/convert.go | 4 +- types/convert_test.go | 8 +- types/datum.go | 6 +- types/datum_eval.go | 2 +- types/datum_test.go | 2 +- types/errors.go | 9 +- types/etc.go | 70 +- types/etc_test.go | 4 +- types/eval_type.go | 26 +- types/field_type.go | 226 +- types/field_type_test.go | 4 +- types/format_test.go | 2 +- types/json/binary.go | 2 +- types/json/constants.go | 4 +- types/mydecimal.go | 4 +- types/parser_driver/value_expr.go | 177 + types/time.go | 4 +- types/time_test.go | 2 +- util/admin/admin.go | 13 +- util/admin/admin_test.go | 2 +- util/auth/auth.go | 2 +- util/charset/charset.go | 2 +- util/chunk/chunk_test.go | 2 +- util/chunk/codec.go | 2 +- util/chunk/codec_test.go | 2 +- util/chunk/compare.go | 2 +- util/chunk/iterator_test.go | 2 +- util/chunk/list_test.go | 2 +- util/chunk/mutrow.go | 2 +- util/chunk/mutrow_test.go | 2 +- util/chunk/row.go | 2 +- util/codec/bench_test.go | 2 +- util/codec/codec.go | 4 +- util/codec/codec_test.go | 4 +- util/filesort/filesort.go | 2 +- util/kvencoder/kv_encoder.go | 2 +- util/memory/action.go | 4 +- util/mock/context.go | 3 +- util/printer/printer.go | 2 +- util/ranger/checker.go | 4 +- util/ranger/detacher.go | 4 +- util/ranger/points.go | 6 +- util/ranger/ranger.go | 6 +- util/ranger/ranger_test.go | 2 +- util/sqlexec/restricted_sql_executor.go | 42 +- util/testkit/testkit.go | 10 +- vendor/github.com/BurntSushi/toml/.gitignore | 5 + vendor/github.com/BurntSushi/toml/.travis.yml | 15 + vendor/github.com/BurntSushi/toml/COMPATIBLE | 3 + vendor/github.com/BurntSushi/toml/Makefile | 19 + vendor/github.com/BurntSushi/toml/README.md | 218 + .../toml/cmd/toml-test-decoder/COPYING | 14 - .../toml/cmd/toml-test-encoder/COPYING | 14 - .../BurntSushi/toml/cmd/tomlv/COPYING | 14 - .../github.com/BurntSushi/toml/decode_test.go | 1461 ++ .../github.com/BurntSushi/toml/encode_test.go | 615 + vendor/github.com/BurntSushi/toml/session.vim | 1 + vendor/github.com/apache/thrift/.clang-format | 56 + vendor/github.com/apache/thrift/.dockerignore | 1 + vendor/github.com/apache/thrift/.editorconfig | 112 + .../github.com/apache/thrift/.gitattributes | 1 + vendor/github.com/apache/thrift/.gitignore | 326 + vendor/github.com/apache/thrift/.travis.yml | 199 + vendor/github.com/apache/thrift/CHANGES | 2366 +++ .../github.com/apache/thrift/CMakeLists.txt | 117 + .../github.com/apache/thrift/CONTRIBUTING.md | 49 + vendor/github.com/apache/thrift/Dockerfile | 61 + vendor/github.com/apache/thrift/Makefile.am | 131 + vendor/github.com/apache/thrift/README.md | 166 + .../github.com/apache/thrift/Thrift.podspec | 18 + vendor/github.com/apache/thrift/appveyor.yml | 93 + vendor/github.com/apache/thrift/bootstrap.sh | 54 + vendor/github.com/apache/thrift/bower.json | 16 + vendor/github.com/apache/thrift/cleanup.sh | 89 + vendor/github.com/apache/thrift/composer.json | 30 + vendor/github.com/apache/thrift/configure.ac | 959 ++ .../apache/thrift/contrib/fb303/LICENSE | 16 - vendor/github.com/apache/thrift/doap.rdf | 132 + .../github.com/apache/thrift/lib/Makefile.am | 109 + .../apache/thrift/lib/dart/LICENSE_HEADER | 16 - .../apache/thrift/lib/go/Makefile.am | 42 + .../github.com/apache/thrift/lib/go/README.md | 81 + .../apache/thrift/lib/go/coding_standards.md | 1 + .../go/thrift/application_exception_test.go | 41 + .../lib/go/thrift/binary_protocol_test.go | 28 + .../lib/go/thrift/buffered_transport_test.go | 29 + .../lib/go/thrift/compact_protocol_test.go | 53 + .../thrift/lib/go/thrift/exception_test.go | 69 + .../lib/go/thrift/framed_transport_test.go | 29 + .../thrift/lib/go/thrift/http_client_test.go | 106 + .../lib/go/thrift/iostream_transport_test.go | 52 + .../lib/go/thrift/json_protocol_test.go | 649 + .../lib/go/thrift/lowlevel_benchmarks_test.go | 396 + .../lib/go/thrift/memory_buffer_test.go | 29 + .../thrift/lib/go/thrift/protocol_test.go | 479 + .../lib/go/thrift/rich_transport_test.go | 85 + .../thrift/lib/go/thrift/serializer_test.go | 169 + .../lib/go/thrift/serializer_types_test.go | 633 + .../lib/go/thrift/server_socket_test.go | 50 + .../thrift/lib/go/thrift/server_test.go | 28 + .../go/thrift/simple_json_protocol_test.go | 715 + .../lib/go/thrift/transport_exception_test.go | 60 + .../thrift/lib/go/thrift/transport_test.go | 176 + .../lib/go/thrift/zlib_transport_test.go | 33 + vendor/github.com/apache/thrift/package.json | 54 + .../apache/thrift/sonar-project.properties | 140 + vendor/github.com/beorn7/perks/.gitignore | 2 + vendor/github.com/beorn7/perks/README.md | 31 + .../beorn7/perks/quantile/bench_test.go | 63 + .../beorn7/perks/quantile/example_test.go | 121 + .../beorn7/perks/quantile/exampledata.txt | 2388 +++ .../beorn7/perks/quantile/stream_test.go | 188 + .../blacktear23/go-proxyprotocol/.travis.yml | 12 + .../blacktear23/go-proxyprotocol/README.md | 37 + .../go-proxyprotocol/proxy_protocol_test.go | 353 + .../codahale/hdrhistogram/.travis.yml | 5 + .../codahale/hdrhistogram/README.md | 15 + .../codahale/hdrhistogram/hdr_test.go | 388 + .../codahale/hdrhistogram/window_test.go | 64 + vendor/github.com/coreos/etcd/.dockerignore | 1 + vendor/github.com/coreos/etcd/.gitignore | 22 + vendor/github.com/coreos/etcd/.godir | 1 + vendor/github.com/coreos/etcd/.header | 13 + vendor/github.com/coreos/etcd/.semaphore.sh | 16 + vendor/github.com/coreos/etcd/.travis.yml | 89 + vendor/github.com/coreos/etcd/CONTRIBUTING.md | 62 + vendor/github.com/coreos/etcd/DCO | 36 + vendor/github.com/coreos/etcd/Dockerfile | 6 + .../github.com/coreos/etcd/Dockerfile-release | 17 + .../coreos/etcd/Dockerfile-release.arm64 | 11 + .../coreos/etcd/Dockerfile-release.ppc64le | 11 + vendor/github.com/coreos/etcd/Dockerfile-test | 57 + vendor/github.com/coreos/etcd/MAINTAINERS | 8 + vendor/github.com/coreos/etcd/NEWS | 106 + vendor/github.com/coreos/etcd/Procfile | 6 + vendor/github.com/coreos/etcd/README.md | 135 + vendor/github.com/coreos/etcd/ROADMAP.md | 23 + vendor/github.com/coreos/etcd/V2Procfile | 5 + .../coreos/etcd/auth/authpb/auth.proto | 37 + vendor/github.com/coreos/etcd/auth/doc.go | 16 + vendor/github.com/coreos/etcd/auth/jwt.go | 137 + .../coreos/etcd/auth/range_perm_cache.go | 133 + .../coreos/etcd/auth/range_perm_cache_test.go | 59 + .../coreos/etcd/auth/simple_token.go | 220 + vendor/github.com/coreos/etcd/auth/store.go | 1059 ++ .../github.com/coreos/etcd/auth/store_test.go | 656 + .../coreos/etcd/bill-of-materials.json | 388 + .../etcd/bill-of-materials.override.json | 26 + vendor/github.com/coreos/etcd/build | 64 + vendor/github.com/coreos/etcd/build.bat | 1 + vendor/github.com/coreos/etcd/build.ps1 | 81 + .../github.com/coreos/etcd/client/README.md | 117 + .../coreos/etcd/client/auth_role.go | 237 + .../coreos/etcd/client/auth_user.go | 320 + .../coreos/etcd/client/cancelreq.go | 18 + .../github.com/coreos/etcd/client/client.go | 704 + .../coreos/etcd/client/client_test.go | 1074 ++ .../coreos/etcd/client/cluster_error.go | 37 + vendor/github.com/coreos/etcd/client/curl.go | 70 + .../github.com/coreos/etcd/client/discover.go | 40 + vendor/github.com/coreos/etcd/client/doc.go | 73 + .../coreos/etcd/client/fake_transport_test.go | 40 + .../coreos/etcd/client/keys.generated.go | 1087 ++ vendor/github.com/coreos/etcd/client/keys.go | 682 + .../coreos/etcd/client/keys_bench_test.go | 87 + .../coreos/etcd/client/keys_test.go | 1429 ++ .../github.com/coreos/etcd/client/members.go | 304 + .../coreos/etcd/client/members_test.go | 599 + vendor/github.com/coreos/etcd/client/util.go | 53 + .../github.com/coreos/etcd/clientv3/README.md | 85 + .../coreos/etcd/clientv3/client_test.go | 156 + .../coreos/etcd/clientv3/compact_op_test.go | 30 + .../etcd/clientv3/example_cluster_test.go | 104 + .../coreos/etcd/clientv3/example_kv_test.go | 283 + .../etcd/clientv3/example_lease_test.go | 142 + .../etcd/clientv3/example_maintenence_test.go | 62 + .../etcd/clientv3/example_metrics_test.go | 85 + .../coreos/etcd/clientv3/example_test.go | 77 + .../etcd/clientv3/example_watch_test.go | 101 + .../coreos/etcd/clientv3/main_test.go | 73 + .../coreos/etcd/clientv3/op_test.go | 38 + .../coreos/etcd/clientv3/txn_test.go | 105 + .../coreos/etcd/clientv3/watch_test.go | 55 + vendor/github.com/coreos/etcd/cmd/etcd | 1 - vendor/github.com/coreos/etcd/cmd/etcdctl | 1 - vendor/github.com/coreos/etcd/cmd/tools | 1 - vendor/github.com/coreos/etcd/cover | 31 + .../coreos/etcd/etcd.conf.yml.sample | 141 + .../coreos/etcd/etcdserver/api/capability.go | 86 + .../coreos/etcd/etcdserver/api/cluster.go | 41 + .../coreos/etcd/etcdserver/api/doc.go | 16 + .../coreos/etcd/etcdserver/api/v3rpc/auth.go | 157 + .../coreos/etcd/etcdserver/api/v3rpc/codec.go | 34 + .../coreos/etcd/etcdserver/api/v3rpc/grpc.go | 71 + .../etcd/etcdserver/api/v3rpc/header.go | 46 + .../etcd/etcdserver/api/v3rpc/interceptor.go | 144 + .../coreos/etcd/etcdserver/api/v3rpc/key.go | 259 + .../coreos/etcd/etcdserver/api/v3rpc/lease.go | 133 + .../etcd/etcdserver/api/v3rpc/maintenance.go | 190 + .../etcd/etcdserver/api/v3rpc/member.go | 103 + .../etcd/etcdserver/api/v3rpc/metrics.go | 38 + .../coreos/etcd/etcdserver/api/v3rpc/quota.go | 89 + .../api/v3rpc/rpctypes/error_test.go | 42 + .../coreos/etcd/etcdserver/api/v3rpc/util.go | 141 + .../coreos/etcd/etcdserver/api/v3rpc/watch.go | 446 + .../coreos/etcd/etcdserver/apply.go | 878 ++ .../coreos/etcd/etcdserver/apply_auth.go | 196 + .../coreos/etcd/etcdserver/apply_v2.go | 140 + .../coreos/etcd/etcdserver/backend.go | 81 + .../coreos/etcd/etcdserver/cluster_util.go | 258 + .../etcd/etcdserver/cluster_util_test.go | 131 + .../coreos/etcd/etcdserver/config.go | 209 + .../coreos/etcd/etcdserver/config_test.go | 196 + .../etcd/etcdserver/consistent_index.go | 33 + .../etcd/etcdserver/consistent_index_test.go | 25 + .../github.com/coreos/etcd/etcdserver/doc.go | 16 + .../coreos/etcd/etcdserver/errors.go | 46 + .../etcdserver/etcdserverpb/etcdserver.proto | 34 + .../etcdserverpb/raft_internal.proto | 74 + .../etcd/etcdserver/etcdserverpb/rpc.proto | 984 ++ .../coreos/etcd/etcdserver/metrics.go | 102 + .../coreos/etcd/etcdserver/quota.go | 121 + .../github.com/coreos/etcd/etcdserver/raft.go | 603 + .../coreos/etcd/etcdserver/raft_test.go | 221 + .../coreos/etcd/etcdserver/server.go | 1704 +++ .../coreos/etcd/etcdserver/server_test.go | 1662 ++ .../coreos/etcd/etcdserver/snapshot_merge.go | 73 + .../coreos/etcd/etcdserver/storage.go | 98 + .../github.com/coreos/etcd/etcdserver/util.go | 97 + .../coreos/etcd/etcdserver/util_test.go | 90 + .../coreos/etcd/etcdserver/v2_server.go | 125 + .../coreos/etcd/etcdserver/v3_server.go | 686 + vendor/github.com/coreos/etcd/glide.lock | 176 + vendor/github.com/coreos/etcd/glide.yaml | 134 + vendor/github.com/coreos/etcd/main.go | 29 + vendor/github.com/coreos/etcd/main_test.go | 35 + vendor/github.com/coreos/etcd/mvcc/doc.go | 16 + vendor/github.com/coreos/etcd/mvcc/index.go | 219 + .../github.com/coreos/etcd/mvcc/index_test.go | 286 + .../github.com/coreos/etcd/mvcc/key_index.go | 332 + .../coreos/etcd/mvcc/key_index_test.go | 654 + vendor/github.com/coreos/etcd/mvcc/kv.go | 147 + vendor/github.com/coreos/etcd/mvcc/kv_test.go | 831 + vendor/github.com/coreos/etcd/mvcc/kv_view.go | 53 + vendor/github.com/coreos/etcd/mvcc/kvstore.go | 459 + .../coreos/etcd/mvcc/kvstore_bench_test.go | 124 + .../coreos/etcd/mvcc/kvstore_compaction.go | 66 + .../etcd/mvcc/kvstore_compaction_test.go | 135 + .../coreos/etcd/mvcc/kvstore_test.go | 717 + .../coreos/etcd/mvcc/kvstore_txn.go | 253 + vendor/github.com/coreos/etcd/mvcc/metrics.go | 174 + .../coreos/etcd/mvcc/metrics_txn.go | 67 + .../coreos/etcd/mvcc/mvccpb/kv.proto | 49 + .../github.com/coreos/etcd/mvcc/revision.go | 67 + .../coreos/etcd/mvcc/revision_test.go | 53 + vendor/github.com/coreos/etcd/mvcc/util.go | 56 + .../coreos/etcd/mvcc/watchable_store.go | 522 + .../etcd/mvcc/watchable_store_bench_test.go | 200 + .../coreos/etcd/mvcc/watchable_store_test.go | 468 + .../coreos/etcd/mvcc/watchable_store_txn.go | 53 + vendor/github.com/coreos/etcd/mvcc/watcher.go | 171 + .../coreos/etcd/mvcc/watcher_bench_test.go | 38 + .../coreos/etcd/mvcc/watcher_group.go | 283 + .../coreos/etcd/mvcc/watcher_test.go | 344 + vendor/github.com/coreos/etcd/pkg/README.md | 2 + .../coreos/etcd/pkg/types/id_test.go | 95 + .../coreos/etcd/pkg/types/set_test.go | 186 + .../coreos/etcd/pkg/types/slice_test.go | 30 + .../coreos/etcd/pkg/types/urls_test.go | 169 + .../coreos/etcd/pkg/types/urlsmap_test.go | 155 + vendor/github.com/coreos/etcd/test | 373 + vendor/github.com/cznic/golex/lex/api.go | 410 - vendor/github.com/cznic/golex/lex/doc.go | 40 - vendor/github.com/cznic/mathutil/AUTHORS | 12 + vendor/github.com/cznic/mathutil/CONTRIBUTORS | 10 + vendor/github.com/cznic/mathutil/Makefile | 31 + vendor/github.com/cznic/mathutil/README | 10 + vendor/github.com/cznic/mathutil/all_test.go | 3530 +++++ .../cznic/mathutil/mersenne/LICENSE | 27 - .../cznic/mathutil/nist-sts-2-1-1-report | 267 + vendor/github.com/cznic/parser/nquads/LICENSE | 27 - vendor/github.com/cznic/parser/yacc/LICENSE | 27 - vendor/github.com/cznic/parser/yacc/api.go | 92 - vendor/github.com/cznic/parser/yacc/ast.go | 514 - .../github.com/cznic/parser/yacc/generate.go | 128 - .../github.com/cznic/parser/yacc/goscanner.go | 436 - vendor/github.com/cznic/parser/yacc/lexer.go | 656 - vendor/github.com/cznic/parser/yacc/parser.go | 938 -- .../github.com/cznic/parser/yacc/scanner.go | 856 -- vendor/github.com/cznic/sortutil/AUTHORS | 11 + vendor/github.com/cznic/sortutil/CONTRIBUTORS | 10 + vendor/github.com/cznic/sortutil/Makefile | 35 + vendor/github.com/cznic/sortutil/README | 4 + vendor/github.com/cznic/sortutil/all_test.go | 407 + vendor/github.com/cznic/strutil/LICENSE | 27 - vendor/github.com/cznic/strutil/strutil.go | 645 - vendor/github.com/cznic/y/api.go | 966 -- vendor/github.com/cznic/y/y.go | 2199 --- vendor/github.com/etcd-io/gofail/.travis.yml | 17 + vendor/github.com/etcd-io/gofail/DCO | 36 + vendor/github.com/etcd-io/gofail/Makefile | 21 + vendor/github.com/etcd-io/gofail/README.md | 113 + .../etcd-io/gofail/code-of-conduct.md | 61 + vendor/github.com/etcd-io/gofail/gofail.go | 195 + .../etcd-io/gofail/runtime/terms_test.go | 76 + .../github.com/go-sql-driver/mysql/.gitignore | 9 + .../go-sql-driver/mysql/.travis.yml | 89 + vendor/github.com/go-sql-driver/mysql/AUTHORS | 73 + .../go-sql-driver/mysql/CHANGELOG.md | 119 + .../go-sql-driver/mysql/CONTRIBUTING.md | 23 + .../github.com/go-sql-driver/mysql/README.md | 478 + .../mysql/benchmark_go18_test.go | 93 + .../go-sql-driver/mysql/benchmark_test.go | 246 + .../go-sql-driver/mysql/connection_test.go | 67 + .../go-sql-driver/mysql/driver_go18_test.go | 522 + .../go-sql-driver/mysql/driver_test.go | 2001 +++ .../go-sql-driver/mysql/dsn_test.go | 249 + .../go-sql-driver/mysql/errors_test.go | 42 + .../go-sql-driver/mysql/packets_test.go | 283 + .../go-sql-driver/mysql/utils_go18_test.go | 54 + .../go-sql-driver/mysql/utils_test.go | 277 + vendor/github.com/gogo/protobuf/.gitignore | 6 + vendor/github.com/gogo/protobuf/.mailmap | 8 + vendor/github.com/gogo/protobuf/.travis.yml | 22 + vendor/github.com/gogo/protobuf/AUTHORS | 15 + vendor/github.com/gogo/protobuf/CONTRIBUTORS | 23 + .../gogo/protobuf/GOLANG_CONTRIBUTORS | 5 + vendor/github.com/gogo/protobuf/Makefile | 167 + vendor/github.com/gogo/protobuf/README | 299 + vendor/github.com/gogo/protobuf/Readme.md | 151 + vendor/github.com/gogo/protobuf/bench.md | 190 + .../github.com/gogo/protobuf/custom_types.md | 68 + vendor/github.com/gogo/protobuf/extensions.md | 164 + .../gogo/protobuf/install-protobuf.sh | 28 + .../github.com/gogo/protobuf/proto/Makefile | 43 + .../gogo/protobuf/proto/all_test.go | 2421 +++ .../gogo/protobuf/proto/any_test.go | 300 + .../gogo/protobuf/proto/clone_test.go | 397 + .../gogo/protobuf/proto/decode_test.go | 259 + .../gogo/protobuf/proto/discard_test.go | 169 + .../gogo/protobuf/proto/encode_test.go | 84 + .../gogo/protobuf/proto/equal_test.go | 244 + .../gogo/protobuf/proto/extensions_test.go | 691 + .../gogo/protobuf/proto/map_test.go | 70 + .../gogo/protobuf/proto/message_set_test.go | 77 + .../gogo/protobuf/proto/proto3_test.go | 151 + .../gogo/protobuf/proto/size2_test.go | 63 + .../gogo/protobuf/proto/size_test.go | 190 + .../gogo/protobuf/proto/text_parser_test.go | 706 + .../gogo/protobuf/proto/text_test.go | 518 + vendor/github.com/golang/protobuf/.gitignore | 17 + vendor/github.com/golang/protobuf/.travis.yml | 30 + vendor/github.com/golang/protobuf/AUTHORS | 3 + .../github.com/golang/protobuf/CONTRIBUTORS | 3 + vendor/github.com/golang/protobuf/Makefile | 48 + vendor/github.com/golang/protobuf/README.md | 283 + .../golang/protobuf/jsonpb/jsonpb_test.go | 1150 ++ .../golang/protobuf/proto/all_test.go | 2410 +++ .../golang/protobuf/proto/any_test.go | 300 + .../golang/protobuf/proto/clone_test.go | 390 + .../golang/protobuf/proto/decode_test.go | 255 + .../golang/protobuf/proto/discard_test.go | 170 + .../golang/protobuf/proto/encode_test.go | 85 + .../golang/protobuf/proto/equal_test.go | 244 + .../golang/protobuf/proto/extensions_test.go | 688 + .../golang/protobuf/proto/map_test.go | 70 + .../golang/protobuf/proto/message_set_test.go | 77 + .../golang/protobuf/proto/proto3_test.go | 151 + .../golang/protobuf/proto/size2_test.go | 63 + .../golang/protobuf/proto/size_test.go | 191 + .../golang/protobuf/proto/text_parser_test.go | 706 + .../golang/protobuf/proto/text_test.go | 518 + .../protoc-gen-go/descriptor/descriptor.proto | 872 ++ .../golang/protobuf/protoc-gen-go/doc.go | 51 + .../protobuf/protoc-gen-go/golden_test.go | 422 + .../protobuf/protoc-gen-go/link_grpc.go | 34 + .../golang/protobuf/protoc-gen-go/main.go | 98 + .../golang/protobuf/ptypes/any/any.proto | 149 + .../golang/protobuf/ptypes/any_test.go | 113 + .../protobuf/ptypes/duration/duration.proto | 117 + .../golang/protobuf/ptypes/duration_test.go | 121 + .../protobuf/ptypes/struct/struct.proto | 96 + .../protobuf/ptypes/timestamp/timestamp.proto | 133 + .../golang/protobuf/ptypes/timestamp_test.go | 153 + .../github.com/golang/protobuf/regenerate.sh | 53 + vendor/github.com/golang/snappy/AUTHORS | 14 + vendor/github.com/golang/snappy/CONTRIBUTORS | 36 + vendor/github.com/golang/snappy/README | 7 + .../github.com/golang/snappy/snappy_test.go | 377 + vendor/github.com/google/btree/.travis.yml | 1 + vendor/github.com/google/btree/README.md | 12 + vendor/github.com/google/btree/btree_test.go | 689 + vendor/github.com/gorilla/context/.travis.yml | 19 + vendor/github.com/gorilla/context/README.md | 7 + .../gorilla/context/context_test.go | 161 + vendor/github.com/gorilla/mux/.travis.yml | 22 + vendor/github.com/gorilla/mux/README.md | 340 + vendor/github.com/gorilla/mux/bench_test.go | 49 + .../gorilla/mux/context_gorilla_test.go | 40 + .../gorilla/mux/context_native_test.go | 32 + vendor/github.com/gorilla/mux/mux_test.go | 1655 ++ vendor/github.com/gorilla/mux/old_test.go | 710 + .../go-grpc-middleware/.gitignore | 199 + .../go-grpc-middleware/.travis.yml | 26 + .../grpc-ecosystem/go-grpc-middleware/DOC.md | 164 + .../go-grpc-middleware/README.md | 86 + .../go-grpc-middleware/chain_test.go | 172 + .../go-grpc-middleware/checkup.sh | 21 + .../go-grpc-middleware/fixup.sh | 36 + .../go-grpc-middleware/test_all.sh | 14 + .../tracing/opentracing/DOC.md | 109 + .../tracing/opentracing/README.md | 1 + .../tracing/opentracing/interceptors_test.go | 186 + .../go-grpc-middleware/util/metautils/DOC.md | 114 + .../util/metautils/README.md | 1 + .../util/metautils/nicemd_test.go | 86 + .../go-grpc-middleware/wrappers_test.go | 52 + .../go-grpc-prometheus/.gitignore | 197 + .../go-grpc-prometheus/.travis.yml | 13 + .../go-grpc-prometheus/README.md | 245 + .../go-grpc-prometheus/client_test.go | 212 + .../go-grpc-prometheus/server_test.go | 307 + .../golang_protobuf_extensions/.travis.yml | 8 + .../Makefile.TRAVIS | 15 + .../golang_protobuf_extensions/README.md | 20 + .../pbutil/.gitignore | 1 + .../pbutil/Makefile | 7 + .../pbutil/all_test.go | 178 + .../pbutil/decode_test.go | 99 + .../pbutil/encode_test.go | 67 + vendor/github.com/ngaut/pools/id_pool_test.go | 118 + .../github.com/ngaut/pools/numbered_test.go | 84 + .../ngaut/pools/resource_pool_test.go | 487 + .../github.com/ngaut/pools/roundrobin_test.go | 126 + .../y/LICENSE => ngaut/pools/vitess_license} | 9 +- vendor/github.com/ngaut/sync2/atomic_test.go | 32 + vendor/github.com/ngaut/sync2/cond_test.go | 276 + .../github.com/ngaut/sync2/semaphore_test.go | 41 + .../ngaut/sync2/service_manager_test.go | 176 + .../LICENSE => ngaut/sync2/vitess_license} | 9 +- .../opentracing/basictracer-go/.gitignore | 2 + .../opentracing/basictracer-go/.travis.yml | 13 + .../opentracing/basictracer-go/Makefile | 26 + .../opentracing/basictracer-go/README.md | 8 + .../opentracing/basictracer-go/bench_test.go | 184 + .../basictracer-go/concurrency_test.go | 119 + .../basictracer-go/propagation_test.go | 98 + .../basictracer-go/recorder_test.go | 29 + .../opentracing/basictracer-go/span_test.go | 224 + .../basictracer-go/testutil_test.go | 125 + .../basictracer-go/wire/carrier_test.go | 38 + .../basictracer-go/wire/wire.proto | 10 + .../opentracing/opentracing-go/.gitignore | 13 + .../opentracing/opentracing-go/.travis.yml | 14 + .../opentracing/opentracing-go/CHANGELOG.md | 14 + .../opentracing/opentracing-go/Makefile | 32 + .../opentracing/opentracing-go/README.md | 147 + .../opentracing-go/ext/tags_test.go | 148 + .../opentracing-go/gocontext_test.go | 81 + .../opentracing-go/log/field_test.go | 39 + .../opentracing-go/options_test.go | 31 + .../opentracing-go/propagation_test.go | 93 + .../opentracing-go/testtracer_test.go | 138 + vendor/github.com/petar/GoLLRB/.gitignore | 23 + vendor/github.com/petar/GoLLRB/AUTHORS | 4 + vendor/github.com/petar/GoLLRB/README.md | 66 + .../petar/GoLLRB/llrb/iterator_test.go | 76 + .../github.com/petar/GoLLRB/llrb/llrb_test.go | 239 + vendor/github.com/pingcap/check/.gitignore | 4 + vendor/github.com/pingcap/check/README.md | 13 + vendor/github.com/pingcap/check/TODO | 2 + .../pingcap/check/benchmark_test.go | 92 + .../pingcap/check/bootstrap_test.go | 83 + .../github.com/pingcap/check/check.v1_license | 25 + vendor/github.com/pingcap/check/check_test.go | 207 + .../pingcap/check/checkers2_test.go | 46 + .../github.com/pingcap/check/checkers_test.go | 273 + .../github.com/pingcap/check/export_test.go | 9 + .../github.com/pingcap/check/fixture_test.go | 484 + .../pingcap/check/foundation_test.go | 336 + .../pingcap/check/godropbox_license | 27 + .../github.com/pingcap/check/helpers_test.go | 520 + .../github.com/pingcap/check/printer_test.go | 94 + vendor/github.com/pingcap/check/run_test.go | 470 + vendor/github.com/pingcap/errors/.gitignore | 24 + vendor/github.com/pingcap/errors/.travis.yml | 14 + vendor/github.com/pingcap/errors/LICENSE | 23 + vendor/github.com/pingcap/errors/README.md | 52 + vendor/github.com/pingcap/errors/appveyor.yml | 32 + .../github.com/pingcap/errors/bench_test.go | 110 + vendor/github.com/pingcap/errors/errors.go | 324 + .../github.com/pingcap/errors/errors_test.go | 371 + .../github.com/pingcap/errors/example_test.go | 205 + .../github.com/pingcap/errors/format_test.go | 534 + vendor/github.com/pingcap/errors/group.go | 42 + .../github.com/pingcap/errors/juju_adaptor.go | 100 + vendor/github.com/pingcap/errors/stack.go | 226 + .../github.com/pingcap/errors/stack_test.go | 289 + .../github.com/pingcap/goleveldb/.travis.yml | 12 + vendor/github.com/pingcap/goleveldb/README.md | 107 + .../pingcap/goleveldb/leveldb/batch_test.go | 147 + .../pingcap/goleveldb/leveldb/bench_test.go | 507 + .../goleveldb/leveldb/cache/bench_test.go | 29 + .../goleveldb/leveldb/cache/cache_test.go | 563 + .../pingcap/goleveldb/leveldb/corrupt_test.go | 496 + .../pingcap/goleveldb/leveldb/db_test.go | 2925 ++++ .../goleveldb/leveldb/external_test.go | 117 + .../goleveldb/leveldb/filter/bloom_test.go | 142 + .../leveldb/iterator/array_iter_test.go | 30 + .../leveldb/iterator/indexed_iter_test.go | 83 + .../leveldb/iterator/iter_suite_test.go | 11 + .../leveldb/iterator/merged_iter_test.go | 60 + .../goleveldb/leveldb/journal/journal_test.go | 818 + .../pingcap/goleveldb/leveldb/key_test.go | 133 + .../goleveldb/leveldb/leveldb_suite_test.go | 11 + .../goleveldb/leveldb/memdb/bench_test.go | 98 + .../leveldb/memdb/memdb_suite_test.go | 57 + .../goleveldb/leveldb/memdb/memdb_test.go | 135 + .../goleveldb/leveldb/session_record_test.go | 62 + .../leveldb/storage/file_storage_test.go | 176 + .../leveldb/storage/mem_storage_test.go | 65 + .../goleveldb/leveldb/table/block_test.go | 139 + .../leveldb/table/table_suite_test.go | 11 + .../goleveldb/leveldb/table/table_test.go | 123 + .../goleveldb/leveldb/testutil_test.go | 91 + .../goleveldb/leveldb/util/buffer_test.go | 369 + .../goleveldb/leveldb/util/hash_test.go | 46 + .../pingcap/goleveldb/leveldb/version_test.go | 181 + .../github.com/pingcap/kvproto/.gitattributes | 3 + vendor/github.com/pingcap/kvproto/.gitignore | 12 + vendor/github.com/pingcap/kvproto/Cargo.toml | 13 + vendor/github.com/pingcap/kvproto/Makefile | 36 + vendor/github.com/pingcap/kvproto/README.md | 12 + vendor/github.com/pingcap/kvproto/common.sh | 36 + .../github.com/pingcap/kvproto/generate_go.sh | 83 + .../pingcap/kvproto/generate_rust.sh | 54 + vendor/github.com/pingcap/kvproto/glide.lock | 104 + vendor/github.com/pingcap/kvproto/glide.yaml | 81 + vendor/github.com/pingcap/parser/.gitignore | 6 + .../thrift/lib/hs => pingcap/parser}/LICENSE | 1 - vendor/github.com/pingcap/parser/Makefile | 37 + vendor/github.com/pingcap/parser/README.md | 56 + vendor/github.com/pingcap/parser/ast/ast.go | 156 + vendor/github.com/pingcap/parser/ast/base.go | 101 + vendor/github.com/pingcap/parser/ast/ddl.go | 894 ++ .../github.com/pingcap/parser/ast/ddl_test.go | 64 + vendor/github.com/pingcap/parser/ast/dml.go | 1211 ++ .../github.com/pingcap/parser/ast/dml_test.go | 74 + .../pingcap/parser/ast/expressions.go | 912 ++ .../pingcap/parser/ast/expressions_test.go | 103 + vendor/github.com/pingcap/parser/ast/flag.go | 156 + .../pingcap/parser/ast/flag_test.go | 153 + .../pingcap/parser/ast/format_test.go | 98 + .../pingcap/parser/ast/functions.go | 598 + .../pingcap/parser/ast/functions_test.go | 39 + vendor/github.com/pingcap/parser/ast/misc.go | 880 ++ .../pingcap/parser/ast/misc_test.go | 190 + .../pingcap/parser/ast/read_only_checker.go | 61 + .../parser/ast/read_only_checker_test.go | 44 + vendor/github.com/pingcap/parser/ast/stats.go | 91 + vendor/github.com/pingcap/parser/auth/auth.go | 103 + .../pingcap/parser/auth/auth_test.go | 50 + .../github.com/pingcap/parser/bench_test.go | 66 + .../pingcap/parser/charset/charset.go | 417 + .../pingcap/parser/charset/charset_test.go | 94 + .../pingcap/parser/charset/encoding_table.go | 260 + vendor/github.com/pingcap/parser/circle.yml | 18 + .../pingcap/parser}/consistent_test.go | 2 +- .../pingcap/parser/format/format.go | 195 + .../pingcap/parser/format/format_test.go | 60 + vendor/github.com/pingcap/parser/go.mod1 | 16 + vendor/github.com/pingcap/parser/go.sum1 | 257 + .../github.com/pingcap/parser}/lexer.go | 12 +- .../github.com/pingcap/parser}/lexer_test.go | 14 +- .../github.com/pingcap/parser}/misc.go | 42 +- vendor/github.com/pingcap/parser/model/ddl.go | 384 + .../github.com/pingcap/parser/model/flags.go | 43 + .../github.com/pingcap/parser/model/model.go | 582 + .../pingcap/parser/model/model_test.go | 307 + .../pingcap/parser/mysql/charset.go | 608 + .../github.com/pingcap/parser/mysql/const.go | 700 + .../pingcap/parser/mysql/errcode.go | 910 ++ .../pingcap/parser/mysql/errname.go | 907 ++ .../github.com/pingcap/parser/mysql/error.go | 71 + .../pingcap/parser/mysql/error_test.go | 37 + .../pingcap/parser/mysql/locale_format.go | 98 + .../github.com/pingcap/parser/mysql/state.go | 258 + .../github.com/pingcap/parser/mysql/type.go | 155 + .../pingcap/parser/mysql/type_test.go | 37 + .../github.com/pingcap/parser/mysql/util.go | 93 + .../pingcap/parser}/opcode/opcode.go | 0 .../pingcap/parser}/opcode/opcode_test.go | 0 vendor/github.com/pingcap/parser/parser.go | 12533 ++++++++++++++++ .../github.com/pingcap/parser}/parser.y | 636 +- .../pingcap/parser/parser_example_test.go | 39 + .../github.com/pingcap/parser}/parser_test.go | 193 +- .../pingcap/parser/terror/terror.go | 344 + .../pingcap/parser/terror/terror_test.go | 163 + vendor/github.com/pingcap/parser/test.sh | 11 + vendor/github.com/pingcap/parser/types/etc.go | 112 + .../pingcap/parser/types/eval_type.go | 42 + .../pingcap/parser/types/field_type.go | 258 + .../github.com/pingcap/parser}/yy_parser.go | 29 +- vendor/github.com/pingcap/pd/.gitignore | 9 + vendor/github.com/pingcap/pd/.travis.yml | 19 + vendor/github.com/pingcap/pd/CHANGELOG.md | 126 + vendor/github.com/pingcap/pd/CONTRIBUTING.md | 67 + vendor/github.com/pingcap/pd/Dockerfile | 14 + vendor/github.com/pingcap/pd/Jenkinsfile | 11 + vendor/github.com/pingcap/pd/Makefile | 124 + vendor/github.com/pingcap/pd/README.md | 113 + vendor/github.com/pingcap/pd/circle.yml | 12 + .../pingcap/pd/client/client_test.go | 315 + vendor/github.com/pingcap/pd/go.mod | 63 + vendor/github.com/pingcap/pd/go.sum | 118 + vendor/github.com/pingcap/pd/revive.toml | 52 + vendor/github.com/pingcap/pd/tools.json | 53 + .../github.com/pingcap/tidb-tools/.gitignore | 4 + .../github.com/pingcap/tidb-tools/Jenkinsfile | 7 + vendor/github.com/pingcap/tidb-tools/Makefile | 71 + .../github.com/pingcap/tidb-tools/README.md | 41 + .../github.com/pingcap/tidb-tools/glide.lock | 459 + .../github.com/pingcap/tidb-tools/glide.yaml | 139 + .../pingcap/tidb-tools/pkg/etcd/etcd_test.go | 184 + .../pingcap/tidb-tools/pkg/utils/urls_test.go | 73 + .../tidb-binlog/pump_client/client_test.go | 138 + vendor/github.com/pingcap/tipb/.gitignore | 2 + vendor/github.com/pingcap/tipb/Cargo.toml | 9 + vendor/github.com/pingcap/tipb/Makefile | 10 + vendor/github.com/pingcap/tipb/README.md | 36 + vendor/github.com/pingcap/tipb/_help.sh | 25 + .../pingcap/tipb/generate-binlog.sh | 16 + vendor/github.com/pingcap/tipb/generate-go.sh | 14 + .../github.com/pingcap/tipb/generate-rust.sh | 38 + .../tipb/sharedbytes/sharedbytes_test.go | 30 + vendor/github.com/pkg/errors/.gitignore | 24 + vendor/github.com/pkg/errors/.travis.yml | 14 + vendor/github.com/pkg/errors/README.md | 52 + vendor/github.com/pkg/errors/appveyor.yml | 32 + vendor/github.com/pkg/errors/bench_test.go | 110 + vendor/github.com/pkg/errors/errors_test.go | 371 + vendor/github.com/pkg/errors/example_test.go | 205 + vendor/github.com/pkg/errors/format_test.go | 534 + vendor/github.com/pkg/errors/stack_test.go | 289 + .../prometheus/client_golang/.gitignore | 26 + .../prometheus/client_golang/.travis.yml | 9 + .../prometheus/client_golang/AUTHORS.md | 18 + .../prometheus/client_golang/CHANGELOG.md | 109 + .../prometheus/client_golang/CONTRIBUTING.md | 18 + .../prometheus/client_golang/README.md | 45 + .../prometheus/client_golang/VERSION | 1 + .../client_golang/prometheus/.gitignore | 1 + .../client_golang/prometheus/README.md | 1 + .../prometheus/benchmark_test.go | 183 + .../client_golang/prometheus/counter_test.go | 58 + .../prometheus/example_clustermanager_test.go | 118 + .../client_golang/prometheus/examples_test.go | 751 + .../prometheus/expvar_collector_test.go | 97 + .../client_golang/prometheus/gauge_test.go | 182 + .../prometheus/go_collector_test.go | 123 + .../prometheus/histogram_test.go | 326 + .../client_golang/prometheus/http_test.go | 121 + .../client_golang/prometheus/metric_test.go | 35 + .../prometheus/process_collector_test.go | 58 + .../prometheus/push/examples_test.go | 56 + .../prometheus/push/push_test.go | 176 + .../client_golang/prometheus/registry_test.go | 545 + .../client_golang/prometheus/summary_test.go | 347 + .../client_golang/prometheus/vec_test.go | 312 + .../prometheus/client_model/.gitignore | 1 + .../prometheus/client_model/AUTHORS.md | 13 + .../prometheus/client_model/CONTRIBUTING.md | 18 + .../prometheus/client_model/Makefile | 61 + .../prometheus/client_model/README.md | 26 + .../prometheus/client_model/metrics.proto | 81 + .../prometheus/client_model/pom.xml | 130 + .../prometheus/client_model/setup.py | 23 + .../github.com/prometheus/common/.travis.yml | 7 + .../github.com/prometheus/common/AUTHORS.md | 11 + .../prometheus/common/CONTRIBUTING.md | 18 + vendor/github.com/prometheus/common/README.md | 12 + .../prometheus/common/expfmt/bench_test.go | 171 + .../prometheus/common/expfmt/decode_test.go | 367 + .../common/expfmt/text_create_test.go | 443 + .../common/expfmt/text_parse_test.go | 588 + .../bitbucket.org/ww/goautoneg/README.txt | 67 + .../ww/goautoneg/autoneg_test.go | 33 + .../prometheus/common/model/alert_test.go | 118 + .../prometheus/common/model/labels_test.go | 129 + .../prometheus/common/model/metric_test.go | 121 + .../prometheus/common/model/signature_test.go | 314 + .../prometheus/common/model/silence_test.go | 228 + .../prometheus/common/model/time_test.go | 129 + .../prometheus/common/model/value_test.go | 417 + .../github.com/prometheus/procfs/.travis.yml | 5 + .../github.com/prometheus/procfs/AUTHORS.md | 20 + .../prometheus/procfs/CONTRIBUTING.md | 18 + vendor/github.com/prometheus/procfs/Makefile | 6 + vendor/github.com/prometheus/procfs/README.md | 10 + .../github.com/prometheus/procfs/fs_test.go | 13 + .../github.com/prometheus/procfs/ipvs_test.go | 190 + .../prometheus/procfs/mdstat_test.go | 31 + .../prometheus/procfs/proc_io_test.go | 33 + .../prometheus/procfs/proc_limits_test.go | 31 + .../prometheus/procfs/proc_stat_test.go | 110 + .../github.com/prometheus/procfs/proc_test.go | 160 + .../github.com/prometheus/procfs/stat_test.go | 14 + vendor/github.com/sirupsen/logrus/.gitignore | 1 + vendor/github.com/sirupsen/logrus/.travis.yml | 8 + .../github.com/sirupsen/logrus/CHANGELOG.md | 94 + vendor/github.com/sirupsen/logrus/README.md | 479 + .../sirupsen/logrus/alt_exit_test.go | 74 + .../github.com/sirupsen/logrus/entry_test.go | 77 + .../sirupsen/logrus/formatter_bench_test.go | 101 + .../github.com/sirupsen/logrus/hook_test.go | 122 + .../sirupsen/logrus/json_formatter_test.go | 199 + .../sirupsen/logrus/logger_bench_test.go | 61 + .../github.com/sirupsen/logrus/logrus_test.go | 386 + .../sirupsen/logrus/text_formatter_test.go | 87 + .../github.com/spaolacci/murmur3/.gitignore | 22 + vendor/github.com/spaolacci/murmur3/README.md | 84 + .../spaolacci/murmur3/murmur_test.go | 251 + vendor/github.com/twinj/uuid/.gitignore | 1 + vendor/github.com/twinj/uuid/.travis.yml | 8 + vendor/github.com/twinj/uuid/README.md | 86 + vendor/github.com/twinj/uuid/array_test.go | 31 + vendor/github.com/twinj/uuid/rfc4122_test.go | 209 + vendor/github.com/twinj/uuid/saver_test.go | 100 + vendor/github.com/twinj/uuid/state_test.go | 92 + vendor/github.com/twinj/uuid/struct_test.go | 32 + .../github.com/twinj/uuid/timestamp_test.go | 20 + vendor/github.com/twinj/uuid/uuid_test.go | 119 + vendor/github.com/twinj/uuid/uuids_test.go | 449 + .../uber/jaeger-client-go/.gitignore | 14 + .../uber/jaeger-client-go/.gitmodules | 3 + .../uber/jaeger-client-go/.travis.yml | 40 + .../uber/jaeger-client-go/CHANGELOG.md | 118 + .../uber/jaeger-client-go/CONTRIBUTING.md | 75 + .../github.com/uber/jaeger-client-go/Makefile | 103 + .../uber/jaeger-client-go/README.md | 182 + .../jaeger-client-go/config/config_test.go | 182 + .../jaeger-client-go/config/example_test.go | 86 + .../jaeger-client-go/config/options_test.go | 67 + .../uber/jaeger-client-go/constants_test.go | 35 + .../uber/jaeger-client-go/context_test.go | 116 + .../uber/jaeger-client-go/glide.lock | 70 + .../uber/jaeger-client-go/glide.yaml | 33 + .../jaeger_thrift_span_test.go | 394 + .../uber/jaeger-client-go/log/logger_test.go | 32 + .../uber/jaeger-client-go/logger_test.go | 46 + .../uber/jaeger-client-go/metrics_test.go | 56 + .../uber/jaeger-client-go/observer_test.go | 115 + .../uber/jaeger-client-go/propagation_test.go | 270 + .../uber/jaeger-client-go/reporter_test.go | 278 + .../jaeger-client-go/rpcmetrics/README.md | 5 + .../rpcmetrics/endpoints_test.go | 49 + .../rpcmetrics/metrics_test.go | 67 + .../rpcmetrics/normalizer_test.go | 40 + .../rpcmetrics/observer_test.go | 183 + .../uber/jaeger-client-go/sampler_test.go | 709 + .../uber/jaeger-client-go/span_test.go | 96 + .../uber/jaeger-client-go/thrift/.nocover | 0 .../uber/jaeger-client-go/tracer_test.go | 358 + .../jaeger-client-go/transport_udp_test.go | 227 + .../jaeger-client-go/utils/http_json_test.go | 64 + .../utils/rate_limiter_test.go | 81 + .../uber/jaeger-client-go/utils/utils_test.go | 97 + .../uber/jaeger-client-go/zipkin_test.go | 74 + .../zipkin_thrift_span_test.go | 335 + vendor/github.com/uber/jaeger-lib/.gitignore | 11 + vendor/github.com/uber/jaeger-lib/.travis.yml | 20 + .../uber/jaeger-lib/CONTRIBUTING.md | 56 + vendor/github.com/uber/jaeger-lib/Makefile | 83 + vendor/github.com/uber/jaeger-lib/README.md | 16 + vendor/github.com/uber/jaeger-lib/glide.lock | 63 + vendor/github.com/uber/jaeger-lib/glide.yaml | 11 + .../uber/jaeger-lib/metrics/local_test.go | 116 + .../uber/jaeger-lib/metrics/metrics_test.go | 89 + vendor/golang.org/x/net/.gitattributes | 10 + vendor/golang.org/x/net/.gitignore | 2 + vendor/golang.org/x/net/AUTHORS | 3 + vendor/golang.org/x/net/CONTRIBUTING.md | 31 + vendor/golang.org/x/net/CONTRIBUTORS | 3 + vendor/golang.org/x/net/README | 3 + vendor/golang.org/x/net/codereview.cfg | 1 + .../golang.org/x/net/context/context_test.go | 583 + .../x/net/context/withtimeout_test.go | 26 + vendor/golang.org/x/net/http2/.gitignore | 2 + vendor/golang.org/x/net/http2/Dockerfile | 51 + vendor/golang.org/x/net/http2/Makefile | 3 + vendor/golang.org/x/net/http2/README | 20 + .../golang.org/x/net/http2/databuffer_test.go | 155 + vendor/golang.org/x/net/http2/errors_test.go | 24 + vendor/golang.org/x/net/http2/flow_test.go | 53 + vendor/golang.org/x/net/http2/frame_test.go | 1191 ++ vendor/golang.org/x/net/http2/go18_test.go | 79 + vendor/golang.org/x/net/http2/gotrack_test.go | 33 + .../x/net/http2/hpack/encode_test.go | 386 + .../x/net/http2/hpack/hpack_test.go | 718 + .../x/net/http2/hpack/tables_test.go | 214 + vendor/golang.org/x/net/http2/http2_test.go | 199 + vendor/golang.org/x/net/http2/pipe_test.go | 109 + .../x/net/http2/server_push_test.go | 521 + vendor/golang.org/x/net/http2/server_test.go | 3731 +++++ .../golang.org/x/net/http2/transport_test.go | 2916 ++++ .../x/net/http2/writesched_priority_test.go | 541 + .../x/net/http2/writesched_random_test.go | 44 + .../golang.org/x/net/http2/writesched_test.go | 125 + vendor/golang.org/x/net/http2/z_spec_test.go | 356 + vendor/golang.org/x/net/idna/example_test.go | 65 + vendor/golang.org/x/net/idna/idna_test.go | 43 + vendor/golang.org/x/net/idna/punycode_test.go | 198 + .../internal/timeseries/timeseries_test.go | 170 + .../x/net/lex/httplex/httplex_test.go | 119 + .../golang.org/x/net/trace/histogram_test.go | 325 + vendor/golang.org/x/net/trace/trace_test.go | 178 + vendor/golang.org/x/sys/.gitattributes | 10 + vendor/golang.org/x/sys/.gitignore | 2 + vendor/golang.org/x/sys/AUTHORS | 3 + vendor/golang.org/x/sys/CONTRIBUTING.md | 26 + vendor/golang.org/x/sys/CONTRIBUTORS | 3 + vendor/golang.org/x/sys/README.md | 18 + vendor/golang.org/x/sys/codereview.cfg | 1 + vendor/golang.org/x/sys/unix/.gitignore | 2 + vendor/golang.org/x/sys/unix/README.md | 173 + vendor/golang.org/x/sys/unix/creds_test.go | 149 + .../golang.org/x/sys/unix/dev_darwin_test.go | 51 + .../x/sys/unix/dev_dragonfly_test.go | 50 + .../golang.org/x/sys/unix/dev_linux_test.go | 53 + .../golang.org/x/sys/unix/dev_netbsd_test.go | 50 + .../golang.org/x/sys/unix/dev_openbsd_test.go | 54 + .../golang.org/x/sys/unix/dev_solaris_test.go | 51 + vendor/golang.org/x/sys/unix/example_test.go | 19 + vendor/golang.org/x/sys/unix/export_test.go | 9 + vendor/golang.org/x/sys/unix/mkall.sh | 188 + vendor/golang.org/x/sys/unix/mkerrors.sh | 596 + vendor/golang.org/x/sys/unix/mksyscall.pl | 341 + .../x/sys/unix/mksyscall_solaris.pl | 289 + .../golang.org/x/sys/unix/mksysctl_openbsd.pl | 264 + .../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 + .../x/sys/unix/mksysnum_dragonfly.pl | 50 + .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 50 + .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 + .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 + .../golang.org/x/sys/unix/mmap_unix_test.go | 35 + vendor/golang.org/x/sys/unix/openbsd_test.go | 113 + .../golang.org/x/sys/unix/syscall_bsd_test.go | 93 + .../x/sys/unix/syscall_freebsd_test.go | 297 + .../x/sys/unix/syscall_linux_test.go | 373 + .../x/sys/unix/syscall_solaris_test.go | 55 + vendor/golang.org/x/sys/unix/syscall_test.go | 60 + .../x/sys/unix/syscall_unix_test.go | 614 + .../golang.org/x/sys/unix/timestruct_test.go | 54 + vendor/golang.org/x/text/.gitattributes | 10 + vendor/golang.org/x/text/.gitignore | 6 + vendor/golang.org/x/text/AUTHORS | 3 + vendor/golang.org/x/text/CONTRIBUTING.md | 31 + vendor/golang.org/x/text/CONTRIBUTORS | 3 + vendor/golang.org/x/text/README | 23 + vendor/golang.org/x/text/codereview.cfg | 1 + vendor/golang.org/x/text/doc.go | 13 + .../x/text/encoding/charmap/charmap_test.go | 258 + .../x/text/encoding/encoding_test.go | 290 + .../x/text/encoding/example_test.go | 42 + .../x/text/encoding/japanese/all_test.go | 248 + .../x/text/encoding/korean/all_test.go | 94 + .../encoding/simplifiedchinese/all_test.go | 143 + .../encoding/traditionalchinese/all_test.go | 114 + .../x/text/encoding/unicode/unicode_test.go | 499 + vendor/golang.org/x/text/gen.go | 292 + vendor/golang.org/x/text/internal/gen.go | 52 + vendor/golang.org/x/text/internal/gen_test.go | 38 + vendor/golang.org/x/text/internal/internal.go | 51 + .../x/text/internal/internal_test.go | 38 + vendor/golang.org/x/text/internal/match.go | 67 + .../golang.org/x/text/internal/match_test.go | 56 + vendor/golang.org/x/text/internal/tables.go | 116 + .../x/text/internal/triegen/data_test.go | 875 ++ .../internal/triegen/example_compact_test.go | 71 + .../x/text/internal/triegen/example_test.go | 148 + .../x/text/internal/triegen/gen_test.go | 68 + .../x/text/internal/ucd/example_test.go | 81 + .../x/text/internal/ucd/ucd_test.go | 105 + vendor/golang.org/x/text/runes/cond_test.go | 282 + .../golang.org/x/text/runes/example_test.go | 60 + vendor/golang.org/x/text/runes/runes_test.go | 664 + .../x/text/secure/bidirule/bench_test.go | 54 + .../x/text/secure/bidirule/bidirule_test.go | 825 + vendor/golang.org/x/text/secure/doc.go | 6 + .../x/text/transform/examples_test.go | 37 + .../x/text/transform/transform_test.go | 1317 ++ .../x/text/unicode/bidi/core_test.go | 224 + .../x/text/unicode/bidi/ranges_test.go | 53 + .../x/text/unicode/bidi/tables_test.go | 82 + .../x/text/unicode/cldr/cldr_test.go | 27 + .../x/text/unicode/cldr/collate_test.go | 275 + .../x/text/unicode/cldr/data_test.go | 186 + .../x/text/unicode/cldr/examples_test.go | 21 + .../x/text/unicode/cldr/resolve_test.go | 368 + .../x/text/unicode/cldr/slice_test.go | 175 + vendor/golang.org/x/text/unicode/doc.go | 8 + .../x/text/unicode/norm/composition_test.go | 130 + .../x/text/unicode/norm/example_iter_test.go | 82 + .../x/text/unicode/norm/example_test.go | 27 + .../x/text/unicode/norm/forminfo_test.go | 54 + .../x/text/unicode/norm/iter_test.go | 98 + .../x/text/unicode/norm/norm_test.go | 14 + .../x/text/unicode/norm/normalize_test.go | 1287 ++ .../x/text/unicode/norm/readwriter_test.go | 56 + .../x/text/unicode/norm/transform_test.go | 101 + .../x/text/unicode/norm/ucd_test.go | 275 + .../x/text/unicode/rangetable/merge_test.go | 184 + .../unicode/rangetable/rangetable_test.go | 55 + vendor/google.golang.org/genproto/.travis.yml | 12 + .../genproto/CONTRIBUTING.md | 27 + vendor/google.golang.org/genproto/README.md | 28 + .../googleapis/api/authorization_config.pb.go | 80 + .../googleapis/api/experimental.pb.go | 56 + vendor/google.golang.org/genproto/regen.go | 123 + vendor/google.golang.org/genproto/regen.sh | 77 + vendor/google.golang.org/grpc/.travis.yml | 24 + vendor/google.golang.org/grpc/AUTHORS | 1 + vendor/google.golang.org/grpc/CONTRIBUTING.md | 36 + vendor/google.golang.org/grpc/Makefile | 48 + vendor/google.golang.org/grpc/README.md | 45 + vendor/google.golang.org/grpc/backoff_test.go | 29 + .../balancer/roundrobin/roundrobin_test.go | 477 + .../grpc/balancer_switching_test.go | 443 + .../google.golang.org/grpc/balancer_test.go | 804 + vendor/google.golang.org/grpc/call_test.go | 292 + .../google.golang.org/grpc/clientconn_test.go | 677 + vendor/google.golang.org/grpc/codec_test.go | 32 + vendor/google.golang.org/grpc/codegen.sh | 17 + .../grpc/codes/codes_test.go | 64 + .../grpc/credentials/credentials_test.go | 206 + .../encoding/proto/proto_benchmark_test.go | 100 + .../grpc/encoding/proto/proto_test.go | 129 + .../grpclb/grpc_lb_v1/messages/messages.proto | 155 + .../grpc/grpclb/grpclb_test.go | 981 ++ .../grpc/grpclb_util_test.go | 219 + .../grpc/grpclog/loggerv2_test.go | 62 + .../grpc/health/grpc_health_v1/health.proto | 44 + .../google.golang.org/grpc/health/health.go | 72 + .../grpc/metadata/metadata_test.go | 251 + .../grpc/naming/dns_resolver_test.go | 315 + .../grpc/naming/go17_test.go | 42 + .../grpc/naming/go18_test.go | 41 + .../grpc/picker_wrapper_test.go | 160 + .../google.golang.org/grpc/pickfirst_test.go | 360 + vendor/google.golang.org/grpc/proxy_test.go | 182 + .../grpc/resolver/dns/dns_resolver_test.go | 936 ++ .../grpc/resolver/dns/go17_test.go | 50 + .../grpc/resolver/dns/go18_test.go | 49 + .../grpc/resolver_conn_wrapper_test.go | 113 + .../google.golang.org/grpc/rpc_util_test.go | 286 + vendor/google.golang.org/grpc/server_test.go | 136 + .../grpc/service_config_test.go | 386 + .../grpc/stats/stats_test.go | 1257 ++ .../grpc/status/status_test.go | 329 + .../google.golang.org/grpc/stickiness_test.go | 288 + .../grpc/transport/handler_server_test.go | 482 + .../grpc/transport/http_util_test.go | 176 + .../grpc/transport/transport_test.go | 2151 +++ vendor/google.golang.org/grpc/vet.sh | 93 + .../natefinch/lumberjack.v2/.gitignore | 23 + .../natefinch/lumberjack.v2/README.md | 174 + .../natefinch/lumberjack.v2/example_test.go | 18 + .../natefinch/lumberjack.v2/linux_test.go | 104 + .../lumberjack.v2/lumberjack_test.go | 690 + .../natefinch/lumberjack.v2/rotate_test.go | 27 + .../natefinch/lumberjack.v2/testing_test.go | 91 + x-server/conn.go | 2 +- x-server/server.go | 4 +- 1311 files changed, 188606 insertions(+), 10672 deletions(-) delete mode 100644 parser/bench_test.go delete mode 100644 parser/goyacc/main.go create mode 100644 types/parser_driver/value_expr.go create mode 100644 vendor/github.com/BurntSushi/toml/.gitignore create mode 100644 vendor/github.com/BurntSushi/toml/.travis.yml create mode 100644 vendor/github.com/BurntSushi/toml/COMPATIBLE create mode 100644 vendor/github.com/BurntSushi/toml/Makefile create mode 100644 vendor/github.com/BurntSushi/toml/README.md delete mode 100644 vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING delete mode 100644 vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING delete mode 100644 vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING create mode 100644 vendor/github.com/BurntSushi/toml/decode_test.go create mode 100644 vendor/github.com/BurntSushi/toml/encode_test.go create mode 100644 vendor/github.com/BurntSushi/toml/session.vim create mode 100644 vendor/github.com/apache/thrift/.clang-format create mode 100644 vendor/github.com/apache/thrift/.dockerignore create mode 100644 vendor/github.com/apache/thrift/.editorconfig create mode 100644 vendor/github.com/apache/thrift/.gitattributes create mode 100644 vendor/github.com/apache/thrift/.gitignore create mode 100644 vendor/github.com/apache/thrift/.travis.yml create mode 100644 vendor/github.com/apache/thrift/CHANGES create mode 100644 vendor/github.com/apache/thrift/CMakeLists.txt create mode 100644 vendor/github.com/apache/thrift/CONTRIBUTING.md create mode 100644 vendor/github.com/apache/thrift/Dockerfile create mode 100644 vendor/github.com/apache/thrift/Makefile.am create mode 100644 vendor/github.com/apache/thrift/README.md create mode 100644 vendor/github.com/apache/thrift/Thrift.podspec create mode 100644 vendor/github.com/apache/thrift/appveyor.yml create mode 100644 vendor/github.com/apache/thrift/bootstrap.sh create mode 100644 vendor/github.com/apache/thrift/bower.json create mode 100644 vendor/github.com/apache/thrift/cleanup.sh create mode 100644 vendor/github.com/apache/thrift/composer.json create mode 100644 vendor/github.com/apache/thrift/configure.ac delete mode 100644 vendor/github.com/apache/thrift/contrib/fb303/LICENSE create mode 100644 vendor/github.com/apache/thrift/doap.rdf create mode 100644 vendor/github.com/apache/thrift/lib/Makefile.am delete mode 100644 vendor/github.com/apache/thrift/lib/dart/LICENSE_HEADER create mode 100644 vendor/github.com/apache/thrift/lib/go/Makefile.am create mode 100644 vendor/github.com/apache/thrift/lib/go/README.md create mode 100644 vendor/github.com/apache/thrift/lib/go/coding_standards.md create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/server_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go create mode 100644 vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go create mode 100644 vendor/github.com/apache/thrift/package.json create mode 100644 vendor/github.com/apache/thrift/sonar-project.properties create mode 100644 vendor/github.com/beorn7/perks/.gitignore create mode 100644 vendor/github.com/beorn7/perks/README.md create mode 100644 vendor/github.com/beorn7/perks/quantile/bench_test.go create mode 100644 vendor/github.com/beorn7/perks/quantile/example_test.go create mode 100644 vendor/github.com/beorn7/perks/quantile/exampledata.txt create mode 100644 vendor/github.com/beorn7/perks/quantile/stream_test.go create mode 100644 vendor/github.com/blacktear23/go-proxyprotocol/.travis.yml create mode 100644 vendor/github.com/blacktear23/go-proxyprotocol/README.md create mode 100644 vendor/github.com/blacktear23/go-proxyprotocol/proxy_protocol_test.go create mode 100644 vendor/github.com/codahale/hdrhistogram/.travis.yml create mode 100644 vendor/github.com/codahale/hdrhistogram/README.md create mode 100644 vendor/github.com/codahale/hdrhistogram/hdr_test.go create mode 100644 vendor/github.com/codahale/hdrhistogram/window_test.go create mode 100644 vendor/github.com/coreos/etcd/.dockerignore create mode 100644 vendor/github.com/coreos/etcd/.gitignore create mode 100644 vendor/github.com/coreos/etcd/.godir create mode 100644 vendor/github.com/coreos/etcd/.header create mode 100644 vendor/github.com/coreos/etcd/.semaphore.sh create mode 100644 vendor/github.com/coreos/etcd/.travis.yml create mode 100644 vendor/github.com/coreos/etcd/CONTRIBUTING.md create mode 100644 vendor/github.com/coreos/etcd/DCO create mode 100644 vendor/github.com/coreos/etcd/Dockerfile create mode 100644 vendor/github.com/coreos/etcd/Dockerfile-release create mode 100644 vendor/github.com/coreos/etcd/Dockerfile-release.arm64 create mode 100644 vendor/github.com/coreos/etcd/Dockerfile-release.ppc64le create mode 100644 vendor/github.com/coreos/etcd/Dockerfile-test create mode 100644 vendor/github.com/coreos/etcd/MAINTAINERS create mode 100644 vendor/github.com/coreos/etcd/NEWS create mode 100644 vendor/github.com/coreos/etcd/Procfile create mode 100644 vendor/github.com/coreos/etcd/README.md create mode 100644 vendor/github.com/coreos/etcd/ROADMAP.md create mode 100644 vendor/github.com/coreos/etcd/V2Procfile create mode 100644 vendor/github.com/coreos/etcd/auth/authpb/auth.proto create mode 100644 vendor/github.com/coreos/etcd/auth/doc.go create mode 100644 vendor/github.com/coreos/etcd/auth/jwt.go create mode 100644 vendor/github.com/coreos/etcd/auth/range_perm_cache.go create mode 100644 vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go create mode 100644 vendor/github.com/coreos/etcd/auth/simple_token.go create mode 100644 vendor/github.com/coreos/etcd/auth/store.go create mode 100644 vendor/github.com/coreos/etcd/auth/store_test.go create mode 100644 vendor/github.com/coreos/etcd/bill-of-materials.json create mode 100644 vendor/github.com/coreos/etcd/bill-of-materials.override.json create mode 100644 vendor/github.com/coreos/etcd/build create mode 100644 vendor/github.com/coreos/etcd/build.bat create mode 100644 vendor/github.com/coreos/etcd/build.ps1 create mode 100644 vendor/github.com/coreos/etcd/client/README.md create mode 100644 vendor/github.com/coreos/etcd/client/auth_role.go create mode 100644 vendor/github.com/coreos/etcd/client/auth_user.go create mode 100644 vendor/github.com/coreos/etcd/client/cancelreq.go create mode 100644 vendor/github.com/coreos/etcd/client/client.go create mode 100644 vendor/github.com/coreos/etcd/client/client_test.go create mode 100644 vendor/github.com/coreos/etcd/client/cluster_error.go create mode 100644 vendor/github.com/coreos/etcd/client/curl.go create mode 100644 vendor/github.com/coreos/etcd/client/discover.go create mode 100644 vendor/github.com/coreos/etcd/client/doc.go create mode 100644 vendor/github.com/coreos/etcd/client/fake_transport_test.go create mode 100644 vendor/github.com/coreos/etcd/client/keys.generated.go create mode 100644 vendor/github.com/coreos/etcd/client/keys.go create mode 100644 vendor/github.com/coreos/etcd/client/keys_bench_test.go create mode 100644 vendor/github.com/coreos/etcd/client/keys_test.go create mode 100644 vendor/github.com/coreos/etcd/client/members.go create mode 100644 vendor/github.com/coreos/etcd/client/members_test.go create mode 100644 vendor/github.com/coreos/etcd/client/util.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/README.md create mode 100644 vendor/github.com/coreos/etcd/clientv3/client_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/compact_op_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_cluster_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_kv_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_lease_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_maintenence_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_metrics_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/example_watch_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/main_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/op_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/txn_test.go create mode 100644 vendor/github.com/coreos/etcd/clientv3/watch_test.go delete mode 120000 vendor/github.com/coreos/etcd/cmd/etcd delete mode 120000 vendor/github.com/coreos/etcd/cmd/etcdctl delete mode 120000 vendor/github.com/coreos/etcd/cmd/tools create mode 100644 vendor/github.com/coreos/etcd/cover create mode 100644 vendor/github.com/coreos/etcd/etcd.conf.yml.sample create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/capability.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/cluster.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/doc.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/auth.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/codec.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/grpc.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/header.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/key.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/lease.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/maintenance.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/member.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/metrics.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/quota.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/apply.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/apply_auth.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/apply_v2.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/backend.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/cluster_util.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/cluster_util_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/config.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/config_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/consistent_index.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/consistent_index_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/doc.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/errors.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto create mode 100644 vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto create mode 100644 vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto create mode 100644 vendor/github.com/coreos/etcd/etcdserver/metrics.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/quota.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/raft.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/raft_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/server.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/server_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/snapshot_merge.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/storage.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/util.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/util_test.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/v2_server.go create mode 100644 vendor/github.com/coreos/etcd/etcdserver/v3_server.go create mode 100644 vendor/github.com/coreos/etcd/glide.lock create mode 100644 vendor/github.com/coreos/etcd/glide.yaml create mode 100644 vendor/github.com/coreos/etcd/main.go create mode 100644 vendor/github.com/coreos/etcd/main_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/doc.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/index.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/index_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/key_index.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/key_index_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kv.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kv_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kv_view.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore_bench_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore_compaction.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore_compaction_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/kvstore_txn.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/metrics.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/metrics_txn.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto create mode 100644 vendor/github.com/coreos/etcd/mvcc/revision.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/revision_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/util.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watchable_store.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watchable_store_bench_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watchable_store_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watchable_store_txn.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watcher.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watcher_bench_test.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watcher_group.go create mode 100644 vendor/github.com/coreos/etcd/mvcc/watcher_test.go create mode 100644 vendor/github.com/coreos/etcd/pkg/README.md create mode 100644 vendor/github.com/coreos/etcd/pkg/types/id_test.go create mode 100644 vendor/github.com/coreos/etcd/pkg/types/set_test.go create mode 100644 vendor/github.com/coreos/etcd/pkg/types/slice_test.go create mode 100644 vendor/github.com/coreos/etcd/pkg/types/urls_test.go create mode 100644 vendor/github.com/coreos/etcd/pkg/types/urlsmap_test.go create mode 100644 vendor/github.com/coreos/etcd/test delete mode 100644 vendor/github.com/cznic/golex/lex/api.go delete mode 100644 vendor/github.com/cznic/golex/lex/doc.go create mode 100644 vendor/github.com/cznic/mathutil/AUTHORS create mode 100644 vendor/github.com/cznic/mathutil/CONTRIBUTORS create mode 100644 vendor/github.com/cznic/mathutil/Makefile create mode 100644 vendor/github.com/cznic/mathutil/README create mode 100644 vendor/github.com/cznic/mathutil/all_test.go delete mode 100644 vendor/github.com/cznic/mathutil/mersenne/LICENSE create mode 100644 vendor/github.com/cznic/mathutil/nist-sts-2-1-1-report delete mode 100644 vendor/github.com/cznic/parser/nquads/LICENSE delete mode 100644 vendor/github.com/cznic/parser/yacc/LICENSE delete mode 100644 vendor/github.com/cznic/parser/yacc/api.go delete mode 100644 vendor/github.com/cznic/parser/yacc/ast.go delete mode 100644 vendor/github.com/cznic/parser/yacc/generate.go delete mode 100644 vendor/github.com/cznic/parser/yacc/goscanner.go delete mode 100644 vendor/github.com/cznic/parser/yacc/lexer.go delete mode 100644 vendor/github.com/cznic/parser/yacc/parser.go delete mode 100644 vendor/github.com/cznic/parser/yacc/scanner.go create mode 100644 vendor/github.com/cznic/sortutil/AUTHORS create mode 100644 vendor/github.com/cznic/sortutil/CONTRIBUTORS create mode 100644 vendor/github.com/cznic/sortutil/Makefile create mode 100644 vendor/github.com/cznic/sortutil/README create mode 100644 vendor/github.com/cznic/sortutil/all_test.go delete mode 100644 vendor/github.com/cznic/strutil/LICENSE delete mode 100644 vendor/github.com/cznic/strutil/strutil.go delete mode 100644 vendor/github.com/cznic/y/api.go delete mode 100644 vendor/github.com/cznic/y/y.go create mode 100644 vendor/github.com/etcd-io/gofail/.travis.yml create mode 100644 vendor/github.com/etcd-io/gofail/DCO create mode 100644 vendor/github.com/etcd-io/gofail/Makefile create mode 100644 vendor/github.com/etcd-io/gofail/README.md create mode 100644 vendor/github.com/etcd-io/gofail/code-of-conduct.md create mode 100644 vendor/github.com/etcd-io/gofail/gofail.go create mode 100644 vendor/github.com/etcd-io/gofail/runtime/terms_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/.gitignore create mode 100644 vendor/github.com/go-sql-driver/mysql/.travis.yml create mode 100644 vendor/github.com/go-sql-driver/mysql/AUTHORS create mode 100644 vendor/github.com/go-sql-driver/mysql/CHANGELOG.md create mode 100644 vendor/github.com/go-sql-driver/mysql/CONTRIBUTING.md create mode 100644 vendor/github.com/go-sql-driver/mysql/README.md create mode 100644 vendor/github.com/go-sql-driver/mysql/benchmark_go18_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/benchmark_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/connection_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/driver_go18_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/driver_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/dsn_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/errors_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/packets_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/utils_go18_test.go create mode 100644 vendor/github.com/go-sql-driver/mysql/utils_test.go create mode 100644 vendor/github.com/gogo/protobuf/.gitignore create mode 100644 vendor/github.com/gogo/protobuf/.mailmap create mode 100644 vendor/github.com/gogo/protobuf/.travis.yml create mode 100644 vendor/github.com/gogo/protobuf/AUTHORS create mode 100644 vendor/github.com/gogo/protobuf/CONTRIBUTORS create mode 100644 vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS create mode 100644 vendor/github.com/gogo/protobuf/Makefile create mode 100644 vendor/github.com/gogo/protobuf/README create mode 100644 vendor/github.com/gogo/protobuf/Readme.md create mode 100644 vendor/github.com/gogo/protobuf/bench.md create mode 100644 vendor/github.com/gogo/protobuf/custom_types.md create mode 100644 vendor/github.com/gogo/protobuf/extensions.md create mode 100644 vendor/github.com/gogo/protobuf/install-protobuf.sh create mode 100644 vendor/github.com/gogo/protobuf/proto/Makefile create mode 100644 vendor/github.com/gogo/protobuf/proto/all_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/any_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/clone_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/decode_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/discard_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/encode_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/equal_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/extensions_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/map_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/message_set_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/proto3_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/size2_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/size_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/text_parser_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/text_test.go create mode 100644 vendor/github.com/golang/protobuf/.gitignore create mode 100644 vendor/github.com/golang/protobuf/.travis.yml create mode 100644 vendor/github.com/golang/protobuf/AUTHORS create mode 100644 vendor/github.com/golang/protobuf/CONTRIBUTORS create mode 100644 vendor/github.com/golang/protobuf/Makefile create mode 100644 vendor/github.com/golang/protobuf/README.md create mode 100644 vendor/github.com/golang/protobuf/jsonpb/jsonpb_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/all_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/any_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/clone_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/decode_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/discard_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/encode_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/equal_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/extensions_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/map_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/message_set_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/proto3_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/size2_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/size_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/text_parser_test.go create mode 100644 vendor/github.com/golang/protobuf/proto/text_test.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/doc.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/golden_test.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/main.go create mode 100644 vendor/github.com/golang/protobuf/ptypes/any/any.proto create mode 100644 vendor/github.com/golang/protobuf/ptypes/any_test.go create mode 100644 vendor/github.com/golang/protobuf/ptypes/duration/duration.proto create mode 100644 vendor/github.com/golang/protobuf/ptypes/duration_test.go create mode 100644 vendor/github.com/golang/protobuf/ptypes/struct/struct.proto create mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto create mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp_test.go create mode 100644 vendor/github.com/golang/protobuf/regenerate.sh create mode 100644 vendor/github.com/golang/snappy/AUTHORS create mode 100644 vendor/github.com/golang/snappy/CONTRIBUTORS create mode 100644 vendor/github.com/golang/snappy/README create mode 100644 vendor/github.com/golang/snappy/snappy_test.go create mode 100644 vendor/github.com/google/btree/.travis.yml create mode 100644 vendor/github.com/google/btree/README.md create mode 100644 vendor/github.com/google/btree/btree_test.go create mode 100644 vendor/github.com/gorilla/context/.travis.yml create mode 100644 vendor/github.com/gorilla/context/README.md create mode 100644 vendor/github.com/gorilla/context/context_test.go create mode 100644 vendor/github.com/gorilla/mux/.travis.yml create mode 100644 vendor/github.com/gorilla/mux/README.md create mode 100644 vendor/github.com/gorilla/mux/bench_test.go create mode 100644 vendor/github.com/gorilla/mux/context_gorilla_test.go create mode 100644 vendor/github.com/gorilla/mux/context_native_test.go create mode 100644 vendor/github.com/gorilla/mux/mux_test.go create mode 100644 vendor/github.com/gorilla/mux/old_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/.gitignore create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/.travis.yml create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/DOC.md create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/README.md create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/checkup.sh create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/fixup.sh create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/test_all.sh create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing/DOC.md create mode 120000 vendor/github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing/README.md create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing/interceptors_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/DOC.md create mode 120000 vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/README.md create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/nicemd_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/wrappers_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_test.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_test.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/Makefile.TRAVIS create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/README.md create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go create mode 100644 vendor/github.com/ngaut/pools/id_pool_test.go create mode 100644 vendor/github.com/ngaut/pools/numbered_test.go create mode 100644 vendor/github.com/ngaut/pools/resource_pool_test.go create mode 100644 vendor/github.com/ngaut/pools/roundrobin_test.go rename vendor/github.com/{cznic/y/LICENSE => ngaut/pools/vitess_license} (83%) create mode 100644 vendor/github.com/ngaut/sync2/atomic_test.go create mode 100644 vendor/github.com/ngaut/sync2/cond_test.go create mode 100644 vendor/github.com/ngaut/sync2/semaphore_test.go create mode 100644 vendor/github.com/ngaut/sync2/service_manager_test.go rename vendor/github.com/{cznic/golex/LICENSE => ngaut/sync2/vitess_license} (83%) create mode 100644 vendor/github.com/opentracing/basictracer-go/.gitignore create mode 100644 vendor/github.com/opentracing/basictracer-go/.travis.yml create mode 100644 vendor/github.com/opentracing/basictracer-go/Makefile create mode 100644 vendor/github.com/opentracing/basictracer-go/README.md create mode 100644 vendor/github.com/opentracing/basictracer-go/bench_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/concurrency_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/propagation_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/recorder_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/span_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/testutil_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/wire/carrier_test.go create mode 100644 vendor/github.com/opentracing/basictracer-go/wire/wire.proto create mode 100644 vendor/github.com/opentracing/opentracing-go/.gitignore create mode 100644 vendor/github.com/opentracing/opentracing-go/.travis.yml create mode 100644 vendor/github.com/opentracing/opentracing-go/CHANGELOG.md create mode 100644 vendor/github.com/opentracing/opentracing-go/Makefile create mode 100644 vendor/github.com/opentracing/opentracing-go/README.md create mode 100644 vendor/github.com/opentracing/opentracing-go/ext/tags_test.go create mode 100644 vendor/github.com/opentracing/opentracing-go/gocontext_test.go create mode 100644 vendor/github.com/opentracing/opentracing-go/log/field_test.go create mode 100644 vendor/github.com/opentracing/opentracing-go/options_test.go create mode 100644 vendor/github.com/opentracing/opentracing-go/propagation_test.go create mode 100644 vendor/github.com/opentracing/opentracing-go/testtracer_test.go create mode 100644 vendor/github.com/petar/GoLLRB/.gitignore create mode 100644 vendor/github.com/petar/GoLLRB/AUTHORS create mode 100644 vendor/github.com/petar/GoLLRB/README.md create mode 100644 vendor/github.com/petar/GoLLRB/llrb/iterator_test.go create mode 100644 vendor/github.com/petar/GoLLRB/llrb/llrb_test.go create mode 100644 vendor/github.com/pingcap/check/.gitignore create mode 100644 vendor/github.com/pingcap/check/README.md create mode 100644 vendor/github.com/pingcap/check/TODO create mode 100644 vendor/github.com/pingcap/check/benchmark_test.go create mode 100644 vendor/github.com/pingcap/check/bootstrap_test.go create mode 100644 vendor/github.com/pingcap/check/check.v1_license create mode 100644 vendor/github.com/pingcap/check/check_test.go create mode 100644 vendor/github.com/pingcap/check/checkers2_test.go create mode 100644 vendor/github.com/pingcap/check/checkers_test.go create mode 100644 vendor/github.com/pingcap/check/export_test.go create mode 100644 vendor/github.com/pingcap/check/fixture_test.go create mode 100644 vendor/github.com/pingcap/check/foundation_test.go create mode 100644 vendor/github.com/pingcap/check/godropbox_license create mode 100644 vendor/github.com/pingcap/check/helpers_test.go create mode 100644 vendor/github.com/pingcap/check/printer_test.go create mode 100644 vendor/github.com/pingcap/check/run_test.go create mode 100644 vendor/github.com/pingcap/errors/.gitignore create mode 100644 vendor/github.com/pingcap/errors/.travis.yml create mode 100644 vendor/github.com/pingcap/errors/LICENSE create mode 100644 vendor/github.com/pingcap/errors/README.md create mode 100644 vendor/github.com/pingcap/errors/appveyor.yml create mode 100644 vendor/github.com/pingcap/errors/bench_test.go create mode 100644 vendor/github.com/pingcap/errors/errors.go create mode 100644 vendor/github.com/pingcap/errors/errors_test.go create mode 100644 vendor/github.com/pingcap/errors/example_test.go create mode 100644 vendor/github.com/pingcap/errors/format_test.go create mode 100644 vendor/github.com/pingcap/errors/group.go create mode 100644 vendor/github.com/pingcap/errors/juju_adaptor.go create mode 100644 vendor/github.com/pingcap/errors/stack.go create mode 100644 vendor/github.com/pingcap/errors/stack_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/.travis.yml create mode 100644 vendor/github.com/pingcap/goleveldb/README.md create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/batch_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/bench_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/cache/bench_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/cache/cache_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/corrupt_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/db_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/external_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/filter/bloom_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/iterator/array_iter_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/iterator/indexed_iter_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/iterator/iter_suite_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/iterator/merged_iter_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/journal/journal_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/key_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/leveldb_suite_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/memdb/bench_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/memdb/memdb_suite_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/memdb/memdb_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/session_record_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/storage/file_storage_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/storage/mem_storage_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/table/block_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/table/table_suite_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/table/table_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/testutil_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/util/buffer_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/util/hash_test.go create mode 100644 vendor/github.com/pingcap/goleveldb/leveldb/version_test.go create mode 100644 vendor/github.com/pingcap/kvproto/.gitattributes create mode 100644 vendor/github.com/pingcap/kvproto/.gitignore create mode 100644 vendor/github.com/pingcap/kvproto/Cargo.toml create mode 100644 vendor/github.com/pingcap/kvproto/Makefile create mode 100644 vendor/github.com/pingcap/kvproto/README.md create mode 100644 vendor/github.com/pingcap/kvproto/common.sh create mode 100644 vendor/github.com/pingcap/kvproto/generate_go.sh create mode 100644 vendor/github.com/pingcap/kvproto/generate_rust.sh create mode 100644 vendor/github.com/pingcap/kvproto/glide.lock create mode 100644 vendor/github.com/pingcap/kvproto/glide.yaml create mode 100644 vendor/github.com/pingcap/parser/.gitignore rename vendor/github.com/{apache/thrift/lib/hs => pingcap/parser}/LICENSE (99%) create mode 100644 vendor/github.com/pingcap/parser/Makefile create mode 100644 vendor/github.com/pingcap/parser/README.md create mode 100644 vendor/github.com/pingcap/parser/ast/ast.go create mode 100644 vendor/github.com/pingcap/parser/ast/base.go create mode 100644 vendor/github.com/pingcap/parser/ast/ddl.go create mode 100644 vendor/github.com/pingcap/parser/ast/ddl_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/dml.go create mode 100644 vendor/github.com/pingcap/parser/ast/dml_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/expressions.go create mode 100644 vendor/github.com/pingcap/parser/ast/expressions_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/flag.go create mode 100644 vendor/github.com/pingcap/parser/ast/flag_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/format_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/functions.go create mode 100644 vendor/github.com/pingcap/parser/ast/functions_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/misc.go create mode 100644 vendor/github.com/pingcap/parser/ast/misc_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/read_only_checker.go create mode 100644 vendor/github.com/pingcap/parser/ast/read_only_checker_test.go create mode 100644 vendor/github.com/pingcap/parser/ast/stats.go create mode 100644 vendor/github.com/pingcap/parser/auth/auth.go create mode 100644 vendor/github.com/pingcap/parser/auth/auth_test.go create mode 100644 vendor/github.com/pingcap/parser/bench_test.go create mode 100644 vendor/github.com/pingcap/parser/charset/charset.go create mode 100644 vendor/github.com/pingcap/parser/charset/charset_test.go create mode 100644 vendor/github.com/pingcap/parser/charset/encoding_table.go create mode 100644 vendor/github.com/pingcap/parser/circle.yml rename {parser => vendor/github.com/pingcap/parser}/consistent_test.go (97%) create mode 100644 vendor/github.com/pingcap/parser/format/format.go create mode 100644 vendor/github.com/pingcap/parser/format/format_test.go create mode 100644 vendor/github.com/pingcap/parser/go.mod1 create mode 100644 vendor/github.com/pingcap/parser/go.sum1 rename {parser => vendor/github.com/pingcap/parser}/lexer.go (97%) rename {parser => vendor/github.com/pingcap/parser}/lexer_test.go (95%) rename {parser => vendor/github.com/pingcap/parser}/misc.go (94%) create mode 100644 vendor/github.com/pingcap/parser/model/ddl.go create mode 100644 vendor/github.com/pingcap/parser/model/flags.go create mode 100644 vendor/github.com/pingcap/parser/model/model.go create mode 100644 vendor/github.com/pingcap/parser/model/model_test.go create mode 100644 vendor/github.com/pingcap/parser/mysql/charset.go create mode 100644 vendor/github.com/pingcap/parser/mysql/const.go create mode 100644 vendor/github.com/pingcap/parser/mysql/errcode.go create mode 100644 vendor/github.com/pingcap/parser/mysql/errname.go create mode 100644 vendor/github.com/pingcap/parser/mysql/error.go create mode 100644 vendor/github.com/pingcap/parser/mysql/error_test.go create mode 100644 vendor/github.com/pingcap/parser/mysql/locale_format.go create mode 100644 vendor/github.com/pingcap/parser/mysql/state.go create mode 100644 vendor/github.com/pingcap/parser/mysql/type.go create mode 100644 vendor/github.com/pingcap/parser/mysql/type_test.go create mode 100644 vendor/github.com/pingcap/parser/mysql/util.go rename {parser => vendor/github.com/pingcap/parser}/opcode/opcode.go (100%) rename {parser => vendor/github.com/pingcap/parser}/opcode/opcode_test.go (100%) create mode 100644 vendor/github.com/pingcap/parser/parser.go rename {parser => vendor/github.com/pingcap/parser}/parser.y (90%) create mode 100644 vendor/github.com/pingcap/parser/parser_example_test.go rename {parser => vendor/github.com/pingcap/parser}/parser_test.go (93%) create mode 100644 vendor/github.com/pingcap/parser/terror/terror.go create mode 100644 vendor/github.com/pingcap/parser/terror/terror_test.go create mode 100644 vendor/github.com/pingcap/parser/test.sh create mode 100644 vendor/github.com/pingcap/parser/types/etc.go create mode 100644 vendor/github.com/pingcap/parser/types/eval_type.go create mode 100644 vendor/github.com/pingcap/parser/types/field_type.go rename {parser => vendor/github.com/pingcap/parser}/yy_parser.go (91%) create mode 100644 vendor/github.com/pingcap/pd/.gitignore create mode 100644 vendor/github.com/pingcap/pd/.travis.yml create mode 100644 vendor/github.com/pingcap/pd/CHANGELOG.md create mode 100644 vendor/github.com/pingcap/pd/CONTRIBUTING.md create mode 100644 vendor/github.com/pingcap/pd/Dockerfile create mode 100644 vendor/github.com/pingcap/pd/Jenkinsfile create mode 100644 vendor/github.com/pingcap/pd/Makefile create mode 100644 vendor/github.com/pingcap/pd/README.md create mode 100644 vendor/github.com/pingcap/pd/circle.yml create mode 100644 vendor/github.com/pingcap/pd/client/client_test.go create mode 100644 vendor/github.com/pingcap/pd/go.mod create mode 100644 vendor/github.com/pingcap/pd/go.sum create mode 100644 vendor/github.com/pingcap/pd/revive.toml create mode 100644 vendor/github.com/pingcap/pd/tools.json create mode 100644 vendor/github.com/pingcap/tidb-tools/.gitignore create mode 100644 vendor/github.com/pingcap/tidb-tools/Jenkinsfile create mode 100644 vendor/github.com/pingcap/tidb-tools/Makefile create mode 100644 vendor/github.com/pingcap/tidb-tools/README.md create mode 100644 vendor/github.com/pingcap/tidb-tools/glide.lock create mode 100644 vendor/github.com/pingcap/tidb-tools/glide.yaml create mode 100644 vendor/github.com/pingcap/tidb-tools/pkg/etcd/etcd_test.go create mode 100644 vendor/github.com/pingcap/tidb-tools/pkg/utils/urls_test.go create mode 100644 vendor/github.com/pingcap/tidb-tools/tidb-binlog/pump_client/client_test.go create mode 100644 vendor/github.com/pingcap/tipb/.gitignore create mode 100644 vendor/github.com/pingcap/tipb/Cargo.toml create mode 100644 vendor/github.com/pingcap/tipb/Makefile create mode 100644 vendor/github.com/pingcap/tipb/README.md create mode 100644 vendor/github.com/pingcap/tipb/_help.sh create mode 100644 vendor/github.com/pingcap/tipb/generate-binlog.sh create mode 100644 vendor/github.com/pingcap/tipb/generate-go.sh create mode 100644 vendor/github.com/pingcap/tipb/generate-rust.sh create mode 100644 vendor/github.com/pingcap/tipb/sharedbytes/sharedbytes_test.go create mode 100644 vendor/github.com/pkg/errors/.gitignore create mode 100644 vendor/github.com/pkg/errors/.travis.yml create mode 100644 vendor/github.com/pkg/errors/README.md create mode 100644 vendor/github.com/pkg/errors/appveyor.yml create mode 100644 vendor/github.com/pkg/errors/bench_test.go create mode 100644 vendor/github.com/pkg/errors/errors_test.go create mode 100644 vendor/github.com/pkg/errors/example_test.go create mode 100644 vendor/github.com/pkg/errors/format_test.go create mode 100644 vendor/github.com/pkg/errors/stack_test.go create mode 100644 vendor/github.com/prometheus/client_golang/.gitignore create mode 100644 vendor/github.com/prometheus/client_golang/.travis.yml create mode 100644 vendor/github.com/prometheus/client_golang/AUTHORS.md create mode 100644 vendor/github.com/prometheus/client_golang/CHANGELOG.md create mode 100644 vendor/github.com/prometheus/client_golang/CONTRIBUTING.md create mode 100644 vendor/github.com/prometheus/client_golang/README.md create mode 100644 vendor/github.com/prometheus/client_golang/VERSION create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/.gitignore create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/README.md create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/benchmark_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/counter_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/example_clustermanager_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/examples_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/expvar_collector_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/gauge_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/histogram_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/http_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/metric_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/push/push_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/registry_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/summary_test.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/vec_test.go create mode 100644 vendor/github.com/prometheus/client_model/.gitignore create mode 100644 vendor/github.com/prometheus/client_model/AUTHORS.md create mode 100644 vendor/github.com/prometheus/client_model/CONTRIBUTING.md create mode 100644 vendor/github.com/prometheus/client_model/Makefile create mode 100644 vendor/github.com/prometheus/client_model/README.md create mode 100644 vendor/github.com/prometheus/client_model/metrics.proto create mode 100644 vendor/github.com/prometheus/client_model/pom.xml create mode 100644 vendor/github.com/prometheus/client_model/setup.py create mode 100644 vendor/github.com/prometheus/common/.travis.yml create mode 100644 vendor/github.com/prometheus/common/AUTHORS.md create mode 100644 vendor/github.com/prometheus/common/CONTRIBUTING.md create mode 100644 vendor/github.com/prometheus/common/README.md create mode 100644 vendor/github.com/prometheus/common/expfmt/bench_test.go create mode 100644 vendor/github.com/prometheus/common/expfmt/decode_test.go create mode 100644 vendor/github.com/prometheus/common/expfmt/text_create_test.go create mode 100644 vendor/github.com/prometheus/common/expfmt/text_parse_test.go create mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt create mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go create mode 100644 vendor/github.com/prometheus/common/model/alert_test.go create mode 100644 vendor/github.com/prometheus/common/model/labels_test.go create mode 100644 vendor/github.com/prometheus/common/model/metric_test.go create mode 100644 vendor/github.com/prometheus/common/model/signature_test.go create mode 100644 vendor/github.com/prometheus/common/model/silence_test.go create mode 100644 vendor/github.com/prometheus/common/model/time_test.go create mode 100644 vendor/github.com/prometheus/common/model/value_test.go create mode 100644 vendor/github.com/prometheus/procfs/.travis.yml create mode 100644 vendor/github.com/prometheus/procfs/AUTHORS.md create mode 100644 vendor/github.com/prometheus/procfs/CONTRIBUTING.md create mode 100644 vendor/github.com/prometheus/procfs/Makefile create mode 100644 vendor/github.com/prometheus/procfs/README.md create mode 100644 vendor/github.com/prometheus/procfs/fs_test.go create mode 100644 vendor/github.com/prometheus/procfs/ipvs_test.go create mode 100644 vendor/github.com/prometheus/procfs/mdstat_test.go create mode 100644 vendor/github.com/prometheus/procfs/proc_io_test.go create mode 100644 vendor/github.com/prometheus/procfs/proc_limits_test.go create mode 100644 vendor/github.com/prometheus/procfs/proc_stat_test.go create mode 100644 vendor/github.com/prometheus/procfs/proc_test.go create mode 100644 vendor/github.com/prometheus/procfs/stat_test.go create mode 100644 vendor/github.com/sirupsen/logrus/.gitignore create mode 100644 vendor/github.com/sirupsen/logrus/.travis.yml create mode 100644 vendor/github.com/sirupsen/logrus/CHANGELOG.md create mode 100644 vendor/github.com/sirupsen/logrus/README.md create mode 100644 vendor/github.com/sirupsen/logrus/alt_exit_test.go create mode 100644 vendor/github.com/sirupsen/logrus/entry_test.go create mode 100644 vendor/github.com/sirupsen/logrus/formatter_bench_test.go create mode 100644 vendor/github.com/sirupsen/logrus/hook_test.go create mode 100644 vendor/github.com/sirupsen/logrus/json_formatter_test.go create mode 100644 vendor/github.com/sirupsen/logrus/logger_bench_test.go create mode 100644 vendor/github.com/sirupsen/logrus/logrus_test.go create mode 100644 vendor/github.com/sirupsen/logrus/text_formatter_test.go create mode 100644 vendor/github.com/spaolacci/murmur3/.gitignore create mode 100644 vendor/github.com/spaolacci/murmur3/README.md create mode 100644 vendor/github.com/spaolacci/murmur3/murmur_test.go create mode 100644 vendor/github.com/twinj/uuid/.gitignore create mode 100644 vendor/github.com/twinj/uuid/.travis.yml create mode 100644 vendor/github.com/twinj/uuid/README.md create mode 100644 vendor/github.com/twinj/uuid/array_test.go create mode 100644 vendor/github.com/twinj/uuid/rfc4122_test.go create mode 100644 vendor/github.com/twinj/uuid/saver_test.go create mode 100644 vendor/github.com/twinj/uuid/state_test.go create mode 100644 vendor/github.com/twinj/uuid/struct_test.go create mode 100644 vendor/github.com/twinj/uuid/timestamp_test.go create mode 100644 vendor/github.com/twinj/uuid/uuid_test.go create mode 100644 vendor/github.com/twinj/uuid/uuids_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/.gitignore create mode 100644 vendor/github.com/uber/jaeger-client-go/.gitmodules create mode 100644 vendor/github.com/uber/jaeger-client-go/.travis.yml create mode 100644 vendor/github.com/uber/jaeger-client-go/CHANGELOG.md create mode 100644 vendor/github.com/uber/jaeger-client-go/CONTRIBUTING.md create mode 100644 vendor/github.com/uber/jaeger-client-go/Makefile create mode 100644 vendor/github.com/uber/jaeger-client-go/README.md create mode 100644 vendor/github.com/uber/jaeger-client-go/config/config_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/config/example_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/config/options_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/constants_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/context_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/glide.lock create mode 100644 vendor/github.com/uber/jaeger-client-go/glide.yaml create mode 100644 vendor/github.com/uber/jaeger-client-go/jaeger_thrift_span_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/log/logger_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/logger_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/metrics_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/observer_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/propagation_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/reporter_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/rpcmetrics/README.md create mode 100644 vendor/github.com/uber/jaeger-client-go/rpcmetrics/endpoints_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/rpcmetrics/metrics_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/rpcmetrics/normalizer_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/rpcmetrics/observer_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/sampler_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/span_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/thrift/.nocover create mode 100644 vendor/github.com/uber/jaeger-client-go/tracer_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/transport_udp_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/utils/http_json_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/utils/rate_limiter_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/utils/utils_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/zipkin_test.go create mode 100644 vendor/github.com/uber/jaeger-client-go/zipkin_thrift_span_test.go create mode 100644 vendor/github.com/uber/jaeger-lib/.gitignore create mode 100644 vendor/github.com/uber/jaeger-lib/.travis.yml create mode 100644 vendor/github.com/uber/jaeger-lib/CONTRIBUTING.md create mode 100644 vendor/github.com/uber/jaeger-lib/Makefile create mode 100644 vendor/github.com/uber/jaeger-lib/README.md create mode 100644 vendor/github.com/uber/jaeger-lib/glide.lock create mode 100644 vendor/github.com/uber/jaeger-lib/glide.yaml create mode 100644 vendor/github.com/uber/jaeger-lib/metrics/local_test.go create mode 100644 vendor/github.com/uber/jaeger-lib/metrics/metrics_test.go create mode 100644 vendor/golang.org/x/net/.gitattributes create mode 100644 vendor/golang.org/x/net/.gitignore create mode 100644 vendor/golang.org/x/net/AUTHORS create mode 100644 vendor/golang.org/x/net/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/net/CONTRIBUTORS create mode 100644 vendor/golang.org/x/net/README create mode 100644 vendor/golang.org/x/net/codereview.cfg create mode 100644 vendor/golang.org/x/net/context/context_test.go create mode 100644 vendor/golang.org/x/net/context/withtimeout_test.go create mode 100644 vendor/golang.org/x/net/http2/.gitignore create mode 100644 vendor/golang.org/x/net/http2/Dockerfile create mode 100644 vendor/golang.org/x/net/http2/Makefile create mode 100644 vendor/golang.org/x/net/http2/README create mode 100644 vendor/golang.org/x/net/http2/databuffer_test.go create mode 100644 vendor/golang.org/x/net/http2/errors_test.go create mode 100644 vendor/golang.org/x/net/http2/flow_test.go create mode 100644 vendor/golang.org/x/net/http2/frame_test.go create mode 100644 vendor/golang.org/x/net/http2/go18_test.go create mode 100644 vendor/golang.org/x/net/http2/gotrack_test.go create mode 100644 vendor/golang.org/x/net/http2/hpack/encode_test.go create mode 100644 vendor/golang.org/x/net/http2/hpack/hpack_test.go create mode 100644 vendor/golang.org/x/net/http2/hpack/tables_test.go create mode 100644 vendor/golang.org/x/net/http2/http2_test.go create mode 100644 vendor/golang.org/x/net/http2/pipe_test.go create mode 100644 vendor/golang.org/x/net/http2/server_push_test.go create mode 100644 vendor/golang.org/x/net/http2/server_test.go create mode 100644 vendor/golang.org/x/net/http2/transport_test.go create mode 100644 vendor/golang.org/x/net/http2/writesched_priority_test.go create mode 100644 vendor/golang.org/x/net/http2/writesched_random_test.go create mode 100644 vendor/golang.org/x/net/http2/writesched_test.go create mode 100644 vendor/golang.org/x/net/http2/z_spec_test.go create mode 100644 vendor/golang.org/x/net/idna/example_test.go create mode 100644 vendor/golang.org/x/net/idna/idna_test.go create mode 100644 vendor/golang.org/x/net/idna/punycode_test.go create mode 100644 vendor/golang.org/x/net/internal/timeseries/timeseries_test.go create mode 100644 vendor/golang.org/x/net/lex/httplex/httplex_test.go create mode 100644 vendor/golang.org/x/net/trace/histogram_test.go create mode 100644 vendor/golang.org/x/net/trace/trace_test.go create mode 100644 vendor/golang.org/x/sys/.gitattributes create mode 100644 vendor/golang.org/x/sys/.gitignore create mode 100644 vendor/golang.org/x/sys/AUTHORS create mode 100644 vendor/golang.org/x/sys/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/sys/CONTRIBUTORS create mode 100644 vendor/golang.org/x/sys/README.md create mode 100644 vendor/golang.org/x/sys/codereview.cfg create mode 100644 vendor/golang.org/x/sys/unix/.gitignore create mode 100644 vendor/golang.org/x/sys/unix/README.md create mode 100644 vendor/golang.org/x/sys/unix/creds_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_darwin_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_dragonfly_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_linux_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_netbsd_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_openbsd_test.go create mode 100644 vendor/golang.org/x/sys/unix/dev_solaris_test.go create mode 100644 vendor/golang.org/x/sys/unix/example_test.go create mode 100644 vendor/golang.org/x/sys/unix/export_test.go create mode 100644 vendor/golang.org/x/sys/unix/mkall.sh create mode 100644 vendor/golang.org/x/sys/unix/mkerrors.sh create mode 100644 vendor/golang.org/x/sys/unix/mksyscall.pl create mode 100644 vendor/golang.org/x/sys/unix/mksyscall_solaris.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum_darwin.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl create mode 100644 vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl create mode 100644 vendor/golang.org/x/sys/unix/mmap_unix_test.go create mode 100644 vendor/golang.org/x/sys/unix/openbsd_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_test.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_test.go create mode 100644 vendor/golang.org/x/sys/unix/timestruct_test.go create mode 100644 vendor/golang.org/x/text/.gitattributes create mode 100644 vendor/golang.org/x/text/.gitignore create mode 100644 vendor/golang.org/x/text/AUTHORS create mode 100644 vendor/golang.org/x/text/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/text/CONTRIBUTORS create mode 100644 vendor/golang.org/x/text/README create mode 100644 vendor/golang.org/x/text/codereview.cfg create mode 100644 vendor/golang.org/x/text/doc.go create mode 100644 vendor/golang.org/x/text/encoding/charmap/charmap_test.go create mode 100644 vendor/golang.org/x/text/encoding/encoding_test.go create mode 100644 vendor/golang.org/x/text/encoding/example_test.go create mode 100644 vendor/golang.org/x/text/encoding/japanese/all_test.go create mode 100644 vendor/golang.org/x/text/encoding/korean/all_test.go create mode 100644 vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go create mode 100644 vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go create mode 100644 vendor/golang.org/x/text/encoding/unicode/unicode_test.go create mode 100644 vendor/golang.org/x/text/gen.go create mode 100644 vendor/golang.org/x/text/internal/gen.go create mode 100644 vendor/golang.org/x/text/internal/gen_test.go create mode 100644 vendor/golang.org/x/text/internal/internal.go create mode 100644 vendor/golang.org/x/text/internal/internal_test.go create mode 100644 vendor/golang.org/x/text/internal/match.go create mode 100644 vendor/golang.org/x/text/internal/match_test.go create mode 100644 vendor/golang.org/x/text/internal/tables.go create mode 100644 vendor/golang.org/x/text/internal/triegen/data_test.go create mode 100644 vendor/golang.org/x/text/internal/triegen/example_compact_test.go create mode 100644 vendor/golang.org/x/text/internal/triegen/example_test.go create mode 100644 vendor/golang.org/x/text/internal/triegen/gen_test.go create mode 100644 vendor/golang.org/x/text/internal/ucd/example_test.go create mode 100644 vendor/golang.org/x/text/internal/ucd/ucd_test.go create mode 100644 vendor/golang.org/x/text/runes/cond_test.go create mode 100644 vendor/golang.org/x/text/runes/example_test.go create mode 100644 vendor/golang.org/x/text/runes/runes_test.go create mode 100644 vendor/golang.org/x/text/secure/bidirule/bench_test.go create mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule_test.go create mode 100644 vendor/golang.org/x/text/secure/doc.go create mode 100644 vendor/golang.org/x/text/transform/examples_test.go create mode 100644 vendor/golang.org/x/text/transform/transform_test.go create mode 100644 vendor/golang.org/x/text/unicode/bidi/core_test.go create mode 100644 vendor/golang.org/x/text/unicode/bidi/ranges_test.go create mode 100644 vendor/golang.org/x/text/unicode/bidi/tables_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/collate_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/data_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/examples_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve_test.go create mode 100644 vendor/golang.org/x/text/unicode/cldr/slice_test.go create mode 100644 vendor/golang.org/x/text/unicode/doc.go create mode 100644 vendor/golang.org/x/text/unicode/norm/composition_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/example_iter_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/example_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/iter_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/norm_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/normalize_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/transform_test.go create mode 100644 vendor/golang.org/x/text/unicode/norm/ucd_test.go create mode 100644 vendor/golang.org/x/text/unicode/rangetable/merge_test.go create mode 100644 vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go create mode 100644 vendor/google.golang.org/genproto/.travis.yml create mode 100644 vendor/google.golang.org/genproto/CONTRIBUTING.md create mode 100644 vendor/google.golang.org/genproto/README.md create mode 100644 vendor/google.golang.org/genproto/googleapis/api/authorization_config.pb.go create mode 100644 vendor/google.golang.org/genproto/googleapis/api/experimental.pb.go create mode 100644 vendor/google.golang.org/genproto/regen.go create mode 100644 vendor/google.golang.org/genproto/regen.sh create mode 100644 vendor/google.golang.org/grpc/.travis.yml create mode 100644 vendor/google.golang.org/grpc/AUTHORS create mode 100644 vendor/google.golang.org/grpc/CONTRIBUTING.md create mode 100644 vendor/google.golang.org/grpc/Makefile create mode 100644 vendor/google.golang.org/grpc/README.md create mode 100644 vendor/google.golang.org/grpc/backoff_test.go create mode 100644 vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go create mode 100644 vendor/google.golang.org/grpc/balancer_switching_test.go create mode 100644 vendor/google.golang.org/grpc/balancer_test.go create mode 100644 vendor/google.golang.org/grpc/call_test.go create mode 100644 vendor/google.golang.org/grpc/clientconn_test.go create mode 100644 vendor/google.golang.org/grpc/codec_test.go create mode 100644 vendor/google.golang.org/grpc/codegen.sh create mode 100644 vendor/google.golang.org/grpc/codes/codes_test.go create mode 100644 vendor/google.golang.org/grpc/credentials/credentials_test.go create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto_test.go create mode 100644 vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto create mode 100644 vendor/google.golang.org/grpc/grpclb/grpclb_test.go create mode 100644 vendor/google.golang.org/grpc/grpclb_util_test.go create mode 100644 vendor/google.golang.org/grpc/grpclog/loggerv2_test.go create mode 100644 vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto create mode 100644 vendor/google.golang.org/grpc/health/health.go create mode 100644 vendor/google.golang.org/grpc/metadata/metadata_test.go create mode 100644 vendor/google.golang.org/grpc/naming/dns_resolver_test.go create mode 100644 vendor/google.golang.org/grpc/naming/go17_test.go create mode 100644 vendor/google.golang.org/grpc/naming/go18_test.go create mode 100644 vendor/google.golang.org/grpc/picker_wrapper_test.go create mode 100644 vendor/google.golang.org/grpc/pickfirst_test.go create mode 100644 vendor/google.golang.org/grpc/proxy_test.go create mode 100644 vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go create mode 100644 vendor/google.golang.org/grpc/resolver/dns/go17_test.go create mode 100644 vendor/google.golang.org/grpc/resolver/dns/go18_test.go create mode 100644 vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go create mode 100644 vendor/google.golang.org/grpc/rpc_util_test.go create mode 100644 vendor/google.golang.org/grpc/server_test.go create mode 100644 vendor/google.golang.org/grpc/service_config_test.go create mode 100644 vendor/google.golang.org/grpc/stats/stats_test.go create mode 100644 vendor/google.golang.org/grpc/status/status_test.go create mode 100644 vendor/google.golang.org/grpc/stickiness_test.go create mode 100644 vendor/google.golang.org/grpc/transport/handler_server_test.go create mode 100644 vendor/google.golang.org/grpc/transport/http_util_test.go create mode 100644 vendor/google.golang.org/grpc/transport/transport_test.go create mode 100644 vendor/google.golang.org/grpc/vet.sh create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/.gitignore create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/README.md create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/example_test.go create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/linux_test.go create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack_test.go create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/rotate_test.go create mode 100644 vendor/gopkg.in/natefinch/lumberjack.v2/testing_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 68b4329b332ee..d80362f1bee9c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -3,44 +3,33 @@ [[projects]] branch = "master" - digest = "1:be3ccd9f881604e4dd6d15cccfa126aa309232f0ba075ae5f92d3ef729a62758" name = "github.com/BurntSushi/toml" packages = ["."] - pruneopts = "NUT" revision = "a368813c5e648fee92e5f6c30e3944ff9d5e8895" [[projects]] - digest = "1:9752dad5e89cd779096bf2477a4ded16bea7ac62de453c8d6b4bf841d51a8512" name = "github.com/apache/thrift" packages = ["lib/go/thrift"] - pruneopts = "NUT" revision = "b2a4d4ae21c789b689dd162deb819665567f481c" version = "0.10.0" [[projects]] - digest = "1:75d40fa0c338f4c56056a3985e91fa371e8fcd0293e45b80afa7debecaf56012" name = "github.com/beorn7/perks" packages = ["quantile"] - pruneopts = "NUT" revision = "3ac7bf7a47d159a033b107610db8a1b6575507a4" [[projects]] branch = "master" - digest = "1:7b12da6e82292eb06e24dfe544c628115a3f4316c152f9dcb87d4f60cbf7cd7d" name = "github.com/blacktear23/go-proxyprotocol" packages = ["."] - pruneopts = "NUT" revision = "62e368e1c4700c34b4b6f77afd49b215211574c2" [[projects]] - digest = "1:60142a898f3808b3e6aa604e5f3296bdef921e625ef3223b6019c1a345b8765c" name = "github.com/codahale/hdrhistogram" packages = ["."] - pruneopts = "NUT" revision = "f8ad88b59a584afeee9d334eff879b104439117b" [[projects]] - digest = "1:7a5c43af23a0c21f4f1762d54af95586f9c04836257e66631557d8f8200ef0e1" name = "github.com/coreos/etcd" packages = [ "auth/authpb", @@ -49,81 +38,40 @@ "etcdserver/api/v3rpc/rpctypes", "etcdserver/etcdserverpb", "mvcc/mvccpb", - "pkg/types", + "pkg/types" ] - pruneopts = "NUT" revision = "eddf599c689ec85f4752060edff5a72e81e9106a" version = "v3.2.18" [[projects]] - digest = "1:883ab1d72c3c5851413baad190ebe3ceaf31bb8dece09a943ac07f9e722f811c" - name = "github.com/cznic/golex" - packages = ["lex"] - pruneopts = "NUT" - revision = "da5a7153a51074477ecac5c45a7e5182a0c72448" - -[[projects]] - digest = "1:f80ed82cae006d02025cd63bd7cbe63a7e593de2714db785ea36d6323cc995eb" name = "github.com/cznic/mathutil" packages = ["."] - pruneopts = "NUT" revision = "78ad7f262603437f0ecfebc835d80094f89c8f54" [[projects]] branch = "master" - digest = "1:a7e4a0d213c4c29e79a0da8fe9d16bbcedce561763ff643bff252ea14260f61c" - name = "github.com/cznic/parser" - packages = ["yacc"] - pruneopts = "NUT" - revision = "31edd927e5b19d1c4a260c41a397e7f81d6694d9" - -[[projects]] - branch = "master" - digest = "1:809006f9378a46bcc70bc4330d14f43c1a7818ae9d93c09cab062e575d7e95a2" name = "github.com/cznic/sortutil" packages = ["."] - pruneopts = "NUT" revision = "4c7342852e65c2088c981288f2c5610d10b9f7f4" -[[projects]] - digest = "1:5799bcff29ed827fa851b40b2f650bc777df4b67fd9b8a3041d9d89b9eb2fd86" - name = "github.com/cznic/strutil" - packages = ["."] - pruneopts = "NUT" - revision = "1eb03e3cc9d345307a45ec82bd3016cde4bd4464" - -[[projects]] - digest = "1:71705901e4a356cde002ae6f0052fb661f59971c12262c12006b25cec40025b1" - name = "github.com/cznic/y" - packages = ["."] - pruneopts = "NUT" - revision = "9fdf92d4aac058959f814606bb729ed50f5e4240" - [[projects]] branch = "master" - digest = "1:f18dbc529543fe5fd5294f8385ea1f71681be964c43461f5f45335bb51ba83ae" name = "github.com/etcd-io/gofail" packages = ["runtime"] - pruneopts = "NUT" revision = "51ce9a71510a58bad5ae66ddd278ef28762a1550" [[projects]] - digest = "1:973dbcbbb1be662b61604319582383c315add70906a68d14894f31542ffc3a25" name = "github.com/go-sql-driver/mysql" packages = ["."] - pruneopts = "NUT" revision = "3955978caca48c1658a4bb7a9c6a0f084e326af3" [[projects]] - digest = "1:38e684375ef5b55e812332266d63f9fc5b6329ab303067c4cdda051db6d29ca4" name = "github.com/gogo/protobuf" packages = ["proto"] - pruneopts = "NUT" revision = "636bf0302bc95575d69441b25a2603156ffdddf1" version = "v1.1.1" [[projects]] - digest = "1:6aef947ba53156da1a66ee891d70d61835e0dcfc9f0d728ae1132db651e81c22" name = "github.com/golang/protobuf" packages = [ "jsonpb", @@ -133,127 +81,105 @@ "ptypes/any", "ptypes/duration", "ptypes/struct", - "ptypes/timestamp", + "ptypes/timestamp" ] - pruneopts = "NUT" revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" version = "v1.1.0" [[projects]] - digest = "1:c6dfb6c55c1989f1d89622b3c45b786127f76f47322c50e487585f823cb12543" name = "github.com/golang/snappy" packages = ["."] - pruneopts = "NUT" revision = "723cc1e459b8eea2dea4583200fd60757d40097a" [[projects]] branch = "master" - digest = "1:c0883bc20a7c1ff552ff53d414f3cdc28fe847d15fab48c4486aa772ab2fb131" name = "github.com/google/btree" packages = ["."] - pruneopts = "NUT" revision = "316fb6d3f031ae8f4d457c6c5186b9e3ded70435" [[projects]] - digest = "1:dbd86d229eacaa86a98b10f8fb3e3fc69a1913e0f4e010e7cc1f92bf12edca92" name = "github.com/gorilla/context" packages = ["."] - pruneopts = "NUT" revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a" version = "v1.1" [[projects]] - digest = "1:054b11c45900b575d23fa8e0fa3636a784e2c4d1d43d05e8e20fd592ebe0d5db" name = "github.com/gorilla/mux" packages = ["."] - pruneopts = "NUT" revision = "599cba5e7b6137d46ddf58fb1765f5d928e69604" [[projects]] - digest = "1:0aa5274053fdc232896f0835c712f4a39992d959f8e2363f189a7b0df36f136b" name = "github.com/grpc-ecosystem/go-grpc-middleware" packages = [ ".", "tags", "tracing/opentracing", - "util/metautils", + "util/metautils" ] - pruneopts = "NUT" revision = "82921fcf811d228d2fa202bc31238b356bf9f8d5" [[projects]] - digest = "1:96c558cff0532e2e9ffc0b6d7c8c7431c592d781b109343aa51e27f9fd9a6b82" name = "github.com/grpc-ecosystem/go-grpc-prometheus" packages = ["."] - pruneopts = "NUT" revision = "6b7015e65d366bf3f19b2b2a000a831940f0f7e0" version = "v1.1" [[projects]] branch = "master" - digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6" name = "github.com/matttproud/golang_protobuf_extensions" packages = ["pbutil"] - pruneopts = "NUT" revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" [[projects]] branch = "master" - digest = "1:b95cb972bfd3eb737d334b1703a51a82d1d1d3e92f7f355798d94796c7120c73" name = "github.com/ngaut/pools" packages = ["."] - pruneopts = "NUT" revision = "b7bc8c42aac787667ba45adea78233f53f548443" [[projects]] branch = "master" - digest = "1:7d5f99346aa63d23681f4d92708469f32384d0c26722a4de5725bd0f22caedac" name = "github.com/ngaut/sync2" packages = ["."] - pruneopts = "NUT" revision = "7a24ed77b2efb460c1468b7dc917821c66e80e55" [[projects]] - digest = "1:cc405544fecfb5a8e0c409127ef67ce3b91d11143a00121e5b822e4f8eabe7d2" name = "github.com/opentracing/basictracer-go" packages = [ ".", - "wire", + "wire" ] - pruneopts = "NUT" revision = "1b32af207119a14b1b231d451df3ed04a72efebf" version = "v1.0.0" [[projects]] - digest = "1:7da29c22bcc5c2ffb308324377dc00b5084650348c2799e573ed226d8cc9faf0" name = "github.com/opentracing/opentracing-go" packages = [ ".", "ext", - "log", + "log" ] - pruneopts = "NUT" revision = "1949ddbfd147afd4d964a9f00b24eb291e0e7c38" version = "v1.0.2" [[projects]] branch = "master" - digest = "1:3bf17a6e6eaa6ad24152148a631d18662f7212e21637c2699bff3369b7f00fa2" name = "github.com/petar/GoLLRB" packages = ["llrb"] - pruneopts = "NUT" revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" [[projects]] branch = "master" - digest = "1:dc85cc12f7f97c2b033157f9d40395b2f0458b7bd3083257f8f661ea6f48f89a" name = "github.com/pingcap/check" packages = ["."] - pruneopts = "NUT" revision = "1c287c953996ab3a0bf535dba9d53d809d3dc0b6" [[projects]] - digest = "1:8fd099a567b1e9b3a7e1f66d8547a0d2b1852427e86a0dae96fa59e9583e13e6" + name = "github.com/pingcap/errors" + packages = ["."] + revision = "1176802fff62540cc87d289bd40c52a2d6b2ea16" + version = "v0.11.0" + +[[projects]] name = "github.com/pingcap/goleveldb" packages = [ "leveldb", @@ -267,14 +193,12 @@ "leveldb/opt", "leveldb/storage", "leveldb/table", - "leveldb/util", + "leveldb/util" ] - pruneopts = "NUT" revision = "8d44bfdf1030639ae7130922c95df12d6d4da3b6" [[projects]] branch = "release-2.1" - digest = "1:85aa2923e4dac3cef4dda68972f580cbc10dc1450f019f98a8b7e476f5eb2b07" name = "github.com/pingcap/kvproto" packages = [ "pkg/coprocessor", @@ -284,112 +208,105 @@ "pkg/metapb", "pkg/pdpb", "pkg/raft_serverpb", - "pkg/tikvpb", + "pkg/tikvpb" ] - pruneopts = "NUT" revision = "8e3f33ac49297d7c93b61a955531191084a2f685" +[[projects]] + branch = "release-2.1" + name = "github.com/pingcap/parser" + packages = [ + ".", + "ast", + "auth", + "charset", + "format", + "model", + "mysql", + "opcode", + "terror", + "types" + ] + revision = "815d2f65fd25b8ee34100fbd8311998d2e7de2d6" + [[projects]] branch = "master" - digest = "1:8f576565a8479071ca1951bf678519b1c32480aad8dec2379a64858c31d9e6a9" name = "github.com/pingcap/pd" packages = ["client"] - pruneopts = "NUT" revision = "eb892dda1e33a0b76191d39894ad4a806f313f6e" [[projects]] - digest = "1:09802a4b5acb491d99be650e2c64115de817ff7b588ffd2cb016f3ca1f9c61aa" name = "github.com/pingcap/tidb-tools" packages = [ "pkg/etcd", "pkg/utils", "tidb-binlog/node", - "tidb-binlog/pump_client", + "tidb-binlog/pump_client" ] - pruneopts = "NUT" revision = "8dd71127bcf09130ae032ab6877dd22f32b53e14" [[projects]] branch = "master" - digest = "1:14d83225e335cfa449b1f74d03c03ed70db64bf6af83a6e04c43e6e0021d6b94" name = "github.com/pingcap/tipb" packages = [ "go-binlog", "go-tipb", - "sharedbytes", + "sharedbytes" ] - pruneopts = "NUT" revision = "371b48b15d93924a3a5375019e42b4420bc13d17" [[projects]] - digest = "1:4b96ce0f151b10c52b1d6876c179e9a6d2329f98939c4cf8148daaf27f981413" name = "github.com/pkg/errors" packages = ["."] - pruneopts = "NUT" revision = "1176802fff62540cc87d289bd40c52a2d6b2ea16" source = "https://github.com/pingcap/errors.git" version = "v0.11.0" [[projects]] - digest = "1:1ef3c4d6e78616bd3d1b5b7d8899febb9aa1b83d3373fbbdc2804408c7977b57" name = "github.com/prometheus/client_golang" packages = [ "prometheus", - "prometheus/push", + "prometheus/push" ] - pruneopts = "NUT" revision = "c5b7fccd204277076155f10851dad72b76a49317" version = "v0.8.0" [[projects]] - digest = "1:9fe8945a11a9f588a9d306b4741cad634da9015a704271b9506810e2cc77fa17" name = "github.com/prometheus/client_model" packages = ["go"] - pruneopts = "NUT" revision = "fa8ad6fec33561be4280a8f0514318c79d7f6cb6" [[projects]] - digest = "1:c90717fa0864d47e19eaa855af60b202b537795f485052c7f48333c679dd7310" name = "github.com/prometheus/common" packages = [ "expfmt", "internal/bitbucket.org/ww/goautoneg", - "model", + "model" ] - pruneopts = "NUT" revision = "4402f4e5ea79ec15f3c574773b6a5198fbea215f" [[projects]] - digest = "1:dcfff2d5e99e01dcb856dd8afb0b509c1d05443f0b523cc5333b33a819829ed9" name = "github.com/prometheus/procfs" packages = ["."] - pruneopts = "NUT" revision = "abf152e5f3e97f2fafac028d2cc06c1feb87ffa5" [[projects]] - digest = "1:4c173651d2deb815a0420aeb1b3f7ca3c4aef2d980ba164a501a53f6abf368ef" name = "github.com/sirupsen/logrus" packages = ["."] - pruneopts = "NUT" revision = "3bcb09397d6d88e7676a9bc8433ca11ba5304837" [[projects]] - digest = "1:0af5ed795eeb9df3e3d32e2c0229b012e2c107945f75a0556733d643c94e55be" name = "github.com/spaolacci/murmur3" packages = ["."] - pruneopts = "NUT" revision = "0d12bf811670bf6a1a63828dfbd003eded177fce" version = "v1.0" [[projects]] - digest = "1:194c26fad062f6b1530720ee1afd6cd6f40d79274b2434caef2693b1da5d2ab2" name = "github.com/twinj/uuid" packages = ["."] - pruneopts = "NUT" revision = "70cac2bcd273ef6a371bb96cde363d28b68734c3" [[projects]] - digest = "1:0e28a98b9579858cb5de885935499fefebc8bc44a652cde08a6d035ee7435603" name = "github.com/uber/jaeger-client-go" packages = [ ".", @@ -401,22 +318,18 @@ "thrift-gen/jaeger", "thrift-gen/sampling", "thrift-gen/zipkincore", - "utils", + "utils" ] - pruneopts = "NUT" revision = "d021e646f5187d77b55592c3efee1a2810e895d7" version = "v2.8.0" [[projects]] - digest = "1:0da2810678a062e0567c3215911869b0423da0e497c56683ff8e87e7a6952597" name = "github.com/uber/jaeger-lib" packages = ["metrics"] - pruneopts = "NUT" revision = "3b2a9ad2a045881ab7a0f81d465be54c8292ee4f" version = "v1.1.0" [[projects]] - digest = "1:686219a880e6ec42870431372756a66c19c1396e9fe203b659179422d3c6bf96" name = "golang.org/x/net" packages = [ "context", @@ -425,21 +338,17 @@ "idna", "internal/timeseries", "lex/httplex", - "trace", + "trace" ] - pruneopts = "NUT" revision = "d1e1b351919c6738fdeb9893d5c998b161464f0c" [[projects]] branch = "master" - digest = "1:2f375ec82e53522eb4a1670f2f24f064f407ef2b32e01bb217f5daa4a4d226d6" name = "golang.org/x/sys" packages = ["unix"] - pruneopts = "NUT" revision = "7dfd1290c7917b7ba22824b9d24954ab3002fe24" [[projects]] - digest = "1:a005696b163ffe1842de27eeb3ccfece9d3c2e70d02b83ea1d8c0eeab597c9e0" name = "golang.org/x/text" packages = [ "encoding", @@ -461,23 +370,19 @@ "unicode/bidi", "unicode/cldr", "unicode/norm", - "unicode/rangetable", + "unicode/rangetable" ] - pruneopts = "NUT" revision = "4ee4af566555f5fbe026368b75596286a312663a" [[projects]] - digest = "1:0efcfe82e59b828eb6f4115bba88ff45c0898c38e823fbe7f450bdffed9e739b" name = "google.golang.org/genproto" packages = [ "googleapis/api/annotations", - "googleapis/rpc/status", + "googleapis/rpc/status" ] - pruneopts = "NUT" revision = "6b7d9516179cd47f4714cfeb0103ad1dede756c4" [[projects]] - digest = "1:a893d24a604ae6f45f2d6e00ae9e817476e110e2dd5455152b35bb720ca2f626" name = "google.golang.org/grpc" packages = [ ".", @@ -504,89 +409,21 @@ "stats", "status", "tap", - "transport", + "transport" ] - pruneopts = "NUT" revision = "41344da2231b913fa3d983840a57a6b1b7b631a1" source = "https://github.com/grpc/grpc-go.git" version = "v1.12.0" [[projects]] - digest = "1:7d95d61ff5828a65cf072a46f3c68d67daffdd11e97d758b0af2176cde717fcd" name = "gopkg.in/natefinch/lumberjack.v2" packages = ["."] - pruneopts = "NUT" revision = "dd45e6a67c53f673bb49ca8a001fd3a63ceb640e" version = "v2.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - input-imports = [ - "github.com/BurntSushi/toml", - "github.com/blacktear23/go-proxyprotocol", - "github.com/coreos/etcd/clientv3", - "github.com/coreos/etcd/clientv3/concurrency", - "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes", - "github.com/coreos/etcd/mvcc/mvccpb", - "github.com/cznic/mathutil", - "github.com/cznic/parser/yacc", - "github.com/cznic/sortutil", - "github.com/cznic/strutil", - "github.com/cznic/y", - "github.com/etcd-io/gofail/runtime", - "github.com/go-sql-driver/mysql", - "github.com/golang/protobuf/jsonpb", - "github.com/golang/protobuf/proto", - "github.com/google/btree", - "github.com/gorilla/mux", - "github.com/grpc-ecosystem/go-grpc-middleware", - "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing", - "github.com/grpc-ecosystem/go-grpc-prometheus", - "github.com/ngaut/pools", - "github.com/ngaut/sync2", - "github.com/opentracing/basictracer-go", - "github.com/opentracing/opentracing-go", - "github.com/pingcap/check", - "github.com/pingcap/goleveldb/leveldb", - "github.com/pingcap/goleveldb/leveldb/comparer", - "github.com/pingcap/goleveldb/leveldb/iterator", - "github.com/pingcap/goleveldb/leveldb/memdb", - "github.com/pingcap/goleveldb/leveldb/opt", - "github.com/pingcap/goleveldb/leveldb/storage", - "github.com/pingcap/goleveldb/leveldb/util", - "github.com/pingcap/kvproto/pkg/coprocessor", - "github.com/pingcap/kvproto/pkg/errorpb", - "github.com/pingcap/kvproto/pkg/kvrpcpb", - "github.com/pingcap/kvproto/pkg/metapb", - "github.com/pingcap/kvproto/pkg/tikvpb", - "github.com/pingcap/pd/client", - "github.com/pingcap/tidb-tools/tidb-binlog/node", - "github.com/pingcap/tidb-tools/tidb-binlog/pump_client", - "github.com/pingcap/tipb/go-binlog", - "github.com/pingcap/tipb/go-tipb", - "github.com/pkg/errors", - "github.com/prometheus/client_golang/prometheus", - "github.com/prometheus/client_golang/prometheus/push", - "github.com/sirupsen/logrus", - "github.com/spaolacci/murmur3", - "github.com/twinj/uuid", - "github.com/uber/jaeger-client-go/config", - "golang.org/x/net/context", - "golang.org/x/text/encoding", - "golang.org/x/text/encoding/charmap", - "golang.org/x/text/encoding/japanese", - "golang.org/x/text/encoding/korean", - "golang.org/x/text/encoding/simplifiedchinese", - "golang.org/x/text/encoding/traditionalchinese", - "golang.org/x/text/encoding/unicode", - "golang.org/x/text/transform", - "google.golang.org/grpc", - "google.golang.org/grpc/codes", - "google.golang.org/grpc/credentials", - "google.golang.org/grpc/keepalive", - "google.golang.org/grpc/metadata", - "gopkg.in/natefinch/lumberjack.v2", - ] + inputs-digest = "456ced89257d372e02ff41bc3219136a6cd941b5010707bf57dcac7acfc282c8" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index b04b1587e98dd..e1eabdaaf68e7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -28,10 +28,6 @@ required = ["github.com/golang/protobuf/jsonpb"] version = "1.1.0" name = "github.com/golang/protobuf" -[[constraint]] - branch = "master" - name = "github.com/cznic/parser" - [[constraint]] branch = "master" name = "github.com/cznic/sortutil" @@ -106,3 +102,7 @@ required = ["github.com/golang/protobuf/jsonpb"] [[constraint]] name = "github.com/pingcap/tidb-tools" revision = "8dd71127bcf09130ae032ab6877dd22f32b53e14" + +[[constraint]] + name = "github.com/pingcap/parser" + branch = "release-2.1" \ No newline at end of file diff --git a/Makefile b/Makefile index ad524f99eaa18..f79925cb0b821 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go" | grep -vE "vendor" GOFAIL_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|vendor)" | xargs gofail enable) GOFAIL_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|vendor)" | xargs gofail disable) -LDFLAGS += -X "github.com/pingcap/tidb/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty)" +LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty)" LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')" LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-parse HEAD)" LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)" @@ -40,7 +40,7 @@ CHECK_LDFLAGS += $(LDFLAGS) ${TEST_LDFLAGS} TARGET = "" -.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check parserlib checklist +.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check checklist parser default: server buildsucc @@ -51,35 +51,14 @@ buildsucc: all: dev server benchkv -dev: checklist parserlib test check +parser: + @echo "remove this command later" + +dev: checklist test check build: $(GOBUILD) -goyacc: - $(GOBUILD) -o bin/goyacc parser/goyacc/main.go - -parser: goyacc - bin/goyacc -o /dev/null parser/parser.y - bin/goyacc -o parser/parser.go parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; exit 1;}}' - rm -f y.output - - @if [ $(ARCH) = $(LINUX) ]; \ - then \ - sed -i -e 's|//line.*||' -e 's/yyEofCode/yyEOFCode/' parser/parser.go; \ - elif [ $(ARCH) = $(MAC) ]; \ - then \ - /usr/bin/sed -i "" 's|//line.*||' parser/parser.go; \ - /usr/bin/sed -i "" 's/yyEofCode/yyEOFCode/' parser/parser.go; \ - fi - - @awk 'BEGIN{print "// Code generated by goyacc"} {print $0}' parser/parser.go > tmp_parser.go && mv tmp_parser.go parser/parser.go; - -parserlib: parser/parser.go - -parser/parser.go: parser/parser.y - make parser - # The retool tools.json is setup from hack/retool-install.sh check-setup: @which retool >/dev/null 2>&1 || go get github.com/twitchtv/retool @@ -135,7 +114,7 @@ test: checklist gotest explaintest explaintest: server @cd cmd/explaintest && ./run-tests.sh -s ../../bin/tidb-server -gotest: parserlib +gotest: go get github.com/etcd-io/gofail @$(GOFAIL_ENABLE) ifeq ("$(TRAVIS_COVERAGE)", "1") @@ -152,21 +131,21 @@ else endif @$(GOFAIL_DISABLE) -race: parserlib +race: go get github.com/etcd-io/gofail @$(GOFAIL_ENABLE) @export log_level=debug; \ $(GOTEST) -timeout 20m -race $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; } @$(GOFAIL_DISABLE) -leak: parserlib +leak: go get github.com/etcd-io/gofail @$(GOFAIL_ENABLE) @export log_level=debug; \ $(GOTEST) -tags leak $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; } @$(GOFAIL_DISABLE) -tikv_integration_test: parserlib +tikv_integration_test: go get github.com/etcd-io/gofail @$(GOFAIL_ENABLE) $(GOTEST) ./store/tikv/. -with-tikv=true || { $(GOFAIL_DISABLE); exit 1; } @@ -183,14 +162,14 @@ ifeq ("$(WITH_CHECK)", "1") CHECK_FLAG = $(TEST_LDFLAGS) endif -server: parserlib +server: ifeq ($(TARGET), "") $(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o bin/tidb-server tidb-server/main.go else $(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o '$(TARGET)' tidb-server/main.go endif -server_check: parserlib +server_check: ifeq ($(TARGET), "") $(GOBUILD) $(RACE_FLAG) -ldflags '$(CHECK_LDFLAGS)' -o bin/tidb-server tidb-server/main.go else diff --git a/ast/ast.go b/ast/ast.go index 3cc2da1f20e1b..2f3be0b4b4f5a 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -18,10 +18,8 @@ package ast import ( "io" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/chunk" - "golang.org/x/net/context" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/types" ) // Node is the basic element of the AST. @@ -64,14 +62,6 @@ type ExprNode interface { SetType(tp *types.FieldType) // GetType gets the evaluation type of the expression. GetType() *types.FieldType - // SetValue sets value to the expression. - SetValue(val interface{}) - // GetValue gets value of the expression. - GetValue() interface{} - // SetDatum sets datum to the expression. - SetDatum(datum types.Datum) - // GetDatum gets datum of the expression. - GetDatum() *types.Datum // SetFlag sets flag to the expression. // Flag indicates whether the expression contains // parameter marker, reference, aggregate function... @@ -138,31 +128,6 @@ type ResultField struct { Referenced bool } -// RecordSet is an abstract result set interface to help get data from Plan. -type RecordSet interface { - // Fields gets result fields. - Fields() []*ResultField - - // Next reads records into chunk. - Next(ctx context.Context, chk *chunk.Chunk) error - - // NewChunk creates a new chunk with initial capacity. - NewChunk() *chunk.Chunk - - // Close closes the underlying iterator, call Next after Close will - // restart the iteration. - Close() error -} - -// RowToDatums converts row to datum slice. -func RowToDatums(row chunk.Row, fields []*ResultField) []types.Datum { - datums := make([]types.Datum, len(fields)) - for i, f := range fields { - datums[i] = row.GetDatum(i, &f.Column.FieldType) - } - return datums -} - // ResultSetNode interface has a ResultFields property, represents a Node that returns result set. // Implementations include SelectStmt, SubqueryExpr, TableSource, TableName and Join. type ResultSetNode interface { @@ -176,28 +141,6 @@ type SensitiveStmtNode interface { SecureText() string } -// Statement is an interface for SQL execution. -// NOTE: all Statement implementations must be safe for -// concurrent using by multiple goroutines. -// If the Exec method requires any Execution domain local data, -// they must be held out of the implementing instance. -type Statement interface { - // OriginText gets the origin SQL text. - OriginText() string - - // Exec executes SQL and gets a Recordset. - Exec(ctx context.Context) (RecordSet, error) - - // IsPrepared returns whether this statement is prepared statement. - IsPrepared() bool - - // IsReadOnly returns if the statement is read only. For example: SelectStmt without lock. - IsReadOnly() bool - - // RebuildPlan rebuilds the plan of the statement. - RebuildPlan() (schemaVersion int64, err error) -} - // Visitor visits a Node. type Visitor interface { // Enter is called before children nodes are visited. diff --git a/ast/base.go b/ast/base.go index 75ad175dce039..984d8e4d95802 100644 --- a/ast/base.go +++ b/ast/base.go @@ -13,7 +13,7 @@ package ast -import "github.com/pingcap/tidb/types" +import "github.com/pingcap/parser/types" // node is the struct implements node interface except for Accept method. // Node implementations should embed it in. @@ -62,20 +62,12 @@ func (dn *dmlNode) dmlStatement() {} // Expression implementations should embed it in. type exprNode struct { node - types.Datum Type types.FieldType flag uint64 } -// SetDatum implements ExprNode interface. -func (en *exprNode) SetDatum(datum types.Datum) { - en.Datum = datum -} - -// GetDatum implements ExprNode interface. -func (en *exprNode) GetDatum() *types.Datum { - return &en.Datum -} +// TexprNode is exported for parser driver. +type TexprNode = exprNode // SetType implements ExprNode interface. func (en *exprNode) SetType(tp *types.FieldType) { diff --git a/ast/ddl.go b/ast/ddl.go index 340027e881c6f..aefa2eed2dd13 100644 --- a/ast/ddl.go +++ b/ast/ddl.go @@ -14,8 +14,8 @@ package ast import ( - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/types" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/types" ) var ( diff --git a/ast/ddl_test.go b/ast/ddl_test.go index 1aa83a5092a19..a7fbd0f64264d 100644 --- a/ast/ddl_test.go +++ b/ast/ddl_test.go @@ -15,7 +15,7 @@ package ast_test import ( . "github.com/pingcap/check" - . "github.com/pingcap/tidb/ast" + . "github.com/pingcap/parser/ast" ) var _ = Suite(&testDDLSuite{}) diff --git a/ast/dml.go b/ast/dml.go index d3f6575dee0fe..2046f3ad24eb9 100644 --- a/ast/dml.go +++ b/ast/dml.go @@ -14,9 +14,9 @@ package ast import ( - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/util/auth" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" ) var ( diff --git a/ast/dml_test.go b/ast/dml_test.go index 9c6decc35c295..6553c3254b281 100644 --- a/ast/dml_test.go +++ b/ast/dml_test.go @@ -15,7 +15,7 @@ package ast_test import ( . "github.com/pingcap/check" - . "github.com/pingcap/tidb/ast" + . "github.com/pingcap/parser/ast" ) var _ = Suite(&testDMLSuite{}) diff --git a/ast/expressions.go b/ast/expressions.go index e359b121c7444..8706525234625 100644 --- a/ast/expressions.go +++ b/ast/expressions.go @@ -17,13 +17,10 @@ import ( "fmt" "io" "regexp" - "strconv" "strings" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" - "github.com/pingcap/tidb/types" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/opcode" ) var ( @@ -36,7 +33,6 @@ var ( _ ExprNode = &ExistsSubqueryExpr{} _ ExprNode = &IsNullExpr{} _ ExprNode = &IsTruthExpr{} - _ ExprNode = &ParamMarkerExpr{} _ ExprNode = &ParenthesesExpr{} _ ExprNode = &PatternInExpr{} _ ExprNode = &PatternLikeExpr{} @@ -45,7 +41,6 @@ var ( _ ExprNode = &RowExpr{} _ ExprNode = &SubqueryExpr{} _ ExprNode = &UnaryOperationExpr{} - _ ExprNode = &ValueExpr{} _ ExprNode = &ValuesExpr{} _ ExprNode = &VariableExpr{} @@ -53,81 +48,22 @@ var ( _ Node = &WhenClause{} ) -// ValueExpr is the simple value expression. -type ValueExpr struct { - exprNode - projectionOffset int -} - -// Format the ExprNode into a Writer. -func (n *ValueExpr) Format(w io.Writer) { - var s string - switch n.Kind() { - case types.KindNull: - s = "NULL" - case types.KindInt64: - if n.Type.Flag&mysql.IsBooleanFlag != 0 { - if n.GetInt64() > 0 { - s = "TRUE" - } else { - s = "FALSE" - } - } else { - s = strconv.FormatInt(n.GetInt64(), 10) - } - case types.KindUint64: - s = strconv.FormatUint(n.GetUint64(), 10) - case types.KindFloat32: - s = strconv.FormatFloat(n.GetFloat64(), 'e', -1, 32) - case types.KindFloat64: - s = strconv.FormatFloat(n.GetFloat64(), 'e', -1, 64) - case types.KindString, types.KindBytes: - s = strconv.Quote(n.GetString()) - case types.KindMysqlDecimal: - s = n.GetMysqlDecimal().String() - case types.KindBinaryLiteral: - if n.Type.Flag&mysql.UnsignedFlag != 0 { - s = fmt.Sprintf("x'%x'", n.GetBytes()) - } else { - s = n.GetBinaryLiteral().ToBitLiteralString(true) - } - default: - panic("Can't format to string") - } - fmt.Fprint(w, s) +// ValueExpr define a interface for ValueExpr. +type ValueExpr interface { + ExprNode + SetValue(val interface{}) + GetValue() interface{} + GetDatumString() string + GetString() string + GetProjectionOffset() int + SetProjectionOffset(offset int) } // NewValueExpr creates a ValueExpr with value, and sets default field type. -func NewValueExpr(value interface{}) *ValueExpr { - if ve, ok := value.(*ValueExpr); ok { - return ve - } - ve := &ValueExpr{} - ve.SetValue(value) - types.DefaultTypeForValue(value, &ve.Type) - ve.projectionOffset = -1 - return ve -} +var NewValueExpr func(interface{}) ValueExpr -// SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder. -func (n *ValueExpr) SetProjectionOffset(offset int) { - n.projectionOffset = offset -} - -// GetProjectionOffset returns ValueExpr.projectionOffset. -func (n *ValueExpr) GetProjectionOffset() int { - return n.projectionOffset -} - -// Accept implements Node interface. -func (n *ValueExpr) Accept(v Visitor) (Node, bool) { - newNode, skipChildren := v.Enter(n) - if skipChildren { - return v.Leave(newNode) - } - n = newNode.(*ValueExpr) - return v.Leave(n) -} +// NewParamMarkerExpr creates a ParamMarkerExpr. +var NewParamMarkerExpr func(offset int) ParamMarkerExpr // BetweenExpr is for "between and" or "not between and" expression. type BetweenExpr struct { @@ -719,25 +655,9 @@ func (n *PatternLikeExpr) Accept(v Visitor) (Node, bool) { // ParamMarkerExpr expression holds a place for another expression. // Used in parsing prepare statement. -type ParamMarkerExpr struct { - exprNode - Offset int - Order int -} - -// Format the ExprNode into a Writer. -func (n *ParamMarkerExpr) Format(w io.Writer) { - panic("Not implemented") -} - -// Accept implements Node Accept interface. -func (n *ParamMarkerExpr) Accept(v Visitor) (Node, bool) { - newNode, skipChildren := v.Enter(n) - if skipChildren { - return v.Leave(newNode) - } - n = newNode.(*ParamMarkerExpr) - return v.Leave(n) +type ParamMarkerExpr interface { + ValueExpr + SetOrder(int) } // ParenthesesExpr is the parentheses expression. diff --git a/ast/expressions_test.go b/ast/expressions_test.go index 9176e36b70f3a..80ce65d6e6be1 100644 --- a/ast/expressions_test.go +++ b/ast/expressions_test.go @@ -15,7 +15,8 @@ package ast_test import ( . "github.com/pingcap/check" - . "github.com/pingcap/tidb/ast" + . "github.com/pingcap/parser/ast" + _ "github.com/pingcap/tidb/types/parser_driver" ) var _ = Suite(&testExpressionsSuite{}) @@ -79,7 +80,7 @@ func (tc *testExpressionsSuite) TestExpresionsVisitorCover(c *C) { {&ExistsSubqueryExpr{Sel: ce}, 1, 1}, {&IsNullExpr{Expr: ce}, 1, 1}, {&IsTruthExpr{Expr: ce}, 1, 1}, - {&ParamMarkerExpr{}, 0, 0}, + {NewParamMarkerExpr(0), 0, 0}, {&ParenthesesExpr{Expr: ce}, 1, 1}, {&PatternInExpr{Expr: ce, List: []ExprNode{ce, ce, ce}, Sel: ce}, 5, 5}, {&PatternLikeExpr{Expr: ce, Pattern: ce}, 2, 2}, @@ -87,7 +88,7 @@ func (tc *testExpressionsSuite) TestExpresionsVisitorCover(c *C) { {&PositionExpr{}, 0, 0}, {&RowExpr{Values: []ExprNode{ce, ce}}, 2, 2}, {&UnaryOperationExpr{V: ce}, 1, 1}, - {&ValueExpr{}, 0, 0}, + {NewValueExpr(0), 0, 0}, {&ValuesExpr{Column: &ColumnNameExpr{Name: &ColumnName{}}}, 0, 0}, {&VariableExpr{Value: ce}, 1, 1}, } diff --git a/ast/flag.go b/ast/flag.go index 6883f82e138e6..773a2b44483e7 100644 --- a/ast/flag.go +++ b/ast/flag.go @@ -32,6 +32,9 @@ func (f *flagSetter) Enter(in Node) (Node, bool) { } func (f *flagSetter) Leave(in Node) (Node, bool) { + if x, ok := in.(ParamMarkerExpr); ok { + x.SetFlag(FlagHasParamMarker) + } switch x := in.(type) { case *AggregateFuncExpr: f.aggregateFunc(x) @@ -57,8 +60,6 @@ func (f *flagSetter) Leave(in Node) (Node, bool) { x.SetFlag(x.Expr.GetFlag()) case *IsTruthExpr: x.SetFlag(x.Expr.GetFlag()) - case *ParamMarkerExpr: - x.SetFlag(FlagHasParamMarker) case *ParenthesesExpr: x.SetFlag(x.Expr.GetFlag()) case *PatternInExpr: @@ -75,7 +76,6 @@ func (f *flagSetter) Leave(in Node) (Node, bool) { x.SetFlag(FlagHasSubquery) case *UnaryOperationExpr: x.SetFlag(x.V.GetFlag()) - case *ValueExpr: case *ValuesExpr: x.SetFlag(FlagHasReference) case *VariableExpr: diff --git a/ast/flag_test.go b/ast/flag_test.go index a3f7c5d3762c8..fc7f773d4726b 100644 --- a/ast/flag_test.go +++ b/ast/flag_test.go @@ -17,8 +17,8 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" ) func TestT(t *testing.T) { diff --git a/ast/format_test.go b/ast/format_test.go index a5a70030e69b2..45422cbc7ad00 100644 --- a/ast/format_test.go +++ b/ast/format_test.go @@ -5,8 +5,8 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" ) var _ = Suite(&testAstFormatSuite{}) diff --git a/ast/functions.go b/ast/functions.go index bdd81485b92d6..495c6e54f030b 100644 --- a/ast/functions.go +++ b/ast/functions.go @@ -17,8 +17,8 @@ import ( "fmt" "io" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/types" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/types" ) var ( @@ -346,10 +346,10 @@ func (n *FuncCallExpr) specialFormatArgs(w io.Writer) bool { n.Args[0].Format(w) fmt.Fprint(w, ", INTERVAL ") n.Args[1].Format(w) - fmt.Fprintf(w, " %s", n.Args[2].GetDatum().GetString()) + fmt.Fprintf(w, " %s", n.Args[2].(ValueExpr).GetDatumString()) return true case TimestampAdd, TimestampDiff: - fmt.Fprintf(w, "%s, ", n.Args[0].GetDatum().GetString()) + fmt.Fprintf(w, "%s, ", n.Args[0].(ValueExpr).GetDatumString()) n.Args[1].Format(w) fmt.Fprint(w, ", ") n.Args[2].Format(w) diff --git a/ast/functions_test.go b/ast/functions_test.go index f54120c717fd2..d07db759b337c 100644 --- a/ast/functions_test.go +++ b/ast/functions_test.go @@ -15,7 +15,7 @@ package ast_test import ( . "github.com/pingcap/check" - . "github.com/pingcap/tidb/ast" + . "github.com/pingcap/parser/ast" ) var _ = Suite(&testFunctionsSuite{}) @@ -24,10 +24,11 @@ type testFunctionsSuite struct { } func (ts *testFunctionsSuite) TestFunctionsVisitorCover(c *C) { + valueExpr := NewValueExpr(42) stmts := []Node{ - &AggregateFuncExpr{Args: []ExprNode{&ValueExpr{}}}, - &FuncCallExpr{Args: []ExprNode{&ValueExpr{}}}, - &FuncCastExpr{Expr: &ValueExpr{}}, + &AggregateFuncExpr{Args: []ExprNode{valueExpr}}, + &FuncCallExpr{Args: []ExprNode{valueExpr}}, + &FuncCastExpr{Expr: valueExpr}, } for _, stmt := range stmts { diff --git a/ast/misc.go b/ast/misc.go index e9e20b162e0f0..fdcc569d238be 100644 --- a/ast/misc.go +++ b/ast/misc.go @@ -18,9 +18,9 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/util/auth" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" ) var ( @@ -187,7 +187,7 @@ func (n *DeallocateStmt) Accept(v Visitor) (Node, bool) { // Prepared represents a prepared statement. type Prepared struct { Stmt StmtNode - Params []*ParamMarkerExpr + Params []ParamMarkerExpr SchemaVersion int64 UseCache bool } @@ -321,7 +321,7 @@ type VariableAssignment struct { // VariableAssignment should be able to store information for SetCharset/SetPWD Stmt. // For SetCharsetStmt, Value is charset, ExtendValue is collation. // TODO: Use SetStmt to implement set password statement. - ExtendValue *ValueExpr + ExtendValue ValueExpr } // Accept implements Node interface. @@ -869,3 +869,12 @@ func (n *TableOptimizerHint) Accept(v Visitor) (Node, bool) { n = newNode.(*TableOptimizerHint) return v.Leave(n) } + +// NewDecimal creates a types.Decimal value, it's provided by parser driver. +var NewDecimal func(string) (interface{}, error) + +// NewHexLiteral creates a types.HexLiteral value, it's provided by parser driver. +var NewHexLiteral func(string) (interface{}, error) + +// NewBitLiteral creates a types.BitLiteral value, it's provided by parser driver. +var NewBitLiteral func(string) (interface{}, error) diff --git a/ast/misc_test.go b/ast/misc_test.go index d9c14f753fe5f..7e1b80ec053f4 100644 --- a/ast/misc_test.go +++ b/ast/misc_test.go @@ -15,9 +15,9 @@ package ast_test import ( . "github.com/pingcap/check" - . "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/util/auth" + "github.com/pingcap/parser" + . "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" ) var _ = Suite(&testMiscSuite{}) @@ -44,6 +44,7 @@ func (visitor1) Enter(in Node) (Node, bool) { } func (ts *testMiscSuite) TestMiscVisitorCover(c *C) { + valueExpr := NewValueExpr(42) stmts := []Node{ &AdminStmt{}, &AlterUserStmt{}, @@ -53,15 +54,15 @@ func (ts *testMiscSuite) TestMiscVisitorCover(c *C) { &CreateUserStmt{}, &DeallocateStmt{}, &DoStmt{}, - &ExecuteStmt{UsingVars: []ExprNode{&ValueExpr{}}}, + &ExecuteStmt{UsingVars: []ExprNode{valueExpr}}, &ExplainStmt{Stmt: &ShowStmt{}}, &GrantStmt{}, - &PrepareStmt{SQLVar: &VariableExpr{Value: &ValueExpr{}}}, + &PrepareStmt{SQLVar: &VariableExpr{Value: valueExpr}}, &RollbackStmt{}, &SetPwdStmt{}, &SetStmt{Variables: []*VariableAssignment{ { - Value: &ValueExpr{}, + Value: valueExpr, }, }}, &UseStmt{}, @@ -72,7 +73,7 @@ func (ts *testMiscSuite) TestMiscVisitorCover(c *C) { }, &FlushStmt{}, &PrivElem{}, - &VariableAssignment{Value: &ValueExpr{}}, + &VariableAssignment{Value: valueExpr}, &KillStmt{}, &DropStatsStmt{Table: &TableName{}}, } diff --git a/ast/stats.go b/ast/stats.go index d31cb70a8d46a..54e464ee3d09c 100644 --- a/ast/stats.go +++ b/ast/stats.go @@ -13,7 +13,7 @@ package ast -import "github.com/pingcap/tidb/model" +import "github.com/pingcap/parser/model" var ( _ StmtNode = &AnalyzeTableStmt{} diff --git a/cmd/benchdb/main.go b/cmd/benchdb/main.go index e6a91936b9869..54dacd9bcfbc5 100644 --- a/cmd/benchdb/main.go +++ b/cmd/benchdb/main.go @@ -21,9 +21,9 @@ import ( "strings" "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/tikv" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/logutil" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/cmd/benchfilesort/main.go b/cmd/benchfilesort/main.go index 296afe0554bb6..3116638efb902 100644 --- a/cmd/benchfilesort/main.go +++ b/cmd/benchfilesort/main.go @@ -24,8 +24,8 @@ import ( "runtime/pprof" "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/filesort" diff --git a/cmd/benchkv/main.go b/cmd/benchkv/main.go index 06d35ec9a0139..9210170dba708 100644 --- a/cmd/benchkv/main.go +++ b/cmd/benchkv/main.go @@ -24,9 +24,9 @@ import ( _ "github.com/go-sql-driver/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/tikv" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" diff --git a/cmd/benchraw/main.go b/cmd/benchraw/main.go index fcbc3ec428101..f1c6f30b40279 100644 --- a/cmd/benchraw/main.go +++ b/cmd/benchraw/main.go @@ -22,9 +22,9 @@ import ( "sync" "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/store/tikv" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/cmd/explaintest/main.go b/cmd/explaintest/main.go index 2da89d708e071..cc3e6dd9b6e61 100644 --- a/cmd/explaintest/main.go +++ b/cmd/explaintest/main.go @@ -26,7 +26,7 @@ import ( "flag" "github.com/go-sql-driver/mysql" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/logutil" diff --git a/cmd/importer/db.go b/cmd/importer/db.go index 5f5d174bc3f45..92bf182828ed0 100644 --- a/cmd/importer/db.go +++ b/cmd/importer/db.go @@ -21,7 +21,7 @@ import ( "strings" _ "github.com/go-sql-driver/mysql" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/cmd/importer/parser.go b/cmd/importer/parser.go index 13926e1928f58..b953403698d88 100644 --- a/cmd/importer/parser.go +++ b/cmd/importer/parser.go @@ -18,10 +18,10 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" _ "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" @@ -117,7 +117,7 @@ func (col *column) parseColumnOptions(ops []*ast.ColumnOption) { case ast.ColumnOptionPrimaryKey, ast.ColumnOptionUniqKey, ast.ColumnOptionAutoIncrement: col.table.uniqIndices[col.name] = col case ast.ColumnOptionComment: - col.comment = op.Expr.GetDatum().GetString() + col.comment = op.Expr.(ast.ValueExpr).GetDatumString() } } } diff --git a/cmd/importer/stats.go b/cmd/importer/stats.go index e9917cd1872c6..5ef2a543805e3 100644 --- a/cmd/importer/stats.go +++ b/cmd/importer/stats.go @@ -19,7 +19,7 @@ import ( "math/rand" "time" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" stats "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/ddl/callback.go b/ddl/callback.go index 0b290df42aead..340f0d2726165 100644 --- a/ddl/callback.go +++ b/ddl/callback.go @@ -14,8 +14,8 @@ package ddl import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "golang.org/x/net/context" ) diff --git a/ddl/callback_test.go b/ddl/callback_test.go index 57b23d96c9e5e..4b60b4d4f9afd 100644 --- a/ddl/callback_test.go +++ b/ddl/callback_test.go @@ -15,8 +15,8 @@ package ddl import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/ddl/column.go b/ddl/column.go index ace6ad60c2a83..aca665dfb96c4 100644 --- a/ddl/column.go +++ b/ddl/column.go @@ -14,11 +14,11 @@ package ddl import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/ddl/column_change_test.go b/ddl/column_change_test.go index 9ea837ae0a5b1..6655067a3f9c8 100644 --- a/ddl/column_change_test.go +++ b/ddl/column_change_test.go @@ -19,11 +19,11 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/ddl/column_test.go b/ddl/column_test.go index 4eea2c9b862d0..1859f1a696d73 100644 --- a/ddl/column_test.go +++ b/ddl/column_test.go @@ -18,16 +18,16 @@ import ( "sync" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" diff --git a/ddl/db_change_test.go b/ddl/db_change_test.go index 79837b9765ce9..926b57a105b56 100644 --- a/ddl/db_change_test.go +++ b/ddl/db_change_test.go @@ -21,19 +21,20 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/admin" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" @@ -229,7 +230,7 @@ func (s *testStateChangeSuite) test(c *C, tableName, alterTableSQL string, testI type stateCase struct { session session.Session rawStmt ast.StmtNode - stmt ast.Statement + stmt sqlexec.Statement expectedExecErr error expectedCompileErr error } diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index 77f03ba8ad119..2698a82b5256c 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -17,6 +17,7 @@ import ( "fmt" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" @@ -25,7 +26,6 @@ import ( "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testkit" diff --git a/ddl/db_test.go b/ddl/db_test.go index 0044961c6836b..3c40da19ed597 100644 --- a/ddl/db_test.go +++ b/ddl/db_test.go @@ -24,16 +24,17 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + tmysql "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - tmysql "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" @@ -41,7 +42,6 @@ import ( "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/admin" "github.com/pingcap/tidb/util/mock" diff --git a/ddl/ddl.go b/ddl/ddl.go index 75ebad6f7b3dd..e7154f96c6531 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -24,21 +24,21 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/ngaut/pools" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client" - "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/owner" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/binloginfo" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" tidbutil "github.com/pingcap/tidb/util" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/ddl/ddl_api.go b/ddl/ddl_api.go index 70109e9214981..3bb2807bf3afa 100644 --- a/ddl/ddl_api.go +++ b/ddl/ddl_api.go @@ -24,17 +24,17 @@ import ( "time" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pkg/errors" ) diff --git a/ddl/ddl_test.go b/ddl/ddl_test.go index 3968a7d04ffc2..d385df975f84d 100644 --- a/ddl/ddl_test.go +++ b/ddl/ddl_test.go @@ -20,14 +20,14 @@ import ( "github.com/coreos/etcd/clientv3" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/logutil" diff --git a/ddl/ddl_worker.go b/ddl/ddl_worker.go index 128737f065d74..e8dcbdc954627 100644 --- a/ddl/ddl_worker.go +++ b/ddl/ddl_worker.go @@ -20,13 +20,13 @@ import ( "time" "github.com/ngaut/pools" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/binloginfo" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/ddl/ddl_worker_test.go b/ddl/ddl_worker_test.go index 8aa62e5b684ba..dbba30142bea0 100644 --- a/ddl/ddl_worker_test.go +++ b/ddl/ddl_worker_test.go @@ -18,11 +18,11 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/admin" diff --git a/ddl/delete_range.go b/ddl/delete_range.go index 4b12de2d2f419..bde86b2108853 100644 --- a/ddl/delete_range.go +++ b/ddl/delete_range.go @@ -19,12 +19,12 @@ import ( "math" "sync" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/ddl/fail_db_test.go b/ddl/fail_db_test.go index 724d59bdcf621..a55a64027ee6b 100644 --- a/ddl/fail_db_test.go +++ b/ddl/fail_db_test.go @@ -19,11 +19,11 @@ import ( gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/util/testkit" diff --git a/ddl/fail_test.go b/ddl/fail_test.go index f89c4a9aae2ff..f182dbe388c5f 100644 --- a/ddl/fail_test.go +++ b/ddl/fail_test.go @@ -16,8 +16,8 @@ package ddl import ( gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/types" "golang.org/x/net/context" ) diff --git a/ddl/foreign_key.go b/ddl/foreign_key.go index e9aa4c0eb43ad..d6c3de7d75c1e 100644 --- a/ddl/foreign_key.go +++ b/ddl/foreign_key.go @@ -14,9 +14,9 @@ package ddl import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pkg/errors" ) diff --git a/ddl/foreign_key_test.go b/ddl/foreign_key_test.go index 75f5700a6b614..386b62e604e4e 100644 --- a/ddl/foreign_key_test.go +++ b/ddl/foreign_key_test.go @@ -18,9 +18,9 @@ import ( "sync" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/util/testleak" diff --git a/ddl/generated_column.go b/ddl/generated_column.go index 899249a9fb658..3120b2d907258 100644 --- a/ddl/generated_column.go +++ b/ddl/generated_column.go @@ -14,7 +14,7 @@ package ddl import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/table" "github.com/pkg/errors" ) diff --git a/ddl/index.go b/ddl/index.go index 5eedd76f3dbc0..1f3e7993b0391 100644 --- a/ddl/index.go +++ b/ddl/index.go @@ -19,13 +19,13 @@ import ( "sync/atomic" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/store/tikv" diff --git a/ddl/index_change_test.go b/ddl/index_change_test.go index ec7d1ca73b3fa..518b0847471c7 100644 --- a/ddl/index_change_test.go +++ b/ddl/index_change_test.go @@ -15,10 +15,10 @@ package ddl import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/ddl/mock.go b/ddl/mock.go index 3ab786fd0138c..6060eb9bba5bb 100644 --- a/ddl/mock.go +++ b/ddl/mock.go @@ -18,8 +18,8 @@ import ( "time" "github.com/coreos/etcd/clientv3" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/sessionctx" "github.com/pkg/errors" "golang.org/x/net/context" diff --git a/ddl/partition.go b/ddl/partition.go index 9a44f88e80dc3..fc28e0ee49de6 100644 --- a/ddl/partition.go +++ b/ddl/partition.go @@ -19,12 +19,12 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/ddl/reorg.go b/ddl/reorg.go index 035146c9976b1..73d58e16f8bbc 100644 --- a/ddl/reorg.go +++ b/ddl/reorg.go @@ -18,15 +18,15 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" diff --git a/ddl/reorg_test.go b/ddl/reorg_test.go index 84ba4b94bf60c..1bcfe9d21c402 100644 --- a/ddl/reorg_test.go +++ b/ddl/reorg_test.go @@ -17,9 +17,9 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/types" "golang.org/x/net/context" ) diff --git a/ddl/schema.go b/ddl/schema.go index 8e3272c033e1c..0c5cc0e82e21e 100644 --- a/ddl/schema.go +++ b/ddl/schema.go @@ -14,9 +14,9 @@ package ddl import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pkg/errors" ) diff --git a/ddl/schema_test.go b/ddl/schema_test.go index ffe058822e49b..e7fd0941eef77 100644 --- a/ddl/schema_test.go +++ b/ddl/schema_test.go @@ -17,12 +17,12 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/ddl/session_pool.go b/ddl/session_pool.go index 2fa4f39ce6966..7710355ce794b 100644 --- a/ddl/session_pool.go +++ b/ddl/session_pool.go @@ -17,7 +17,7 @@ import ( "sync" "github.com/ngaut/pools" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/mock" "github.com/pkg/errors" diff --git a/ddl/stat_test.go b/ddl/stat_test.go index ac19d7984daf9..304be372c5176 100644 --- a/ddl/stat_test.go +++ b/ddl/stat_test.go @@ -17,7 +17,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" "golang.org/x/net/context" diff --git a/ddl/table.go b/ddl/table.go index cf7643f1a5ff4..295161a24b618 100644 --- a/ddl/table.go +++ b/ddl/table.go @@ -18,12 +18,12 @@ import ( "strconv" "strings" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" "github.com/pkg/errors" diff --git a/ddl/table_split_test.go b/ddl/table_split_test.go index 01a4bcd6def75..697f18c16aa64 100644 --- a/ddl/table_split_test.go +++ b/ddl/table_split_test.go @@ -18,8 +18,8 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/store/tikv" diff --git a/ddl/table_test.go b/ddl/table_test.go index 7fef7c9bd50b5..ad39b3abd9f41 100644 --- a/ddl/table_test.go +++ b/ddl/table_test.go @@ -17,11 +17,11 @@ import ( "fmt" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/ddl/util/event.go b/ddl/util/event.go index d0575a76bccd8..a689c445c13c4 100644 --- a/ddl/util/event.go +++ b/ddl/util/event.go @@ -16,7 +16,7 @@ package util import ( "fmt" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" ) // Event is an event that a ddl operation happened. diff --git a/ddl/util/util.go b/ddl/util/util.go index f2b7c63a4ff14..c9a3c42a65633 100644 --- a/ddl/util/util.go +++ b/ddl/util/util.go @@ -17,9 +17,9 @@ import ( "encoding/hex" "fmt" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" diff --git a/distsql/distsql_test.go b/distsql/distsql_test.go index b06dd9afa6c56..8d20dbd89f755 100644 --- a/distsql/distsql_test.go +++ b/distsql/distsql_test.go @@ -19,13 +19,13 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/execdetails" diff --git a/distsql/request_builder.go b/distsql/request_builder.go index 5dddc206171d3..6dd12c6f20c22 100644 --- a/distsql/request_builder.go +++ b/distsql/request_builder.go @@ -16,8 +16,8 @@ package distsql import ( "math" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" diff --git a/distsql/select_result.go b/distsql/select_result.go index aca9ee0e9f561..9558f9e680ccc 100644 --- a/distsql/select_result.go +++ b/distsql/select_result.go @@ -16,11 +16,11 @@ package distsql import ( "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/statistics" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" diff --git a/distsql/stream.go b/distsql/stream.go index f5bd33583ccd6..0f651a53dc721 100644 --- a/distsql/stream.go +++ b/distsql/stream.go @@ -14,11 +14,11 @@ package distsql import ( + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/statistics" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" diff --git a/domain/domain.go b/domain/domain.go index 280112c45a76f..c59012a0b69e5 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -25,20 +25,20 @@ import ( "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/ngaut/pools" "github.com/ngaut/sync2" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/owner" "github.com/pingcap/tidb/privilege/privileges" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/domain/domain_test.go b/domain/domain_test.go index 63f90deda925e..c516632a99487 100644 --- a/domain/domain_test.go +++ b/domain/domain_test.go @@ -19,8 +19,8 @@ import ( "github.com/ngaut/pools" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/domain/global_vars_cache.go b/domain/global_vars_cache.go index a246f5af20f6c..1b316b4195ad7 100644 --- a/domain/global_vars_cache.go +++ b/domain/global_vars_cache.go @@ -17,7 +17,7 @@ import ( "sync" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/util/chunk" ) diff --git a/domain/info.go b/domain/info.go index 7d11e63436957..226b395eed0c4 100644 --- a/domain/info.go +++ b/domain/info.go @@ -20,9 +20,9 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3/concurrency" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/ddl" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/owner" "github.com/pingcap/tidb/util/hack" "github.com/pingcap/tidb/util/printer" diff --git a/domain/schema_checker_test.go b/domain/schema_checker_test.go index b148525d200a2..bad9db98d0dc8 100644 --- a/domain/schema_checker_test.go +++ b/domain/schema_checker_test.go @@ -17,7 +17,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" ) func (s *testSuite) TestSchemaCheckerSimple(c *C) { diff --git a/domain/topn_slow_query.go b/domain/topn_slow_query.go index f8ae69c0be67e..0bf6721454d6c 100644 --- a/domain/topn_slow_query.go +++ b/domain/topn_slow_query.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/util/execdetails" ) diff --git a/executor/adapter.go b/executor/adapter.go index 23abc549d1ef2..a31ed75bcf3de 100644 --- a/executor/adapter.go +++ b/executor/adapter.go @@ -20,21 +20,22 @@ import ( "sync/atomic" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/logutil" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" @@ -44,7 +45,7 @@ type processinfoSetter interface { SetProcessInfo(string) } -// recordSet wraps an executor, implements ast.RecordSet interface +// recordSet wraps an executor, implements sqlexec.RecordSet interface type recordSet struct { fields []*ast.ResultField executor Executor @@ -125,7 +126,7 @@ func (a *recordSet) Close() error { return errors.Trace(err) } -// ExecStmt implements the ast.Statement interface, it builds a planner.Plan to an ast.Statement. +// ExecStmt implements the sqlexec.Statement interface, it builds a planner.Plan to an sqlexec.Statement. type ExecStmt struct { // InfoSchema stores a reference to the schema information. InfoSchema infoschema.InfoSchema @@ -186,8 +187,8 @@ func (a *ExecStmt) RebuildPlan() (int64, error) { // Exec builds an Executor from a plan. If the Executor doesn't return result, // like the INSERT, UPDATE statements, it executes in this function, if the Executor returns -// result, execution is done after this function returns, in the returned ast.RecordSet Next method. -func (a *ExecStmt) Exec(ctx context.Context) (ast.RecordSet, error) { +// result, execution is done after this function returns, in the returned sqlexec.RecordSet Next method. +func (a *ExecStmt) Exec(ctx context.Context) (sqlexec.RecordSet, error) { a.StartTime = time.Now() sctx := a.Ctx if _, ok := a.Plan.(*plannercore.Analyze); ok && sctx.GetSessionVars().InRestrictedSQL { @@ -252,7 +253,7 @@ func (a *ExecStmt) Exec(ctx context.Context) (ast.RecordSet, error) { }, nil } -func (a *ExecStmt) handleNoDelayExecutor(ctx context.Context, sctx sessionctx.Context, e Executor, pi processinfoSetter) (ast.RecordSet, error) { +func (a *ExecStmt) handleNoDelayExecutor(ctx context.Context, sctx sessionctx.Context, e Executor, pi processinfoSetter) (sqlexec.RecordSet, error) { // Check if "tidb_snapshot" is set for the write executors. // In history read mode, we can not do write operations. switch e.(type) { diff --git a/executor/admin.go b/executor/admin.go index 1fe645ae15de3..d7dd92d6cc36c 100644 --- a/executor/admin.go +++ b/executor/admin.go @@ -16,17 +16,17 @@ package executor import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/ranger" diff --git a/executor/admin_test.go b/executor/admin_test.go index fa3ed027cb605..a82096707d03e 100644 --- a/executor/admin_test.go +++ b/executor/admin_test.go @@ -17,9 +17,9 @@ import ( "fmt" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" diff --git a/executor/aggfuncs/aggfunc_test.go b/executor/aggfuncs/aggfunc_test.go index ac4c1df5f6b22..2f40e218431b4 100644 --- a/executor/aggfuncs/aggfunc_test.go +++ b/executor/aggfuncs/aggfunc_test.go @@ -18,7 +18,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/executor/aggfuncs/builder.go b/executor/aggfuncs/builder.go index 7ba78f94585e6..a9a1547abd46f 100644 --- a/executor/aggfuncs/builder.go +++ b/executor/aggfuncs/builder.go @@ -17,10 +17,10 @@ import ( "fmt" "strconv" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" diff --git a/executor/aggfuncs/func_avg.go b/executor/aggfuncs/func_avg.go index f917c60e1d044..b31b0f96ed69a 100644 --- a/executor/aggfuncs/func_avg.go +++ b/executor/aggfuncs/func_avg.go @@ -15,7 +15,7 @@ package aggfuncs import ( "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/aggfuncs/func_avg_test.go b/executor/aggfuncs/func_avg_test.go index 4b5b5667910c2..9a0b4ddec5887 100644 --- a/executor/aggfuncs/func_avg_test.go +++ b/executor/aggfuncs/func_avg_test.go @@ -15,11 +15,11 @@ package aggfuncs_test import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/executor/aggfuncs" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" ) diff --git a/executor/aggregate.go b/executor/aggregate.go index 3a4c2f588e5ca..2debbc0a761c3 100644 --- a/executor/aggregate.go +++ b/executor/aggregate.go @@ -17,9 +17,9 @@ import ( "sync" "time" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/executor/aggfuncs" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" diff --git a/executor/aggregate_test.go b/executor/aggregate_test.go index f8a098097575c..da7ab15cea6b8 100644 --- a/executor/aggregate_test.go +++ b/executor/aggregate_test.go @@ -15,8 +15,8 @@ package executor_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" plannercore "github.com/pingcap/tidb/planner/core" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/testkit" ) diff --git a/executor/analyze.go b/executor/analyze.go index 12e49ff22649d..85fa0987cfe88 100644 --- a/executor/analyze.go +++ b/executor/analyze.go @@ -17,11 +17,11 @@ import ( "runtime" "strconv" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" diff --git a/executor/analyze_test.go b/executor/analyze_test.go index 2fc3fdf7dd924..ab1a20b483494 100644 --- a/executor/analyze_test.go +++ b/executor/analyze_test.go @@ -18,9 +18,9 @@ import ( "strings" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/executor" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/testkit" diff --git a/executor/batch_checker.go b/executor/batch_checker.go index 6f3ae9254ff2b..558e25884a55e 100644 --- a/executor/batch_checker.go +++ b/executor/batch_checker.go @@ -14,8 +14,8 @@ package executor import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" diff --git a/executor/builder.go b/executor/builder.go index 69aa6dae7185c..1953f8b3c8aff 100644 --- a/executor/builder.go +++ b/executor/builder.go @@ -24,7 +24,9 @@ import ( "github.com/cznic/mathutil" "github.com/cznic/sortutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor/aggfuncs" @@ -33,8 +35,6 @@ import ( "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" diff --git a/executor/checksum.go b/executor/checksum.go index 04c5d18dc2dcd..e9d6832096339 100644 --- a/executor/checksum.go +++ b/executor/checksum.go @@ -16,9 +16,9 @@ package executor import ( "strconv" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/compiler.go b/executor/compiler.go index a56ed97462282..80d9d66b8d794 100644 --- a/executor/compiler.go +++ b/executor/compiler.go @@ -17,7 +17,7 @@ import ( "fmt" "github.com/opentracing/opentracing-go" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/metrics" diff --git a/executor/ddl.go b/executor/ddl.go index 34b4744385083..ba7e9c02390c0 100644 --- a/executor/ddl.go +++ b/executor/ddl.go @@ -17,12 +17,12 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/ddl_test.go b/executor/ddl_test.go index 45884d1c01e64..9c9a6e42be2e6 100644 --- a/executor/ddl_test.go +++ b/executor/ddl_test.go @@ -20,13 +20,13 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testkit" diff --git a/executor/delete.go b/executor/delete.go index 026a1975666d8..c5b7c8283fe34 100644 --- a/executor/delete.go +++ b/executor/delete.go @@ -14,7 +14,7 @@ package executor import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" diff --git a/executor/distsql.go b/executor/distsql.go index 8f7beae3cc28e..89caee248ecf1 100644 --- a/executor/distsql.go +++ b/executor/distsql.go @@ -22,17 +22,17 @@ import ( "time" "unsafe" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/memory" diff --git a/executor/distsql_test.go b/executor/distsql_test.go index 070c10233e1be..c4b29c80071ca 100644 --- a/executor/distsql_test.go +++ b/executor/distsql_test.go @@ -22,9 +22,9 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/store/tikv" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/util/testkit" diff --git a/executor/errors.go b/executor/errors.go index e0aae2b46d2db..ad1c7d9b36344 100644 --- a/executor/errors.go +++ b/executor/errors.go @@ -14,8 +14,8 @@ package executor import ( - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" ) // Error codes that are not mapping to mysql error codes. diff --git a/executor/executor.go b/executor/executor.go index e3e412097d520..c2693e0304292 100644 --- a/executor/executor.go +++ b/executor/executor.go @@ -21,21 +21,21 @@ import ( "time" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/admin" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/executor_pkg_test.go b/executor/executor_pkg_test.go index ef1a158fc0801..51c8dc10370f9 100644 --- a/executor/executor_pkg_test.go +++ b/executor/executor_pkg_test.go @@ -17,10 +17,10 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" diff --git a/executor/executor_test.go b/executor/executor_test.go index 7953f1123f295..75da5b6b09298 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -29,14 +29,15 @@ import ( "github.com/golang/protobuf/proto" . "github.com/pingcap/check" pb "github.com/pingcap/kvproto/pkg/kvrpcpb" + "github.com/pingcap/parser" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" @@ -50,7 +51,6 @@ import ( "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/admin" "github.com/pingcap/tidb/util/codec" diff --git a/executor/grant.go b/executor/grant.go index 8bff64ddba034..2886e1de36791 100644 --- a/executor/grant.go +++ b/executor/grant.go @@ -17,11 +17,11 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/grant_test.go b/executor/grant_test.go index db198f94f454e..bb3d33262ebea 100644 --- a/executor/grant_test.go +++ b/executor/grant_test.go @@ -18,7 +18,7 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/util/testkit" ) diff --git a/executor/index_lookup_join.go b/executor/index_lookup_join.go index b42684c451f0b..aa662bd000d62 100644 --- a/executor/index_lookup_join.go +++ b/executor/index_lookup_join.go @@ -21,11 +21,11 @@ import ( "time" "unsafe" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" diff --git a/executor/insert.go b/executor/insert.go index a62a2524c8003..43a4dbded119b 100644 --- a/executor/insert.go +++ b/executor/insert.go @@ -14,9 +14,9 @@ package executor import ( + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/types" diff --git a/executor/insert_common.go b/executor/insert_common.go index f3f2d413069d8..341ad23b3e9ad 100644 --- a/executor/insert_common.go +++ b/executor/insert_common.go @@ -16,11 +16,11 @@ package executor import ( "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/insert_test.go b/executor/insert_test.go index 0456096d9eb4b..6a43c0ba300d9 100644 --- a/executor/insert_test.go +++ b/executor/insert_test.go @@ -15,8 +15,8 @@ package executor_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/testkit" ) diff --git a/executor/join.go b/executor/join.go index 60f9587edc4f9..e363ea54b892a 100644 --- a/executor/join.go +++ b/executor/join.go @@ -19,9 +19,9 @@ import ( "time" "unsafe" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" plannercore "github.com/pingcap/tidb/planner/core" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/load_data.go b/executor/load_data.go index 83171cbbd8589..6ab6c7aa5050c 100644 --- a/executor/load_data.go +++ b/executor/load_data.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/executor/metrics_test.go b/executor/metrics_test.go index daf4c6fd9a5fc..989afe460fb90 100644 --- a/executor/metrics_test.go +++ b/executor/metrics_test.go @@ -17,8 +17,8 @@ import ( "fmt" . "github.com/pingcap/check" + "github.com/pingcap/parser" "github.com/pingcap/tidb/executor" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/testkit" diff --git a/executor/pkg_test.go b/executor/pkg_test.go index e75e5fade8a55..0c9c0b624af35 100644 --- a/executor/pkg_test.go +++ b/executor/pkg_test.go @@ -4,9 +4,9 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/point_get.go b/executor/point_get.go index 3d41181675bfc..e74c29e8aafbb 100644 --- a/executor/point_get.go +++ b/executor/point_get.go @@ -14,10 +14,10 @@ package executor import ( + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" diff --git a/executor/prepared.go b/executor/prepared.go index 962d35db6ae3c..6e704b3a78bb2 100644 --- a/executor/prepared.go +++ b/executor/prepared.go @@ -17,14 +17,15 @@ import ( "math" "sort" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" @@ -38,7 +39,7 @@ var ( ) type paramMarkerSorter struct { - markers []*ast.ParamMarkerExpr + markers []ast.ParamMarkerExpr } func (p *paramMarkerSorter) Len() int { @@ -46,7 +47,7 @@ func (p *paramMarkerSorter) Len() int { } func (p *paramMarkerSorter) Less(i, j int) bool { - return p.markers[i].Offset < p.markers[j].Offset + return p.markers[i].(*driver.ParamMarkerExpr).Offset < p.markers[j].(*driver.ParamMarkerExpr).Offset } func (p *paramMarkerSorter) Swap(i, j int) { @@ -54,7 +55,7 @@ func (p *paramMarkerSorter) Swap(i, j int) { } type paramMarkerExtractor struct { - markers []*ast.ParamMarkerExpr + markers []ast.ParamMarkerExpr } func (e *paramMarkerExtractor) Enter(in ast.Node) (ast.Node, bool) { @@ -62,7 +63,7 @@ func (e *paramMarkerExtractor) Enter(in ast.Node) (ast.Node, bool) { } func (e *paramMarkerExtractor) Leave(in ast.Node) (ast.Node, bool) { - if x, ok := in.(*ast.ParamMarkerExpr); ok { + if x, ok := in.(*driver.ParamMarkerExpr); ok { e.markers = append(e.markers, x) } return in, true @@ -144,7 +145,7 @@ func (e *PrepareExec) Next(ctx context.Context, chk *chunk.Chunk) error { sort.Sort(sorter) e.ParamCount = len(sorter.markers) for i := 0; i < e.ParamCount; i++ { - sorter.markers[i].Order = i + sorter.markers[i].SetOrder(i) } prepared := &ast.Prepared{ Stmt: stmt, @@ -155,7 +156,7 @@ func (e *PrepareExec) Next(ctx context.Context, chk *chunk.Chunk) error { // We try to build the real statement of preparedStmt. for i := range prepared.Params { - prepared.Params[i].SetDatum(types.NewIntDatum(0)) + prepared.Params[i].(*driver.ParamMarkerExpr).Datum = types.NewIntDatum(0) } var p plannercore.Plan p, err = plannercore.BuildLogicalPlan(e.ctx, stmt, e.is) @@ -238,7 +239,7 @@ func (e *DeallocateExec) Next(ctx context.Context, chk *chunk.Chunk) error { } // CompileExecutePreparedStmt compiles a session Execute command to a stmt.Statement. -func CompileExecutePreparedStmt(ctx sessionctx.Context, ID uint32, args ...interface{}) (ast.Statement, error) { +func CompileExecutePreparedStmt(ctx sessionctx.Context, ID uint32, args ...interface{}) (sqlexec.Statement, error) { execStmt := &ast.ExecuteStmt{ExecID: ID} if err := ResetContextOfStmt(ctx, execStmt); err != nil { return nil, err diff --git a/executor/prepared_test.go b/executor/prepared_test.go index 3e19ca79b9e95..2c5affa9b814a 100644 --- a/executor/prepared_test.go +++ b/executor/prepared_test.go @@ -18,9 +18,9 @@ import ( "strings" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/executor" plannercore "github.com/pingcap/tidb/planner/core" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/testkit" "github.com/pkg/errors" "golang.org/x/net/context" diff --git a/executor/revoke.go b/executor/revoke.go index 3f2edb6c7249b..35992f885615f 100644 --- a/executor/revoke.go +++ b/executor/revoke.go @@ -16,10 +16,10 @@ package executor import ( "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/revoke_test.go b/executor/revoke_test.go index cc3025f7a55e5..de194356b0a95 100644 --- a/executor/revoke_test.go +++ b/executor/revoke_test.go @@ -18,7 +18,7 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/util/testkit" ) diff --git a/executor/set.go b/executor/set.go index 76562a6a4f8f9..f7f7853c8717c 100644 --- a/executor/set.go +++ b/executor/set.go @@ -18,14 +18,14 @@ import ( "strings" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" diff --git a/executor/set_test.go b/executor/set_test.go index a9ecf17a286f1..5574d32bb4b08 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -15,9 +15,9 @@ package executor_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testutil" "golang.org/x/net/context" diff --git a/executor/show.go b/executor/show.go index 72d20117ccdca..e8b7e459e9484 100644 --- a/executor/show.go +++ b/executor/show.go @@ -22,19 +22,19 @@ import ( "time" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/auth" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/format" "github.com/pkg/errors" diff --git a/executor/show_stats.go b/executor/show_stats.go index 6c8c4f0ddc258..a6e77cba4de7a 100644 --- a/executor/show_stats.go +++ b/executor/show_stats.go @@ -16,8 +16,8 @@ package executor import ( "time" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/types" diff --git a/executor/show_test.go b/executor/show_test.go index 21398c6c30ca6..ba272d2686fe1 100644 --- a/executor/show_test.go +++ b/executor/show_test.go @@ -19,16 +19,16 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/util" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testutil" "github.com/pkg/errors" diff --git a/executor/simple.go b/executor/simple.go index aed2e196973f3..ef4769d1092f2 100644 --- a/executor/simple.go +++ b/executor/simple.go @@ -17,16 +17,16 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" diff --git a/executor/simple_test.go b/executor/simple_test.go index a154304076d2c..e97d21b142902 100644 --- a/executor/simple_test.go +++ b/executor/simple_test.go @@ -15,14 +15,14 @@ package executor_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/testkit" "golang.org/x/net/context" ) diff --git a/executor/statement_context_test.go b/executor/statement_context_test.go index 5808488fed575..df7d86d4115a8 100644 --- a/executor/statement_context_test.go +++ b/executor/statement_context_test.go @@ -18,8 +18,8 @@ import ( "unicode/utf8" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/testkit" ) diff --git a/executor/table_reader.go b/executor/table_reader.go index a941e3706bee8..3c81d402d141c 100644 --- a/executor/table_reader.go +++ b/executor/table_reader.go @@ -16,8 +16,8 @@ package executor import ( "time" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/distsql" - "github.com/pingcap/tidb/model" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" diff --git a/executor/trace.go b/executor/trace.go index 588df29065c1b..53747498e6667 100644 --- a/executor/trace.go +++ b/executor/trace.go @@ -18,7 +18,7 @@ import ( "github.com/opentracing/basictracer-go" opentracing "github.com/opentracing/opentracing-go" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/tracing" diff --git a/executor/union_scan.go b/executor/union_scan.go index 1ac6689c1b58d..aad9bb157fef4 100644 --- a/executor/union_scan.go +++ b/executor/union_scan.go @@ -17,8 +17,8 @@ import ( "sort" "time" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/executor/update.go b/executor/update.go index c4be098057a52..b257425e1d41b 100644 --- a/executor/update.go +++ b/executor/update.go @@ -14,9 +14,9 @@ package executor import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/executor/write.go b/executor/write.go index de34f67bce23b..7a4695bccd1d0 100644 --- a/executor/write.go +++ b/executor/write.go @@ -16,9 +16,9 @@ package executor import ( "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" diff --git a/executor/write_test.go b/executor/write_test.go index f4d9f0542b370..fb5e1b8b97388 100644 --- a/executor/write_test.go +++ b/executor/write_test.go @@ -19,9 +19,9 @@ import ( "sync/atomic" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" diff --git a/expression/aggregation/agg_to_pb.go b/expression/aggregation/agg_to_pb.go index 31a743d59621a..59d09db237701 100644 --- a/expression/aggregation/agg_to_pb.go +++ b/expression/aggregation/agg_to_pb.go @@ -14,7 +14,7 @@ package aggregation import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/sessionctx/stmtctx" diff --git a/expression/aggregation/agg_to_pb_test.go b/expression/aggregation/agg_to_pb_test.go index 2a17b120e5394..af8ca6d26f8a2 100644 --- a/expression/aggregation/agg_to_pb_test.go +++ b/expression/aggregation/agg_to_pb_test.go @@ -18,10 +18,10 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" diff --git a/expression/aggregation/aggregation.go b/expression/aggregation/aggregation.go index 9d2ac730767e3..62eba44691139 100644 --- a/expression/aggregation/aggregation.go +++ b/expression/aggregation/aggregation.go @@ -16,14 +16,14 @@ package aggregation import ( "bytes" "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" diff --git a/expression/aggregation/aggregation_test.go b/expression/aggregation/aggregation_test.go index 9040f06aeccc9..0ebbe8a330eef 100644 --- a/expression/aggregation/aggregation_test.go +++ b/expression/aggregation/aggregation_test.go @@ -17,9 +17,9 @@ import ( "math" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" diff --git a/expression/aggregation/avg.go b/expression/aggregation/avg.go index b934e6be2eb6a..04d70fa985d04 100644 --- a/expression/aggregation/avg.go +++ b/expression/aggregation/avg.go @@ -15,9 +15,9 @@ package aggregation import ( "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pkg/errors" diff --git a/expression/aggregation/bench_test.go b/expression/aggregation/bench_test.go index 5b7c2bcee2e4f..e49deebe00da3 100644 --- a/expression/aggregation/bench_test.go +++ b/expression/aggregation/bench_test.go @@ -16,9 +16,9 @@ package aggregation import ( "testing" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" ) diff --git a/expression/aggregation/descriptor.go b/expression/aggregation/descriptor.go index 7c47ec85c0d64..e631c9cd6629d 100644 --- a/expression/aggregation/descriptor.go +++ b/expression/aggregation/descriptor.go @@ -21,14 +21,14 @@ import ( "strings" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" ) // AggFuncDesc describes an aggregation function signature, only used in planner. diff --git a/expression/bench_test.go b/expression/bench_test.go index 1704afa516d3c..bc4a58ed81b45 100644 --- a/expression/bench_test.go +++ b/expression/bench_test.go @@ -20,12 +20,12 @@ import ( "testing" "time" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" ) diff --git a/expression/builtin.go b/expression/builtin.go index ba165008278f9..51379440e7e28 100644 --- a/expression/builtin.go +++ b/expression/builtin.go @@ -18,13 +18,13 @@ package expression import ( - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" ) diff --git a/expression/builtin_arithmetic.go b/expression/builtin_arithmetic.go index 85c620264d25d..1f7369699519a 100644 --- a/expression/builtin_arithmetic.go +++ b/expression/builtin_arithmetic.go @@ -18,9 +18,9 @@ import ( "math" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" diff --git a/expression/builtin_arithmetic_test.go b/expression/builtin_arithmetic_test.go index 68fe74333ef5a..61a47bbc5d334 100644 --- a/expression/builtin_arithmetic_test.go +++ b/expression/builtin_arithmetic_test.go @@ -17,8 +17,8 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/builtin_cast.go b/expression/builtin_cast.go index b3e8a539b9f7f..74b3e2cee22a5 100644 --- a/expression/builtin_cast.go +++ b/expression/builtin_cast.go @@ -26,14 +26,14 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" diff --git a/expression/builtin_cast_test.go b/expression/builtin_cast_test.go index dd9d00daed014..1e4ef80c7a0e4 100644 --- a/expression/builtin_cast_test.go +++ b/expression/builtin_cast_test.go @@ -20,11 +20,11 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" ) diff --git a/expression/builtin_compare.go b/expression/builtin_compare.go index c83f861b546b7..0744720694378 100644 --- a/expression/builtin_compare.go +++ b/expression/builtin_compare.go @@ -16,11 +16,11 @@ package expression import ( "math" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_compare_test.go b/expression/builtin_compare_test.go index 4ce6c3386e750..24cd01ea541dd 100644 --- a/expression/builtin_compare_test.go +++ b/expression/builtin_compare_test.go @@ -17,8 +17,8 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_control.go b/expression/builtin_control.go index 9900a22bed4a8..fc8013f6096cc 100644 --- a/expression/builtin_control.go +++ b/expression/builtin_control.go @@ -15,11 +15,11 @@ package expression import ( "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" diff --git a/expression/builtin_control_test.go b/expression/builtin_control_test.go index de589e1a0b4fc..37101ec326f88 100644 --- a/expression/builtin_control_test.go +++ b/expression/builtin_control_test.go @@ -18,7 +18,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/builtin_encryption.go b/expression/builtin_encryption.go index 94eaef8a84574..7772cd344a8a2 100644 --- a/expression/builtin_encryption.go +++ b/expression/builtin_encryption.go @@ -28,11 +28,11 @@ import ( "io" "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/encrypt" "github.com/pkg/errors" diff --git a/expression/builtin_encryption_test.go b/expression/builtin_encryption_test.go index 99f29ea972933..7a1b09254f6f2 100644 --- a/expression/builtin_encryption_test.go +++ b/expression/builtin_encryption_test.go @@ -18,9 +18,9 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/hack" diff --git a/expression/builtin_info.go b/expression/builtin_info.go index b498e96f289e1..e26efd1e27c0a 100644 --- a/expression/builtin_info.go +++ b/expression/builtin_info.go @@ -18,7 +18,7 @@ package expression import ( - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_info_test.go b/expression/builtin_info_test.go index c71ce15c88bd5..b28b6b80defe0 100644 --- a/expression/builtin_info_test.go +++ b/expression/builtin_info_test.go @@ -17,11 +17,11 @@ import ( "math" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/printer" diff --git a/expression/builtin_json.go b/expression/builtin_json.go index 9a1fdb318546b..0ff0f53eb8d77 100644 --- a/expression/builtin_json.go +++ b/expression/builtin_json.go @@ -14,8 +14,8 @@ package expression import ( - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" diff --git a/expression/builtin_json_test.go b/expression/builtin_json_test.go index ab4be5790ad9f..d6e6542fc119b 100644 --- a/expression/builtin_json_test.go +++ b/expression/builtin_json_test.go @@ -15,7 +15,7 @@ package expression import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_math.go b/expression/builtin_math.go index 68ee63a974114..f0770420e0cf9 100644 --- a/expression/builtin_math.go +++ b/expression/builtin_math.go @@ -27,7 +27,7 @@ import ( "time" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_math_test.go b/expression/builtin_math_test.go index db01a7864dfe5..4a557302bba65 100644 --- a/expression/builtin_math_test.go +++ b/expression/builtin_math_test.go @@ -20,10 +20,10 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/tidb/util/testutil" diff --git a/expression/builtin_miscellaneous.go b/expression/builtin_miscellaneous.go index b249551247340..c046861911395 100644 --- a/expression/builtin_miscellaneous.go +++ b/expression/builtin_miscellaneous.go @@ -21,11 +21,11 @@ import ( "strings" "time" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pkg/errors" "github.com/twinj/uuid" diff --git a/expression/builtin_miscellaneous_test.go b/expression/builtin_miscellaneous_test.go index 213ed1e8d1cc7..79143dad631a4 100644 --- a/expression/builtin_miscellaneous_test.go +++ b/expression/builtin_miscellaneous_test.go @@ -17,7 +17,7 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/builtin_op.go b/expression/builtin_op.go index 1c4109da9c1b1..e98d83af53835 100644 --- a/expression/builtin_op.go +++ b/expression/builtin_op.go @@ -17,8 +17,8 @@ import ( "fmt" "math" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/builtin_op_test.go b/expression/builtin_op_test.go index 5e726be8745c7..f57f17aab557f 100644 --- a/expression/builtin_op_test.go +++ b/expression/builtin_op_test.go @@ -17,7 +17,7 @@ import ( "math" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/builtin_other.go b/expression/builtin_other.go index 7e07abeae88cc..44cef208b8ebc 100644 --- a/expression/builtin_other.go +++ b/expression/builtin_other.go @@ -16,7 +16,7 @@ package expression import ( "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" diff --git a/expression/builtin_other_test.go b/expression/builtin_other_test.go index 893dad92110f3..713965ce81f03 100644 --- a/expression/builtin_other_test.go +++ b/expression/builtin_other_test.go @@ -18,8 +18,8 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" diff --git a/expression/builtin_string.go b/expression/builtin_string.go index fd429d893a354..ac1dc3f2a8b53 100644 --- a/expression/builtin_string.go +++ b/expression/builtin_string.go @@ -27,12 +27,12 @@ import ( "strings" "unicode/utf8" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" diff --git a/expression/builtin_string_test.go b/expression/builtin_string_test.go index c90068ae365fe..944b763bb8121 100644 --- a/expression/builtin_string_test.go +++ b/expression/builtin_string_test.go @@ -20,12 +20,12 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/builtin_test.go b/expression/builtin_test.go index b12f49ada982a..2be7dccf751cf 100644 --- a/expression/builtin_test.go +++ b/expression/builtin_test.go @@ -17,12 +17,12 @@ import ( "reflect" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" diff --git a/expression/builtin_time.go b/expression/builtin_time.go index f9c6a9425b81b..0e7ff2fe98aa5 100644 --- a/expression/builtin_time.go +++ b/expression/builtin_time.go @@ -26,10 +26,10 @@ import ( "time" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tipb/go-tipb" diff --git a/expression/builtin_time_test.go b/expression/builtin_time_test.go index f2a46abb302eb..6fe40c5064895 100644 --- a/expression/builtin_time_test.go +++ b/expression/builtin_time_test.go @@ -20,13 +20,13 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/chunk_executor.go b/expression/chunk_executor.go index 857211d65a3e1..76efd21031af0 100644 --- a/expression/chunk_executor.go +++ b/expression/chunk_executor.go @@ -16,8 +16,8 @@ package expression import ( "strconv" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/column.go b/expression/column.go index 2c47c38b451c3..5306565373996 100644 --- a/expression/column.go +++ b/expression/column.go @@ -17,8 +17,8 @@ import ( "fmt" "strings" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" diff --git a/expression/column_test.go b/expression/column_test.go index 62a180aab604a..8f11509783055 100644 --- a/expression/column_test.go +++ b/expression/column_test.go @@ -15,8 +15,8 @@ package expression import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/constant.go b/expression/constant.go index c1479355d5c13..e2725ed553727 100644 --- a/expression/constant.go +++ b/expression/constant.go @@ -16,10 +16,10 @@ package expression import ( "fmt" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/constant_fold.go b/expression/constant_fold.go index 0f7e85fa18ba9..738def5d041bb 100644 --- a/expression/constant_fold.go +++ b/expression/constant_fold.go @@ -14,7 +14,7 @@ package expression import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/util/chunk" log "github.com/sirupsen/logrus" ) diff --git a/expression/constant_propagation.go b/expression/constant_propagation.go index 8bf71a42c4abf..edfc634c7cfb1 100644 --- a/expression/constant_propagation.go +++ b/expression/constant_propagation.go @@ -14,10 +14,10 @@ package expression import ( - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/disjointset" diff --git a/expression/constant_test.go b/expression/constant_test.go index bda66eb8b3f46..e864c6e3a4fbb 100644 --- a/expression/constant_test.go +++ b/expression/constant_test.go @@ -19,9 +19,9 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/distsql_builtin.go b/expression/distsql_builtin.go index c2df220d869bf..7d90ff1db72af 100644 --- a/expression/distsql_builtin.go +++ b/expression/distsql_builtin.go @@ -17,8 +17,8 @@ import ( "fmt" "time" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" diff --git a/expression/distsql_builtin_test.go b/expression/distsql_builtin_test.go index 2df78ca40fe9b..25162e2edcdf2 100644 --- a/expression/distsql_builtin_test.go +++ b/expression/distsql_builtin_test.go @@ -17,7 +17,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/errors.go b/expression/errors.go index 517398bd0a9a3..f2560e96da774 100644 --- a/expression/errors.go +++ b/expression/errors.go @@ -14,9 +14,9 @@ package expression import ( - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" ) diff --git a/expression/evaluator_test.go b/expression/evaluator_test.go index 95999a46b6615..b938d5eb6b88f 100644 --- a/expression/evaluator_test.go +++ b/expression/evaluator_test.go @@ -18,13 +18,13 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/expr_to_pb.go b/expression/expr_to_pb.go index 6dee4893ba66c..1e5384c60de6a 100644 --- a/expression/expr_to_pb.go +++ b/expression/expr_to_pb.go @@ -16,13 +16,13 @@ package expression import ( "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tipb/go-tipb" diff --git a/expression/expr_to_pb_test.go b/expression/expr_to_pb_test.go index a4d96e571411d..edd06d9b3dcd3 100644 --- a/expression/expr_to_pb_test.go +++ b/expression/expr_to_pb_test.go @@ -17,11 +17,11 @@ import ( "encoding/json" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/mock" ) diff --git a/expression/expression.go b/expression/expression.go index 072bc5a62f1bf..5d6fa3a276723 100644 --- a/expression/expression.go +++ b/expression/expression.go @@ -17,12 +17,12 @@ import ( goJSON "encoding/json" "fmt" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/expression_test.go b/expression/expression_test.go index 0fe3b7da63bd5..d96135617bc7f 100644 --- a/expression/expression_test.go +++ b/expression/expression_test.go @@ -17,9 +17,9 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/function_traits.go b/expression/function_traits.go index ae3f4b05ea888..8d8913fd354d4 100644 --- a/expression/function_traits.go +++ b/expression/function_traits.go @@ -14,7 +14,7 @@ package expression import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" ) // UnCacheableFunctions stores functions which can not be cached to plan cache. diff --git a/expression/function_traits_test.go b/expression/function_traits_test.go index 13982d9e85907..11a21da4beb65 100644 --- a/expression/function_traits_test.go +++ b/expression/function_traits_test.go @@ -15,7 +15,7 @@ package expression import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/util/testleak" ) diff --git a/expression/helper.go b/expression/helper.go index fe193651712a1..7759d944b756b 100644 --- a/expression/helper.go +++ b/expression/helper.go @@ -18,12 +18,13 @@ import ( "strings" "time" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pkg/errors" ) @@ -74,7 +75,7 @@ func GetTimeValue(ctx sessionctx.Context, v interface{}, tp byte, fsp int) (d ty return d, errors.Trace(err) } } - case *ast.ValueExpr: + case *driver.ValueExpr: switch x.Kind() { case types.KindString: value, err = types.ParseTime(sc, x.GetString(), tp, fsp) diff --git a/expression/helper_test.go b/expression/helper_test.go index f63109a5a28e6..e0acecfdf817b 100644 --- a/expression/helper_test.go +++ b/expression/helper_test.go @@ -18,9 +18,9 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" diff --git a/expression/integration_test.go b/expression/integration_test.go index f2ac973bbff5d..83567ebcc5159 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -21,19 +21,19 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/scalar_function.go b/expression/scalar_function.go index 34f0d7673e7ec..7705c2ff48b08 100644 --- a/expression/scalar_function.go +++ b/expression/scalar_function.go @@ -17,12 +17,12 @@ import ( "bytes" "fmt" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/expression/scalar_function_test.go b/expression/scalar_function_test.go index f4088c2b010c1..ef466355c1f53 100644 --- a/expression/scalar_function_test.go +++ b/expression/scalar_function_test.go @@ -17,9 +17,9 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/schema.go b/expression/schema.go index ffa41b72498d9..50cdb9d6b4dbf 100644 --- a/expression/schema.go +++ b/expression/schema.go @@ -16,7 +16,7 @@ package expression import ( "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pkg/errors" ) diff --git a/expression/schema_test.go b/expression/schema_test.go index d28a41d7263f7..6ea5de276245b 100644 --- a/expression/schema_test.go +++ b/expression/schema_test.go @@ -17,7 +17,7 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" ) // generateKeys4Schema will generate keys for a given schema. Used only in this file. diff --git a/expression/simple_rewriter.go b/expression/simple_rewriter.go index 734228c8a45d4..6103cf2ddd4bb 100644 --- a/expression/simple_rewriter.go +++ b/expression/simple_rewriter.go @@ -14,13 +14,14 @@ package expression import ( - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pkg/errors" ) @@ -107,7 +108,7 @@ func (sr *simpleRewriter) Leave(originInNode ast.Node) (retNode ast.Node, ok boo return originInNode, false } sr.push(column) - case *ast.ValueExpr: + case *driver.ValueExpr: value := &Constant{Value: v.Datum, RetType: &v.Type} sr.push(value) case *ast.FuncCallExpr: @@ -137,10 +138,10 @@ func (sr *simpleRewriter) Leave(originInNode ast.Node) (retNode ast.Node, ok boo if v.Sel == nil { sr.inToExpression(len(v.List), v.Not, &v.Type) } - case *ast.ParamMarkerExpr: + case *driver.ParamMarkerExpr: tp := types.NewFieldType(mysql.TypeUnspecified) types.DefaultParamTypeForValue(v.GetValue(), tp) - value := &Constant{Value: v.Datum, RetType: tp} + value := &Constant{Value: v.ValueExpr.Datum, RetType: tp} sr.push(value) case *ast.RowExpr: sr.rowToScalarFunc(v) diff --git a/expression/typeinfer_test.go b/expression/typeinfer_test.go index bb86b140d5caf..1517cc674443f 100644 --- a/expression/typeinfer_test.go +++ b/expression/typeinfer_test.go @@ -17,14 +17,14 @@ import ( "math" . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/printer" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" diff --git a/expression/util.go b/expression/util.go index 70cf52e9a7df7..1b3b3afaa4847 100644 --- a/expression/util.go +++ b/expression/util.go @@ -19,11 +19,11 @@ import ( "time" "unicode" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/hack" diff --git a/expression/util_test.go b/expression/util_test.go index 2fdbc067dff9e..7e810180dc264 100644 --- a/expression/util_test.go +++ b/expression/util_test.go @@ -17,8 +17,8 @@ import ( "testing" "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/infoschema/builder.go b/infoschema/builder.go index 85caaee73e17f..2f6b1a6ebc3b8 100644 --- a/infoschema/builder.go +++ b/infoschema/builder.go @@ -17,9 +17,9 @@ import ( "fmt" "sort" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/perfschema" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" diff --git a/infoschema/infoschema.go b/infoschema/infoschema.go index 94469ce7f5c45..79da4b273b2b0 100644 --- a/infoschema/infoschema.go +++ b/infoschema/infoschema.go @@ -17,12 +17,12 @@ import ( "sort" "sync/atomic" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/terror" ) var ( diff --git a/infoschema/infoschema_test.go b/infoschema/infoschema_test.go index 840730638092a..13b4217fcdbf1 100644 --- a/infoschema/infoschema_test.go +++ b/infoschema/infoschema_test.go @@ -18,11 +18,11 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/perfschema" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/types" diff --git a/infoschema/tables.go b/infoschema/tables.go index 80e80a54144b7..0d8082da5651a 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -19,16 +19,16 @@ import ( "sync" "time" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" ) diff --git a/infoschema/tables_test.go b/infoschema/tables_test.go index 0bdd327075f8a..7c9ded48def9e 100644 --- a/infoschema/tables_test.go +++ b/infoschema/tables_test.go @@ -15,11 +15,11 @@ package infoschema_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/auth" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" ) diff --git a/kv/error.go b/kv/error.go index 68be6b86f04fb..b705165238783 100644 --- a/kv/error.go +++ b/kv/error.go @@ -16,8 +16,8 @@ package kv import ( "strings" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" ) // KV error codes. diff --git a/kv/memdb_buffer.go b/kv/memdb_buffer.go index 9a57e2cfe16fc..1de19e527af5b 100644 --- a/kv/memdb_buffer.go +++ b/kv/memdb_buffer.go @@ -23,7 +23,7 @@ import ( "github.com/pingcap/goleveldb/leveldb/iterator" "github.com/pingcap/goleveldb/leveldb/memdb" "github.com/pingcap/goleveldb/leveldb/util" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/kv/txn.go b/kv/txn.go index 6a8710dbf51dd..4bd5904c7976b 100644 --- a/kv/txn.go +++ b/kv/txn.go @@ -18,7 +18,7 @@ import ( "math/rand" "time" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/kv/union_store_test.go b/kv/union_store_test.go index 2b06b2f39d605..3297b14f969bc 100644 --- a/kv/union_store_test.go +++ b/kv/union_store_test.go @@ -15,7 +15,7 @@ package kv import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/util/testleak" ) diff --git a/meta/autoid/autoid.go b/meta/autoid/autoid.go index 095b7ba271db4..4c8ba2e189473 100644 --- a/meta/autoid/autoid.go +++ b/meta/autoid/autoid.go @@ -20,10 +20,10 @@ import ( "time" "github.com/cznic/mathutil" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/meta/autoid/autoid_test.go b/meta/autoid/autoid_test.go index 15caebe1cd36d..173466190c53e 100644 --- a/meta/autoid/autoid_test.go +++ b/meta/autoid/autoid_test.go @@ -20,10 +20,10 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/store/mockstore" "github.com/pkg/errors" ) diff --git a/meta/meta.go b/meta/meta.go index 877453d67c012..5234bc30f3ef0 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -24,12 +24,12 @@ import ( "sync" "time" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/structure" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/meta/meta_test.go b/meta/meta_test.go index 823f71b3e0167..81a987a3fb4ea 100644 --- a/meta/meta_test.go +++ b/meta/meta_test.go @@ -19,8 +19,8 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/util/testleak" "golang.org/x/net/context" diff --git a/metrics/server.go b/metrics/server.go index e8417274d2775..c18058f1461eb 100644 --- a/metrics/server.go +++ b/metrics/server.go @@ -16,7 +16,7 @@ package metrics import ( "strconv" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" ) diff --git a/model/ddl.go b/model/ddl.go index 23db9df3e2d90..843dbe1850726 100644 --- a/model/ddl.go +++ b/model/ddl.go @@ -20,7 +20,7 @@ import ( "sync" "time" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/model/model.go b/model/model.go index c488ac86a4791..71c2e77835d60 100644 --- a/model/model.go +++ b/model/model.go @@ -19,9 +19,8 @@ import ( "strings" "time" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/hack" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/types" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" ) @@ -114,7 +113,7 @@ func (c *ColumnInfo) SetDefaultValue(value interface{}) error { // bit type default value will store in DefaultValueBit for fix bit default value decode/encode bug. func (c *ColumnInfo) GetDefaultValue() interface{} { if c.Tp == mysql.TypeBit && c.DefaultValueBit != nil { - return hack.String(c.DefaultValueBit) + return string(c.DefaultValueBit) } return c.DefaultValue } diff --git a/model/model_test.go b/model/model_test.go index a7cf298adb30d..77aa95588e61a 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -20,7 +20,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" ) diff --git a/mysql/const_test.go b/mysql/const_test.go index 4ad54fd5df097..11c61157b7cd9 100644 --- a/mysql/const_test.go +++ b/mysql/const_test.go @@ -18,10 +18,10 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/store/mockstore/mocktikv" diff --git a/owner/fail_test.go b/owner/fail_test.go index acc94606441ec..5574c34846014 100644 --- a/owner/fail_test.go +++ b/owner/fail_test.go @@ -23,7 +23,7 @@ import ( "github.com/coreos/etcd/clientv3" gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/testleak" "golang.org/x/net/context" diff --git a/owner/manager.go b/owner/manager.go index 6ac8d8eac285f..640bb5d571cf6 100644 --- a/owner/manager.go +++ b/owner/manager.go @@ -26,8 +26,8 @@ import ( "github.com/coreos/etcd/clientv3/concurrency" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" "github.com/coreos/etcd/mvcc/mvccpb" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/parser/bench_test.go b/parser/bench_test.go deleted file mode 100644 index ddac12302c161..0000000000000 --- a/parser/bench_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 PingCAP, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// See the License for the specific language governing permissions and -// limitations under the License. - -package parser - -import ( - "testing" -) - -func BenchmarkSysbenchSelect(b *testing.B) { - parser := New() - sql := "SELECT pad FROM sbtest1 WHERE id=1;" - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := parser.Parse(sql, "", "") - if err != nil { - b.Fatal(err) - } - } - b.ReportAllocs() -} - -func BenchmarkParse(b *testing.B) { - var table = []string{ - "insert into t values (1), (2), (3)", - "insert into t values (4), (5), (6), (7)", - "select c from t where c > 2", - } - parser := New() - b.ResetTimer() - for i := 0; i < b.N; i++ { - for _, v := range table { - _, err := parser.Parse(v, "", "") - if err != nil { - b.Failed() - } - } - } - b.ReportAllocs() -} diff --git a/parser/goyacc/main.go b/parser/goyacc/main.go deleted file mode 100644 index 69da64b733ddb..0000000000000 --- a/parser/goyacc/main.go +++ /dev/null @@ -1,819 +0,0 @@ -// Copyright 2016 PingCAP, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// See the License for the specific language governing permissions and -// limitations under the License. - -// Copyright 2014 The goyacc Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This source code uses portions of code previously published in the Go tool -// yacc[0] program, the respective license can be found in the LICENSE-GO-YACC -// file. - -// Goyacc is a version of yacc generating Go parsers. -// -// Usage -// -// Note: If no non flag arguments are given, goyacc reads standard input. -// -// goyacc [options] [input] -// -// options and (defaults) -// -c Report state closures. (false) -// -cr Check all states are reducible. (false) -// -dlval Debug value when runtime yyDebug >= 3. ("lval") -// -dlvalf Debug format of -dlval. ("%+v") -// -ex Explain how were conflicts resolved. (false) -// -l Disable line directives, for compatibility only - ignored. (false) -// -la Report all lookahead sets. (false) -// -o outputFile Parser output. ("y.go") -// -p prefix Name prefix to use in generated code. ("yy") -// -v reportFile Create grammar report. ("y.output") -// -xe examplesFile Generate error messages by examples. ("") -// -xegen examplesFile Generate a file suitable for -xe automatically from the grammar. -// The file must not exist. ("") -// -// -// -// Changelog -// -// 2015-03-24: The search for a custom error message is now extended to include -// also the last state that was shifted into, if any. This change resolves a -// problem in which a lookahead symbol is valid for a reduce action in state A, -// but the same symbol is later never accepted by any shift action in some -// state B which is popped from the state stack after the reduction is -// performed. The computed from example state is A but when the error is -// actually detected, the state is now B and the custom error was thus not -// used. -// -// 2015-02-23: Added -xegen flag. It can be used to automagically generate a -// skeleton errors by example file which can be, for example, edited and/or -// submited later as an argument of the -xe option. -// -// 2014-12-18: Support %precedence for better bison compatibility[3]. The -// actual changes are in packages goyacc is dependent on. Goyacc users should -// rebuild the binary: -// -// $ go get -u github.com/cznic/goyacc -// -// 2014-12-02: Added support for the optional yyLexerEx interface. The Reduced -// method can be useful for debugging and/or automatically producing examples -// by parsing code fragments. If it returns true the parser exits immediately -// with return value -1. -// -// Overview -// -// The generated parser is reentrant and mostly backwards compatible with -// parsers generated by go tool yacc[0]. yyParse expects to be given an -// argument that conforms to the following interface: -// -// type yyLexer interface { -// Lex(lval *yySymType) int -// Errorf(format string, a ...interface{}) -// Errors() []error -// } -// -// Optionally the argument to yyParse may implement the following interface: -// -// type yyLexerEx interface { -// yyLexer -// // Hook for recording a reduction. -// Reduced(rule, state int, lval *yySymType) (stop bool) // Client should copy *lval. -// } -// -// Lex should return the token identifier, and place other token information in -// lval (which replaces the usual yylval). Error is equivalent to yyerror in -// the original yacc. -// -// Code inside the parser may refer to the variable yylex, which holds the -// yyLexer passed to Parse. -// -// Multiple grammars compiled into a single program should be placed in -// distinct packages. If that is impossible, the "-p prefix" flag to yacc sets -// the prefix, by default yy, that begins the names of symbols, including -// types, the parser, and the lexer, generated and referenced by yacc's -// generated code. Setting it to distinct values allows multiple grammars to be -// placed in a single package. -// -// Differences wrt go tool yacc -// -// - goyacc implements ideas from "Generating LR Syntax Error Messages from -// Examples"[1]. Use the -xe flag to pass a name of the example file. For more -// details about the example format please see [2]. -// -// - The grammar report includes example token sequences leading to the -// particular state. Can help understanding conflicts. -// -// - Minor changes in parser debug output. -// -// Links -// -// Referenced from elsewhere: -// -// [0]: http://golang.org/cmd/yacc/ -// [1]: http://people.via.ecp.fr/~stilgar/doc/compilo/parser/Generating%20LR%20Syntax%20Error%20Messages.pdf -// [2]: http://godoc.org/github.com/cznic/y#hdr-Error_Examples -// [3]: http://www.gnu.org/software/bison/manual/html_node/Precedence-Only.html#Precedence-Only -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "go/format" - "go/scanner" - "go/token" - "io" - "io/ioutil" - "log" - "os" - "runtime" - "sort" - "strings" - - "github.com/cznic/mathutil" - "github.com/cznic/parser/yacc" - "github.com/cznic/sortutil" - "github.com/cznic/strutil" - "github.com/cznic/y" -) - -var ( - //oNoDefault = flag.Bool("nodefault", false, "disable generating $default actions") - oClosures = flag.Bool("c", false, "report state closures") - oReducible = flag.Bool("cr", false, "check all states are reducible") - oDlval = flag.String("dlval", "lval", "debug value (runtime yyDebug >= 3)") - oDlvalf = flag.String("dlvalf", "%+v", "debug format of -dlval (runtime yyDebug >= 3)") - oLA = flag.Bool("la", false, "report all lookahead sets") - oNoLines = flag.Bool("l", false, "disable line directives (for compatibility ony - ignored)") - oOut = flag.String("o", "y.go", "parser output") - oPref = flag.String("p", "yy", "name prefix to use in generated code") - oReport = flag.String("v", "y.output", "create grammar report") - oResolved = flag.Bool("ex", false, "explain how were conflicts resolved") - oXErrors = flag.String("xe", "", "generate eXtra errors from examples source file") - oXErrorsGen = flag.String("xegen", "", "generate error from examples source file automatically from the grammar") -) - -func main() { - log.SetFlags(0) - - defer func() { - _, file, line, ok := runtime.Caller(2) - if e := recover(); e != nil { - switch { - case ok: - log.Fatalf("%s:%d: panic: %v", file, line, e) - default: - log.Fatalf("panic: %v", e) - } - } - }() - - flag.Parse() - var in string - switch flag.NArg() { - case 0: - in = os.Stdin.Name() - case 1: - in = flag.Arg(0) - default: - log.Fatal("expected at most one non flag argument") - } - - if err := main1(in); err != nil { - switch x := err.(type) { - case scanner.ErrorList: - for _, v := range x { - fmt.Fprintf(os.Stderr, "%v\n", v) - } - os.Exit(1) - default: - log.Fatal(err) - } - } -} - -type symUsed struct { - sym *y.Symbol - used int -} - -type symsUsed []symUsed - -func (s symsUsed) Len() int { return len(s) } -func (s symsUsed) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func (s symsUsed) Less(i, j int) bool { - if s[i].used > s[j].used { - return true - } - - if s[i].used < s[j].used { - return false - } - - return strings.ToLower(s[i].sym.Name) < strings.ToLower(s[j].sym.Name) -} - -func main1(in string) (err error) { - var out io.Writer - if nm := *oOut; nm != "" { - var f *os.File - var e error - if f, err = os.Create(nm); err != nil { - return err - } - - defer func() { - if e1 := f.Close(); e1 != nil && err == nil { - err = e1 - } - }() - w := bufio.NewWriter(f) - defer func() { - if e1 := w.Flush(); e1 != nil && err == nil { - err = e1 - } - }() - buf := bytes.NewBuffer(nil) - out = buf - defer func() { - var dest []byte - if dest, e = format.Source(buf.Bytes()); e != nil { - dest = buf.Bytes() - } - - if _, e = w.Write(dest); e != nil && err == nil { - err = e - } - }() - } - - var rep io.Writer - if nm := *oReport; nm != "" { - f, err1 := os.Create(nm) - if err1 != nil { - return err1 - } - - defer func() { - if e := f.Close(); e != nil && err == nil { - err = e - } - }() - w := bufio.NewWriter(f) - defer func() { - if e := w.Flush(); e != nil && err == nil { - err = e - } - }() - rep = w - } - - var xerrors []byte - if nm := *oXErrors; nm != "" { - b, err1 := ioutil.ReadFile(nm) - if err1 != nil { - return err1 - } - - xerrors = b - } - - p, err := y.ProcessFile(token.NewFileSet(), in, &y.Options{ - //NoDefault: *oNoDefault, - AllowConflicts: true, - Closures: *oClosures, - LA: *oLA, - Reducible: *oReducible, - Report: rep, - Resolved: *oResolved, - XErrorsName: *oXErrors, - XErrorsSrc: xerrors, - }) - if err != nil { - return err - } - - if fn := *oXErrorsGen; fn != "" { - f, err := os.OpenFile(fn, os.O_RDWR|os.O_CREATE, 0666) - if err != nil { - return err - } - - b := bufio.NewWriter(f) - if err := p.SkeletonXErrors(b); err != nil { - return err - } - - if err := b.Flush(); err != nil { - return err - } - - if err := f.Close(); err != nil { - return err - } - } - - msu := make(map[*y.Symbol]int, len(p.Syms)) // sym -> usage - for nm, sym := range p.Syms { - if nm == "" || nm == "ε" || nm == "$accept" || nm == "#" { - continue - } - - msu[sym] = 0 - } - var minArg, maxArg int - for _, state := range p.Table { - for _, act := range state { - msu[act.Sym]++ - k, arg := act.Kind() - if k == 'a' { - continue - } - - if k == 'r' { - arg = -arg - } - minArg, maxArg = mathutil.Min(minArg, arg), mathutil.Max(maxArg, arg) - } - } - su := make(symsUsed, 0, len(msu)) - for sym, used := range msu { - su = append(su, symUsed{sym, used}) - } - sort.Sort(su) - - // ----------------------------------------------------------- Prologue - f := strutil.IndentFormatter(out, "\t") - mustFormat(f, "// CAUTION: Generated file - DO NOT EDIT.\n\n") - mustFormat(f, "%s", injectImport(p.Prologue)) - mustFormat(f, ` -type %[1]sSymType %i%s%u - -type %[1]sXError struct { - state, xsym int -} -`, *oPref, p.UnionSrc) - - // ---------------------------------------------------------- Constants - nsyms := map[string]*y.Symbol{} - a := make([]string, 0, len(msu)) - maxTokName := 0 - for sym := range msu { - nm := sym.Name - if nm == "$default" || nm == "$end" || sym.IsTerminal && nm[0] != '\'' && sym.Value > 0 { - maxTokName = mathutil.Max(maxTokName, len(nm)) - a = append(a, nm) - } - nsyms[nm] = sym - } - sort.Strings(a) - mustFormat(f, "\nconst (%i\n") - for _, v := range a { - nm := v - switch nm { - case "error": - nm = *oPref + "ErrCode" - case "$default": - nm = *oPref + "Default" - case "$end": - nm = *oPref + "EOFCode" - } - mustFormat(f, "%s%s = %d\n", nm, strings.Repeat(" ", maxTokName-len(nm)+1), nsyms[v].Value) - } - minArg-- // eg: [-13, 42], minArg -14 maps -13 to 1 so zero cell values -> empty. - mustFormat(f, "\n%sMaxDepth = 200\n", *oPref) - mustFormat(f, "%sTabOfs = %d\n", *oPref, minArg) - mustFormat(f, "%u)") - - // ---------------------------------------------------------- Variables - mustFormat(f, "\n\nvar (%i\n") - - // Lex translation table - mustFormat(f, "%sXLAT = map[int]int{%i\n", *oPref) - xlat := make(map[int]int, len(su)) - var errSym int - for i, v := range su { - if v.sym.Name == "error" { - errSym = i - } - xlat[v.sym.Value] = i - mustFormat(f, "%6d: %3d, // %s (%dx)\n", v.sym.Value, i, v.sym.Name, msu[v.sym]) - } - mustFormat(f, "%u}\n") - - // Symbol names - mustFormat(f, "\n%sSymNames = []string{%i\n", *oPref) - for _, v := range su { - mustFormat(f, "%q,\n", v.sym.Name) - } - mustFormat(f, "%u}\n") - - // Reduction table - mustFormat(f, "\n%sReductions = []struct{xsym, components int}{%i\n", *oPref) - for _, rule := range p.Rules { - mustFormat(f, "{%d, %d},\n", xlat[rule.Sym.Value], len(rule.Components)) - } - mustFormat(f, "%u}\n") - - // XError table - mustFormat(f, "\n%[1]sXErrors = map[%[1]sXError]string{%i\n", *oPref) - for _, xerr := range p.XErrors { - state := xerr.Stack[len(xerr.Stack)-1] - xsym := -1 - if xerr.Lookahead != nil { - xsym = xlat[xerr.Lookahead.Value] - } - mustFormat(f, "%[1]sXError{%d, %d}: \"%s\",\n", *oPref, state, xsym, xerr.Msg) - } - mustFormat(f, "%u}\n\n") - - // Parse table - tbits := 32 - switch n := mathutil.BitLen(maxArg - minArg + 1); { - case n < 8: - tbits = 8 - case n < 16: - tbits = 16 - } - mustFormat(f, "%sParseTab = [%d][]uint%d{%i\n", *oPref, len(p.Table), tbits) - nCells := 0 - var tabRow sortutil.Uint64Slice - for si, state := range p.Table { - tabRow = tabRow[:0] - max := 0 - for _, act := range state { - sym := act.Sym - xsym, ok := xlat[sym.Value] - if !ok { - panic("internal error 001") - } - - max = mathutil.Max(max, xsym) - kind, arg := act.Kind() - switch kind { - case 'a': - arg = 0 - case 'r': - arg *= -1 - } - tabRow = append(tabRow, uint64(xsym)<<32|uint64(arg-minArg)) - } - nCells += max - tabRow.Sort() - col := -1 - if si%5 == 0 { - mustFormat(f, "// %d\n", si) - } - mustFormat(f, "{") - for i, v := range tabRow { - xsym := int(uint32(v >> 32)) - arg := int(uint32(v)) - if col+1 != xsym { - mustFormat(f, "%d: ", xsym) - } - switch { - case i == len(tabRow)-1: - mustFormat(f, "%d", arg) - default: - mustFormat(f, "%d, ", arg) - } - col = xsym - } - mustFormat(f, "},\n") - } - mustFormat(f, "%u}\n") - fmt.Fprintf(os.Stderr, "Parse table entries: %d of %d, x %d bits == %d bytes\n", nCells, len(p.Table)*len(msu), tbits, nCells*tbits/8) - if n := p.ConflictsSR; n != 0 { - fmt.Fprintf(os.Stderr, "conflicts: %d shift/reduce\n", n) - } - if n := p.ConflictsRR; n != 0 { - fmt.Fprintf(os.Stderr, "conflicts: %d reduce/reduce\n", n) - } - - mustFormat(f, `%u) - -var %[1]sDebug = 0 - -type %[1]sLexer interface { - Lex(lval *%[1]sSymType) int - Errorf(format string, a ...interface{}) - Errors() []error -} - -type %[1]sLexerEx interface { - %[1]sLexer - Reduced(rule, state int, lval *%[1]sSymType) bool -} - -func %[1]sSymName(c int) (s string) { - x, ok := %[1]sXLAT[c] - if ok { - return %[1]sSymNames[x] - } - - return __yyfmt__.Sprintf("%%d", c) -} - -func %[1]slex1(yylex %[1]sLexer, lval *%[1]sSymType) (n int) { - n = yylex.Lex(lval) - if n <= 0 { - n = %[1]sEOFCode - } - if %[1]sDebug >= 3 { - __yyfmt__.Printf("\nlex %%s(%%#x %%d), %[4]s: %[3]s\n", %[1]sSymName(n), n, n, %[4]s) - } - return n -} - -func %[1]sParse(yylex %[1]sLexer, parser *Parser) int { - const yyError = %[2]d - - yyEx, _ := yylex.(%[1]sLexerEx) - var yyn int - parser.yylval = %[1]sSymType{} - parser.yyVAL = %[1]sSymType{} - yyS := parser.cache - - Nerrs := 0 /* number of errors */ - Errflag := 0 /* error recovery flag */ - yyerrok := func() { - if %[1]sDebug >= 2 { - __yyfmt__.Printf("yyerrok()\n") - } - Errflag = 0 - } - _ = yyerrok - yystate := 0 - yychar := -1 - var yyxchar int - var yyshift int - yyp := -1 - goto yystack - -ret0: - return 0 - -ret1: - return 1 - -yystack: - /* put a state and value onto the stack */ - yyp++ - if yyp >= len(yyS) { - nyys := make([]%[1]sSymType, len(yyS)*2) - copy(nyys, yyS) - yyS = nyys - parser.cache = yyS - } - yyS[yyp] = parser.yyVAL - yyS[yyp].yys = yystate - -yynewstate: - if yychar < 0 { - yychar = %[1]slex1(yylex, &parser.yylval) - var ok bool - if yyxchar, ok = %[1]sXLAT[yychar]; !ok { - yyxchar = len(%[1]sSymNames) // > tab width - } - } - if %[1]sDebug >= 4 { - var a []int - for _, v := range yyS[:yyp+1] { - a = append(a, v.yys) - } - __yyfmt__.Printf("state stack %%v\n", a) - } - row := %[1]sParseTab[yystate] - yyn = 0 - if yyxchar < len(row) { - if yyn = int(row[yyxchar]); yyn != 0 { - yyn += %[1]sTabOfs - } - } - switch { - case yyn > 0: // shift - yychar = -1 - parser.yyVAL = parser.yylval - yystate = yyn - yyshift = yyn - if %[1]sDebug >= 2 { - __yyfmt__.Printf("shift, and goto state %%d\n", yystate) - } - if Errflag > 0 { - Errflag-- - } - goto yystack - case yyn < 0: // reduce - case yystate == 1: // accept - if %[1]sDebug >= 2 { - __yyfmt__.Println("accept") - } - goto ret0 - } - - if yyn == 0 { - /* error ... attempt to resume parsing */ - switch Errflag { - case 0: /* brand new error */ - if %[1]sDebug >= 1 { - __yyfmt__.Printf("no action for %%s in state %%d\n", %[1]sSymName(yychar), yystate) - } - msg, ok := %[1]sXErrors[%[1]sXError{yystate, yyxchar}] - if !ok { - msg, ok = %[1]sXErrors[%[1]sXError{yystate, -1}] - } - if !ok && yyshift != 0 { - msg, ok = %[1]sXErrors[%[1]sXError{yyshift, yyxchar}] - } - if !ok { - msg, ok = %[1]sXErrors[%[1]sXError{yyshift, -1}] - } - if !ok || msg == "" { - msg = "syntax error" - } - // ignore goyacc error message - yylex.Errorf("") - Nerrs++ - fallthrough - - case 1, 2: /* incompletely recovered error ... try again */ - Errflag = 3 - - /* find a state where "error" is a legal shift action */ - for yyp >= 0 { - row := %[1]sParseTab[yyS[yyp].yys] - if yyError < len(row) { - yyn = int(row[yyError])+%[1]sTabOfs - if yyn > 0 { // hit - if %[1]sDebug >= 2 { - __yyfmt__.Printf("error recovery found error shift in state %%d\n", yyS[yyp].yys) - } - yystate = yyn /* simulate a shift of "error" */ - goto yystack - } - } - - /* the current p has no shift on "error", pop stack */ - if %[1]sDebug >= 2 { - __yyfmt__.Printf("error recovery pops state %%d\n", yyS[yyp].yys) - } - yyp-- - } - /* there is no state on the stack with an error shift ... abort */ - if %[1]sDebug >= 2 { - __yyfmt__.Printf("error recovery failed\n") - } - goto ret1 - - case 3: /* no shift yet; clobber input char */ - if %[1]sDebug >= 2 { - __yyfmt__.Printf("error recovery discards %%s\n", %[1]sSymName(yychar)) - } - if yychar == %[1]sEOFCode { - goto ret1 - } - - yychar = -1 - goto yynewstate /* try again in the same state */ - } - } - - r := -yyn - x0 := %[1]sReductions[r] - x, n := x0.xsym, x0.components - yypt := yyp - _ = yypt // guard against "declared and not used" - - yyp -= n - if yyp+1 >= len(yyS) { - nyys := make([]%[1]sSymType, len(yyS)*2) - copy(nyys, yyS) - yyS = nyys - parser.cache = yyS - } - parser.yyVAL = yyS[yyp+1] - - /* consult goto table to find next state */ - exState := yystate - yystate = int(%[1]sParseTab[yyS[yyp].yys][x])+%[1]sTabOfs - /* reduction by production r */ - if %[1]sDebug >= 2 { - __yyfmt__.Printf("reduce using rule %%v (%%s), and goto state %%d\n", r, %[1]sSymNames[x], yystate) - } - - switch r {%i -`, - *oPref, errSym, *oDlvalf, *oDlval) - for r, rule := range p.Rules { - if rule.Action == nil { - continue - } - - action := rule.Action.Values - if len(action) == 0 { - continue - } - - if len(action) == 1 { - part := action[0] - if part.Type == parser.ActionValueGo { - src := part.Src - src = src[1 : len(src)-1] // Remove lead '{' and trail '}' - if strings.TrimSpace(src) == "" { - continue - } - } - } - - components := rule.Components - typ := rule.Sym.Type - max := len(components) - if p1 := rule.Parent; p1 != nil { - max = rule.MaxParentDlr - components = p1.Components - } - mustFormat(f, "case %d: ", r) - for _, part := range action { - num := part.Num - switch part.Type { - case parser.ActionValueGo: - mustFormat(f, "%s", part.Src) - case parser.ActionValueDlrDlr: - mustFormat(f, "parser.yyVAL.%s", typ) - if typ == "" { - panic("internal error 002") - } - case parser.ActionValueDlrNum: - typ := p.Syms[components[num-1]].Type - if typ == "" { - panic("internal error 003") - } - mustFormat(f, "yyS[yypt-%d].%s", max-num, typ) - case parser.ActionValueDlrTagDlr: - mustFormat(f, "parser.yyVAL.%s", part.Tag) - case parser.ActionValueDlrTagNum: - mustFormat(f, "yyS[yypt-%d].%s", max-num, part.Tag) - } - } - mustFormat(f, "\n") - } - mustFormat(f, `%u - } - - if yyEx != nil && yyEx.Reduced(r, exState, &parser.yyVAL) { - return -1 - } - goto yystack /* stack new state and value */ -} - -%[2]s -`, *oPref, p.Tail) - _ = oNoLines //TODO Ignored for now - return nil -} - -func injectImport(src string) string { - const inj = ` - -import __yyfmt__ "fmt" -` - fset := token.NewFileSet() - file := fset.AddFile("", -1, len(src)) - var s scanner.Scanner - s.Init( - file, - []byte(src), - nil, - scanner.ScanComments, - ) - for { - switch _, tok, _ := s.Scan(); tok { - case token.EOF: - return inj + src - case token.PACKAGE: - s.Scan() // ident - pos, _, _ := s.Scan() - ofs := file.Offset(pos) - return src[:ofs] + inj + src[ofs:] - } - } -} - -func mustFormat(f strutil.Formatter, format string, args ...interface{}) { - _, err := f.Format(format, args...) - if err != nil { - log.Fatalf("format error %v", err) - } -} diff --git a/perfschema/init.go b/perfschema/init.go index 270afe27f94fd..477d60e5aab48 100644 --- a/perfschema/init.go +++ b/perfschema/init.go @@ -14,12 +14,12 @@ package perfschema import ( + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" ) type columnInfo struct { diff --git a/perfschema/perfschema.go b/perfschema/perfschema.go index 2e5c1a8106694..8d017b9e37630 100644 --- a/perfschema/perfschema.go +++ b/perfschema/perfschema.go @@ -14,7 +14,7 @@ package perfschema import ( - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/table" ) diff --git a/perfschema/tables.go b/perfschema/tables.go index 8f89614152cf4..2d925ae2b1b2a 100644 --- a/perfschema/tables.go +++ b/perfschema/tables.go @@ -14,9 +14,9 @@ package perfschema import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/planner/core/cache.go b/planner/core/cache.go index b86eae67aecd7..b16a99992a6cf 100644 --- a/planner/core/cache.go +++ b/planner/core/cache.go @@ -17,7 +17,7 @@ import ( "sync/atomic" "time" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/hack" diff --git a/planner/core/cache_test.go b/planner/core/cache_test.go index 66af8cdd4c1f9..2d3ab7ea76010 100644 --- a/planner/core/cache_test.go +++ b/planner/core/cache_test.go @@ -16,7 +16,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/testleak" ) diff --git a/planner/core/cacheable_checker.go b/planner/core/cacheable_checker.go index 26b8f9d6ef4eb..2569bf89567a9 100644 --- a/planner/core/cacheable_checker.go +++ b/planner/core/cacheable_checker.go @@ -14,8 +14,9 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" + "github.com/pingcap/tidb/types/parser_driver" ) // Cacheable checks whether the input ast is cacheable. @@ -52,13 +53,13 @@ func (checker *cacheableChecker) Enter(in ast.Node) (out ast.Node, skipChildren } case *ast.Limit: if node.Count != nil { - if _, isParamMarker := node.Count.(*ast.ParamMarkerExpr); isParamMarker { + if _, isParamMarker := node.Count.(*driver.ParamMarkerExpr); isParamMarker { checker.cacheable = false return in, true } } if node.Offset != nil { - if _, isParamMarker := node.Offset.(*ast.ParamMarkerExpr); isParamMarker { + if _, isParamMarker := node.Offset.(*driver.ParamMarkerExpr); isParamMarker { checker.cacheable = false return in, true } diff --git a/planner/core/cacheable_checker_test.go b/planner/core/cacheable_checker_test.go index ebb4a7d7e44a9..9b6c1367e3042 100644 --- a/planner/core/cacheable_checker_test.go +++ b/planner/core/cacheable_checker_test.go @@ -15,9 +15,10 @@ package core import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" + "github.com/pingcap/tidb/types/parser_driver" ) var _ = Suite(&testCacheableSuite{}) @@ -66,7 +67,7 @@ func (s *testCacheableSuite) TestCacheable(c *C) { c.Assert(Cacheable(stmt), IsFalse) limitStmt := &ast.Limit{ - Count: &ast.ParamMarkerExpr{}, + Count: &driver.ParamMarkerExpr{}, } stmt = &ast.SelectStmt{ Limit: limitStmt, @@ -74,7 +75,7 @@ func (s *testCacheableSuite) TestCacheable(c *C) { c.Assert(Cacheable(stmt), IsFalse) limitStmt = &ast.Limit{ - Offset: &ast.ParamMarkerExpr{}, + Offset: &driver.ParamMarkerExpr{}, } stmt = &ast.SelectStmt{ Limit: limitStmt, diff --git a/planner/core/common_plans.go b/planner/core/common_plans.go index 7f750c67cb260..4a2386a502793 100644 --- a/planner/core/common_plans.go +++ b/planner/core/common_plans.go @@ -19,15 +19,16 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/util/auth" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/kvcache" "github.com/pingcap/tidb/util/ranger" @@ -162,7 +163,7 @@ func (e *Execute) optimizePreparedPlan(ctx sessionctx.Context, is infoschema.Inf if err != nil { return errors.Trace(err) } - prepared.Params[i].SetDatum(val) + prepared.Params[i].(*driver.ParamMarkerExpr).Datum = val vars.PreparedParams = append(vars.PreparedParams, val) } if prepared.SchemaVersion != is.SchemaMetaVersion() { diff --git a/planner/core/errors.go b/planner/core/errors.go index 2b4ce819c6cfc..55f01919ddf1f 100644 --- a/planner/core/errors.go +++ b/planner/core/errors.go @@ -14,8 +14,8 @@ package core import ( - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" ) const ( diff --git a/planner/core/exhaust_physical_plans.go b/planner/core/exhaust_physical_plans.go index 6a111bc5d63da..4ed1f03cefab7 100644 --- a/planner/core/exhaust_physical_plans.go +++ b/planner/core/exhaust_physical_plans.go @@ -16,13 +16,13 @@ package core import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/planner/property" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/ranger" "github.com/pkg/errors" diff --git a/planner/core/expression_rewriter.go b/planner/core/expression_rewriter.go index 4d5ceed793b33..104c9939396e7 100644 --- a/planner/core/expression_rewriter.go +++ b/planner/core/expression_rewriter.go @@ -17,16 +17,17 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tidb/util/chunk" "github.com/pkg/errors" ) @@ -36,7 +37,7 @@ var EvalSubquery func(p PhysicalPlan, is infoschema.InfoSchema, ctx sessionctx.C // evalAstExpr evaluates ast expression directly. func evalAstExpr(ctx sessionctx.Context, expr ast.ExprNode) (types.Datum, error) { - if val, ok := expr.(*ast.ValueExpr); ok { + if val, ok := expr.(*driver.ValueExpr); ok { return val.Datum, nil } b := &planBuilder{ @@ -748,10 +749,10 @@ func (er *expressionRewriter) Leave(originInNode ast.Node) (retNode ast.Node, ok switch v := inNode.(type) { case *ast.AggregateFuncExpr, *ast.ColumnNameExpr, *ast.ParenthesesExpr, *ast.WhenClause, *ast.SubqueryExpr, *ast.ExistsSubqueryExpr, *ast.CompareSubqueryExpr, *ast.ValuesExpr: - case *ast.ValueExpr: + case *driver.ValueExpr: value := &expression.Constant{Value: v.Datum, RetType: &v.Type} er.ctxStack = append(er.ctxStack, value) - case *ast.ParamMarkerExpr: + case *driver.ParamMarkerExpr: tp := types.NewFieldType(mysql.TypeUnspecified) types.DefaultParamTypeForValue(v.GetValue(), tp) value := &expression.Constant{Value: v.Datum, RetType: tp} @@ -815,7 +816,7 @@ func datumToConstant(d types.Datum, tp byte) *expression.Constant { return &expression.Constant{Value: d, RetType: types.NewFieldType(tp)} } -func (er *expressionRewriter) getParamExpression(v *ast.ParamMarkerExpr) expression.Expression { +func (er *expressionRewriter) getParamExpression(v *driver.ParamMarkerExpr) expression.Expression { f, err := expression.NewFunction(er.ctx, ast.GetParam, &v.Type, diff --git a/planner/core/expression_test.go b/planner/core/expression_test.go index 71584c1a65cf0..21bd952f0ed9d 100644 --- a/planner/core/expression_test.go +++ b/planner/core/expression_test.go @@ -17,12 +17,12 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/tidb/util/testutil" diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 50c0ae748e4bd..7cc9dc118d71e 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -16,10 +16,10 @@ package core import ( "math" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/planner/property" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index cc2d08a28d575..2b2fe33ae864a 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -22,21 +22,22 @@ import ( "unicode" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tidb/util/chunk" "github.com/pkg/errors" ) @@ -518,7 +519,7 @@ func (b *planBuilder) buildProjectionFieldNameFromExpressions(field *ast.SelectF } innerExpr := getInnerFromParentheses(field.Expr) - valueExpr, isValueExpr := innerExpr.(*ast.ValueExpr) + valueExpr, isValueExpr := innerExpr.(*driver.ValueExpr) // Non-literal: Output as inputed, except that comments need to be removed. if !isValueExpr { @@ -835,13 +836,13 @@ func getUintForLimitOffset(sc *stmtctx.StatementContext, val interface{}) (uint6 func extractLimitCountOffset(sc *stmtctx.StatementContext, limit *ast.Limit) (count uint64, offset uint64, err error) { if limit.Count != nil { - count, err = getUintForLimitOffset(sc, limit.Count.GetValue()) + count, err = getUintForLimitOffset(sc, limit.Count.(ast.ValueExpr).GetValue()) if err != nil { return 0, 0, ErrWrongArguments.GenWithStackByArgs("LIMIT") } } if limit.Offset != nil { - offset, err = getUintForLimitOffset(sc, limit.Offset.GetValue()) + offset, err = getUintForLimitOffset(sc, limit.Offset.(ast.ValueExpr).GetValue()) if err != nil { return 0, 0, ErrWrongArguments.GenWithStackByArgs("LIMIT") } @@ -954,7 +955,7 @@ func (a *havingAndOrderbyExprResolver) Enter(n ast.Node) (node ast.Node, skipChi switch n.(type) { case *ast.AggregateFuncExpr: a.inAggFunc = true - case *ast.ParamMarkerExpr, *ast.ColumnNameExpr, *ast.ColumnName: + case *driver.ParamMarkerExpr, *ast.ColumnNameExpr, *ast.ColumnName: case *ast.SubqueryExpr, *ast.ExistsSubqueryExpr: // Enter a new context, skip it. // For example: select sum(c) + c + exists(select c from t) from t; @@ -1136,7 +1137,7 @@ func (g *gbyResolver) Enter(inNode ast.Node) (ast.Node, bool) { switch inNode.(type) { case *ast.SubqueryExpr, *ast.CompareSubqueryExpr, *ast.ExistsSubqueryExpr: return inNode, true - case *ast.ValueExpr, *ast.ColumnNameExpr, *ast.ParenthesesExpr, *ast.ColumnName: + case *driver.ValueExpr, *ast.ColumnNameExpr, *ast.ParenthesesExpr, *ast.ColumnName: default: g.inExpr = true } diff --git a/planner/core/logical_plan_test.go b/planner/core/logical_plan_test.go index 88a8aedb41057..5c2dc2e13004c 100644 --- a/planner/core/logical_plan_test.go +++ b/planner/core/logical_plan_test.go @@ -19,15 +19,15 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/planner/core/logical_plans.go b/planner/core/logical_plans.go index a87ddede8aff0..201ce7bf124bf 100644 --- a/planner/core/logical_plans.go +++ b/planner/core/logical_plans.go @@ -16,11 +16,11 @@ package core import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" diff --git a/planner/core/logical_plans_test.go b/planner/core/logical_plans_test.go index 03e2524da74c4..acda1c36ffbf1 100644 --- a/planner/core/logical_plans_test.go +++ b/planner/core/logical_plans_test.go @@ -17,10 +17,10 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" diff --git a/planner/core/optimizer.go b/planner/core/optimizer.go index 7b2292b2a021f..727c34a329750 100644 --- a/planner/core/optimizer.go +++ b/planner/core/optimizer.go @@ -16,7 +16,7 @@ package core import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/planner/property" diff --git a/planner/core/physical_plan_test.go b/planner/core/physical_plan_test.go index 58e47867914c9..858a42f8346a9 100644 --- a/planner/core/physical_plan_test.go +++ b/planner/core/physical_plan_test.go @@ -15,10 +15,10 @@ package core_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" diff --git a/planner/core/physical_plans.go b/planner/core/physical_plans.go index 48ceea5f48001..4c66330fabdfe 100644 --- a/planner/core/physical_plans.go +++ b/planner/core/physical_plans.go @@ -14,10 +14,10 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/types" diff --git a/planner/core/plan.go b/planner/core/plan.go index 4ac105b0354b4..80831f63bdd81 100644 --- a/planner/core/plan.go +++ b/planner/core/plan.go @@ -17,7 +17,7 @@ import ( "fmt" "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/planner/property" "github.com/pingcap/tidb/sessionctx" diff --git a/planner/core/plan_to_pb.go b/planner/core/plan_to_pb.go index 1494052fcd591..258fd5b30bc46 100644 --- a/planner/core/plan_to_pb.go +++ b/planner/core/plan_to_pb.go @@ -14,9 +14,9 @@ package core import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" diff --git a/planner/core/plan_to_pb_test.go b/planner/core/plan_to_pb_test.go index e507be3295f14..fd1ff48291a70 100644 --- a/planner/core/plan_to_pb_test.go +++ b/planner/core/plan_to_pb_test.go @@ -15,9 +15,9 @@ package core import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/tipb/go-tipb" diff --git a/planner/core/planbuilder.go b/planner/core/planbuilder.go index 3601e4b712532..f49bd69471d40 100644 --- a/planner/core/planbuilder.go +++ b/planner/core/planbuilder.go @@ -18,16 +18,18 @@ import ( "strings" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/planner/property" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" + "github.com/pingcap/tidb/util/admin" "github.com/pingcap/tidb/util/ranger" "github.com/pkg/errors" ) @@ -237,8 +239,8 @@ func (b *planBuilder) buildSet(v *ast.SetStmt) (Plan, error) { } if vars.ExtendValue != nil { assign.ExtendValue = &expression.Constant{ - Value: vars.ExtendValue.Datum, - RetType: &vars.ExtendValue.Type, + Value: vars.ExtendValue.(*driver.ValueExpr).Datum, + RetType: &vars.ExtendValue.(*driver.ValueExpr).Type, } } p.VarAssigns = append(p.VarAssigns, assign) @@ -375,7 +377,8 @@ func (b *planBuilder) buildPrepare(x *ast.PrepareStmt) Plan { Name: x.Name, } if x.SQLVar != nil { - p.SQLText, _ = x.SQLVar.GetValue().(string) + // TODO: Prepared statement from variable expression do not work as expected. + // p.SQLText, _ = x.SQLVar.GetValue().(string) } else { p.SQLText = x.SQLText } @@ -552,7 +555,7 @@ func (b *planBuilder) buildAdminCheckTable(as *ast.AdminStmt) (*CheckTable, erro return nil, errors.Trace(err) } expr = expression.BuildCastFunction(b.ctx, expr, colExpr.GetType()) - genColumnName := model.GetTableColumnID(tableInfo, column.ColumnInfo) + genColumnName := admin.GetTableColumnID(tableInfo, column.ColumnInfo) p.GenExprs[genColumnName] = expr } } @@ -1234,7 +1237,7 @@ func (b *planBuilder) buildValuesListOfInsert(insert *ast.InsertStmt, insertPlan } else { expr, err = b.getDefaultValue(affectedValuesCols[j]) } - case *ast.ValueExpr: + case *driver.ValueExpr: expr = &expression.Constant{ Value: x.Datum, RetType: &x.Type, diff --git a/planner/core/planbuilder_test.go b/planner/core/planbuilder_test.go index 6d181b4558b57..037a6173f95f7 100644 --- a/planner/core/planbuilder_test.go +++ b/planner/core/planbuilder_test.go @@ -15,8 +15,8 @@ package core import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" ) var _ = Suite(&testPlanBuilderSuite{}) diff --git a/planner/core/point_get_plan.go b/planner/core/point_get_plan.go index 86f5968099ac1..74e976c9ea705 100644 --- a/planner/core/point_get_plan.go +++ b/planner/core/point_get_plan.go @@ -17,15 +17,16 @@ import ( "bytes" "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/planner/property" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" ) @@ -335,9 +336,9 @@ func getNameValuePairs(nvPairs []nameValuePair, expr ast.ExprNode) []nameValuePa } var d types.Datum switch x := binOp.R.(type) { - case *ast.ValueExpr: + case *driver.ValueExpr: d = x.Datum - case *ast.ParamMarkerExpr: + case *driver.ParamMarkerExpr: d = x.Datum } if d.IsNull() { diff --git a/planner/core/preprocess.go b/planner/core/preprocess.go index d0a17036e1e7f..b4ca94946604f 100644 --- a/planner/core/preprocess.go +++ b/planner/core/preprocess.go @@ -17,15 +17,16 @@ import ( "math" "strings" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" + "github.com/pingcap/tidb/types/parser_driver" "github.com/pkg/errors" ) @@ -95,7 +96,7 @@ func (p *preprocessor) Leave(in ast.Node) (out ast.Node, ok bool) { p.checkContainDotColumn(x) case *ast.DropTableStmt, *ast.AlterTableStmt, *ast.RenameTableStmt: p.inCreateOrDropTable = false - case *ast.ParamMarkerExpr: + case *driver.ParamMarkerExpr: if !p.inPrepare { p.err = parser.ErrSyntax.GenWithStack("syntax error, unexpected '?'") return @@ -134,14 +135,20 @@ func checkAutoIncrementOp(colDef *ast.ColumnDef, num int) (bool, error) { return hasAutoIncrement, nil } for _, op := range colDef.Options[num+1:] { - if op.Tp == ast.ColumnOptionDefaultValue && !op.Expr.GetDatum().IsNull() { - return hasAutoIncrement, errors.Errorf("Invalid default value for '%s'", colDef.Name.Name.O) + if op.Tp == ast.ColumnOptionDefaultValue { + if tmp, ok := op.Expr.(*driver.ValueExpr); ok { + if !tmp.Datum.IsNull() { + return hasAutoIncrement, errors.Errorf("Invalid default value for '%s'", colDef.Name.Name.O) + } + } } } } if colDef.Options[num].Tp == ast.ColumnOptionDefaultValue && len(colDef.Options) != num+1 { - if colDef.Options[num].Expr.GetDatum().IsNull() { - return hasAutoIncrement, nil + if tmp, ok := colDef.Options[num].Expr.(*driver.ValueExpr); ok { + if tmp.Datum.IsNull() { + return hasAutoIncrement, nil + } } for _, op := range colDef.Options[num+1:] { if op.Tp == ast.ColumnOptionAutoIncrement { diff --git a/planner/core/preprocess_test.go b/planner/core/preprocess_test.go index 17deb8a09d48b..fb6b1ae659990 100644 --- a/planner/core/preprocess_test.go +++ b/planner/core/preprocess_test.go @@ -15,14 +15,14 @@ package core_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" diff --git a/planner/core/rule_aggregation_push_down.go b/planner/core/rule_aggregation_push_down.go index 818f0a28d1685..5c3fe26b5a99f 100644 --- a/planner/core/rule_aggregation_push_down.go +++ b/planner/core/rule_aggregation_push_down.go @@ -15,11 +15,11 @@ package core import ( "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" ) diff --git a/planner/core/rule_build_key_info.go b/planner/core/rule_build_key_info.go index 161ed782d4aa8..92c2e67a99bf0 100644 --- a/planner/core/rule_build_key_info.go +++ b/planner/core/rule_build_key_info.go @@ -14,9 +14,9 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" ) type buildKeySolver struct{} diff --git a/planner/core/rule_column_pruning.go b/planner/core/rule_column_pruning.go index afa552019588e..d74132806d4e7 100644 --- a/planner/core/rule_column_pruning.go +++ b/planner/core/rule_column_pruning.go @@ -14,10 +14,10 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" log "github.com/sirupsen/logrus" ) diff --git a/planner/core/rule_decorrelate.go b/planner/core/rule_decorrelate.go index 4cb9661e68116..13f6400e42e7b 100644 --- a/planner/core/rule_decorrelate.go +++ b/planner/core/rule_decorrelate.go @@ -16,10 +16,10 @@ package core import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" "github.com/pkg/errors" ) diff --git a/planner/core/rule_join_reorder.go b/planner/core/rule_join_reorder.go index 70e39cbaa0494..c6e71192a3940 100644 --- a/planner/core/rule_join_reorder.go +++ b/planner/core/rule_join_reorder.go @@ -16,7 +16,7 @@ package core import ( "sort" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/sessionctx" log "github.com/sirupsen/logrus" diff --git a/planner/core/rule_max_min_eliminate.go b/planner/core/rule_max_min_eliminate.go index 46bc666b371f8..c53cbf091475a 100644 --- a/planner/core/rule_max_min_eliminate.go +++ b/planner/core/rule_max_min_eliminate.go @@ -13,9 +13,9 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" ) diff --git a/planner/core/rule_predicate_push_down.go b/planner/core/rule_predicate_push_down.go index a22bc51417837..8335f33e99d0a 100644 --- a/planner/core/rule_predicate_push_down.go +++ b/planner/core/rule_predicate_push_down.go @@ -13,10 +13,10 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" ) diff --git a/planner/core/task.go b/planner/core/task.go index a7c0e322e4381..17f2568c465cb 100644 --- a/planner/core/task.go +++ b/planner/core/task.go @@ -17,13 +17,13 @@ import ( "fmt" "math" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" ) // task is a new version of `PhysicalPlanInfo`. It stores cost information for a task. diff --git a/planner/core/trace.go b/planner/core/trace.go index 765ab9d7f0a02..ae879cf885e86 100644 --- a/planner/core/trace.go +++ b/planner/core/trace.go @@ -1,7 +1,7 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" ) // Trace represents a trace plan. diff --git a/planner/core/util.go b/planner/core/util.go index 2fe957687fd78..308344beff531 100644 --- a/planner/core/util.go +++ b/planner/core/util.go @@ -14,7 +14,7 @@ package core import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/expression" ) diff --git a/privilege/privilege.go b/privilege/privilege.go index 34c210086c671..b837940ceb86b 100644 --- a/privilege/privilege.go +++ b/privilege/privilege.go @@ -14,10 +14,10 @@ package privilege import ( - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" ) type keyType int diff --git a/privilege/privileges/cache.go b/privilege/privileges/cache.go index 08974a2374ec9..278df39dfb60b 100644 --- a/privilege/privileges/cache.go +++ b/privilege/privileges/cache.go @@ -20,10 +20,10 @@ import ( "sync/atomic" "time" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" diff --git a/privilege/privileges/cache_test.go b/privilege/privileges/cache_test.go index 723373e80ffa3..a66664c566d29 100644 --- a/privilege/privileges/cache_test.go +++ b/privilege/privileges/cache_test.go @@ -15,9 +15,9 @@ package privileges_test import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/privilege/privileges" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" diff --git a/privilege/privileges/privileges.go b/privilege/privileges/privileges.go index 2230a44d7be52..b2e29e851c8ad 100644 --- a/privilege/privileges/privileges.go +++ b/privilege/privileges/privileges.go @@ -16,12 +16,12 @@ package privileges import ( "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" log "github.com/sirupsen/logrus" ) diff --git a/privilege/privileges/privileges_test.go b/privilege/privileges/privileges_test.go index 359114f48570a..01334da8ba5ca 100644 --- a/privilege/privileges/privileges_test.go +++ b/privilege/privileges/privileges_test.go @@ -19,14 +19,14 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/tidb/util/testutil" "golang.org/x/net/context" diff --git a/server/column.go b/server/column.go index 27ca3c23d734e..850b02eb3097c 100644 --- a/server/column.go +++ b/server/column.go @@ -14,7 +14,7 @@ package server import ( - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" ) // ColumnInfo contains information of a column diff --git a/server/conn.go b/server/conn.go index d2b49011ae6b7..fd38018a354d6 100644 --- a/server/conn.go +++ b/server/conn.go @@ -49,15 +49,14 @@ import ( "time" "github.com/opentracing/opentracing-go" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/arena" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/hack" "github.com/pingcap/tidb/util/memory" @@ -392,17 +391,16 @@ func (cc *clientConn) openSessionAndDoAuth(authData []byte) error { if err != nil { return errors.Trace(err) } - host := variable.DefHostname - if !cc.server.isUnixSocket() { - addr := cc.bufReadConn.RemoteAddr().String() + if !cc.server.skipAuth() { // Do Auth. - host, _, err = net.SplitHostPort(addr) - if err != nil { + addr := cc.bufReadConn.RemoteAddr().String() + host, _, err1 := net.SplitHostPort(addr) + if err1 != nil { return errors.Trace(errAccessDenied.GenWithStackByArgs(cc.user, addr, "YES")) } - } - if !cc.ctx.Auth(&auth.UserIdentity{Username: cc.user, Hostname: host}, authData, cc.salt) { - return errors.Trace(errAccessDenied.GenWithStackByArgs(cc.user, host, "YES")) + if !cc.ctx.Auth(&auth.UserIdentity{Username: cc.user, Hostname: host}, authData, cc.salt) { + return errors.Trace(errAccessDenied.GenWithStackByArgs(cc.user, host, "YES")) + } } if cc.dbname != "" { err = cc.useDB(context.Background(), cc.dbname) diff --git a/server/conn_stmt.go b/server/conn_stmt.go index 2e62b7803548b..51b30bf7f6154 100644 --- a/server/conn_stmt.go +++ b/server/conn_stmt.go @@ -40,7 +40,7 @@ import ( "math" "strconv" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" diff --git a/server/conn_stmt_test.go b/server/conn_stmt_test.go index d131e39d6f22c..8aae1b6e0b08f 100644 --- a/server/conn_stmt_test.go +++ b/server/conn_stmt_test.go @@ -15,8 +15,8 @@ package server import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/types" ) diff --git a/server/conn_test.go b/server/conn_test.go index 037399dd7dd4a..8e56bad74c9e3 100644 --- a/server/conn_test.go +++ b/server/conn_test.go @@ -19,7 +19,7 @@ import ( "encoding/binary" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" ) type ConnTestSuite struct{} diff --git a/server/driver.go b/server/driver.go index ebc2d7278ccc0..df8bb2b00e36e 100644 --- a/server/driver.go +++ b/server/driver.go @@ -17,9 +17,9 @@ import ( "crypto/tls" "fmt" + "github.com/pingcap/parser/auth" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/util" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "golang.org/x/net/context" ) diff --git a/server/driver_tidb.go b/server/driver_tidb.go index 103556477765c..19d041833219e 100644 --- a/server/driver_tidb.go +++ b/server/driver_tidb.go @@ -17,16 +17,17 @@ import ( "crypto/tls" "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -331,7 +332,7 @@ func (tc *TiDBContext) GetSessionVars() *variable.SessionVars { } type tidbResultSet struct { - recordSet ast.RecordSet + recordSet sqlexec.RecordSet columns []*ColumnInfo rows []chunk.Row closed bool diff --git a/server/driver_tidb_test.go b/server/driver_tidb_test.go index 97e7b87b05040..b2dcab0a60b87 100644 --- a/server/driver_tidb_test.go +++ b/server/driver_tidb_test.go @@ -15,11 +15,11 @@ package server import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" ) type tidbResultSetTestSuite struct{} diff --git a/server/http_handler.go b/server/http_handler.go index 5fdebb28d1062..9802b9e84c839 100644 --- a/server/http_handler.go +++ b/server/http_handler.go @@ -30,12 +30,13 @@ import ( "github.com/gorilla/mux" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/binloginfo" @@ -45,7 +46,6 @@ import ( "github.com/pingcap/tidb/store/tikv/tikvrpc" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" diff --git a/server/http_handler_test.go b/server/http_handler_test.go index 0dc9b279a7100..a43a3b5ddad7a 100644 --- a/server/http_handler_test.go +++ b/server/http_handler_test.go @@ -30,12 +30,12 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/kvproto/pkg/kvrpcpb" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" diff --git a/server/http_status.go b/server/http_status.go index 1d9789b6dc423..7771e3e0cebcb 100644 --- a/server/http_status.go +++ b/server/http_status.go @@ -20,9 +20,9 @@ import ( "net/http/pprof" "github.com/gorilla/mux" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/printer" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" diff --git a/server/packetio.go b/server/packetio.go index ae16f5d143063..1e95b6a0e2e35 100644 --- a/server/packetio.go +++ b/server/packetio.go @@ -38,8 +38,8 @@ import ( "bufio" "io" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/server/server.go b/server/server.go index add925488b65b..51cc6930a6c9d 100644 --- a/server/server.go +++ b/server/server.go @@ -43,11 +43,11 @@ import ( "time" "github.com/blacktear23/go-proxyprotocol" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util" "github.com/pkg/errors" log "github.com/sirupsen/logrus" @@ -129,7 +129,7 @@ func (s *Server) newConn(conn net.Conn) *clientConn { return cc } -func (s *Server) isUnixSocket() bool { +func (s *Server) skipAuth() bool { return s.cfg.Socket != "" } diff --git a/server/server_test.go b/server/server_test.go index ace52e763d7cb..7ff59ae67008e 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -27,8 +27,8 @@ import ( "github.com/go-sql-driver/mysql" . "github.com/pingcap/check" + tmysql "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" - tmysql "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/printer" log "github.com/sirupsen/logrus" @@ -161,9 +161,6 @@ func (dbt *DBTest) mustQueryRows(query string, args ...interface{}) { func runTestRegression(c *C, overrider configOverrider, dbName string) { runTestsOnNewDB(c, overrider, dbName, func(dbt *DBTest) { - // Show the user - dbt.mustExec("select user()") - // Create Table dbt.mustExec("CREATE TABLE test (val TINYINT)") diff --git a/server/statistics_handler.go b/server/statistics_handler.go index 2dd1db833ed7b..40761114073f1 100644 --- a/server/statistics_handler.go +++ b/server/statistics_handler.go @@ -17,8 +17,8 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/domain" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" ) diff --git a/server/tidb_test.go b/server/tidb_test.go index af00149189542..a46e9eaf4ed50 100644 --- a/server/tidb_test.go +++ b/server/tidb_test.go @@ -28,11 +28,11 @@ import ( "github.com/go-sql-driver/mysql" . "github.com/pingcap/check" + tmysql "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - tmysql "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pkg/errors" diff --git a/server/util.go b/server/util.go index 463967b0aac19..f401b4b005504 100644 --- a/server/util.go +++ b/server/util.go @@ -42,7 +42,7 @@ import ( "strconv" "time" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/hack" diff --git a/server/util_test.go b/server/util_test.go index 46116cab842b1..fe70a73bfe98c 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -15,9 +15,9 @@ package server import ( . "github.com/pingcap/check" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/types" diff --git a/session/bench_test.go b/session/bench_test.go index f19dd711e257f..b68a1bdf76823 100644 --- a/session/bench_test.go +++ b/session/bench_test.go @@ -19,10 +19,10 @@ import ( "testing" "time" - "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/mockstore" + "github.com/pingcap/tidb/util/sqlexec" log "github.com/sirupsen/logrus" "golang.org/x/net/context" ) @@ -83,7 +83,7 @@ func prepareJoinBenchData(se Session, colType string, valueFormat string, valueC mustExecute(se, "commit") } -func readResult(ctx context.Context, rs ast.RecordSet, count int) { +func readResult(ctx context.Context, rs sqlexec.RecordSet, count int) { chk := rs.NewChunk() for count > 0 { err := rs.Next(ctx, chk) diff --git a/session/bootstrap.go b/session/bootstrap.go index 62986e734e58f..424779630306a 100644 --- a/session/bootstrap.go +++ b/session/bootstrap.go @@ -25,12 +25,12 @@ import ( "strings" "time" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/terror" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/timeutil" "github.com/pkg/errors" diff --git a/session/bootstrap_test.go b/session/bootstrap_test.go index 49787fa5df0ab..451292d768f37 100644 --- a/session/bootstrap_test.go +++ b/session/bootstrap_test.go @@ -17,14 +17,14 @@ import ( "fmt" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/auth" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/util/auth" + "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/util/testleak" "golang.org/x/net/context" ) @@ -55,7 +55,7 @@ func (s *testBootstrapSuite) TestBootstrap(c *C) { err := r.Next(ctx, chk) c.Assert(err, IsNil) c.Assert(chk.NumRows() == 0, IsFalse) - datums := ast.RowToDatums(chk.GetRow(0), r.Fields()) + datums := statistics.RowToDatums(chk.GetRow(0), r.Fields()) match(c, datums, []byte(`%`), []byte("root"), []byte(""), "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y") c.Assert(se.Auth(&auth.UserIdentity{Username: "root", Hostname: "anyhost"}, []byte(""), []byte("")), IsTrue) @@ -91,7 +91,7 @@ func (s *testBootstrapSuite) TestBootstrap(c *C) { chk = r.NewChunk() err = r.Next(ctx, chk) c.Assert(err, IsNil) - datums = ast.RowToDatums(chk.GetRow(0), r.Fields()) + datums = statistics.RowToDatums(chk.GetRow(0), r.Fields()) match(c, datums, 3) mustExecSQL(c, se, "drop table if exists t") se.Close() @@ -159,7 +159,7 @@ func (s *testBootstrapSuite) TestBootstrapWithError(c *C) { c.Assert(err, IsNil) c.Assert(chk.NumRows() == 0, IsFalse) row := chk.GetRow(0) - datums := ast.RowToDatums(row, r.Fields()) + datums := statistics.RowToDatums(row, r.Fields()) match(c, datums, []byte(`%`), []byte("root"), []byte(""), "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y") c.Assert(r.Close(), IsNil) diff --git a/session/session.go b/session/session.go index 79e5c4a67d949..01c0e9d9a2151 100644 --- a/session/session.go +++ b/session/session.go @@ -28,16 +28,19 @@ import ( "time" "github.com/ngaut/pools" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/owner" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/privilege" "github.com/pingcap/tidb/privilege/privileges" @@ -46,13 +49,11 @@ import ( "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" - "github.com/pingcap/tidb/util/auth" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/kvcache" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tidb/util/timeutil" "github.com/pingcap/tipb/go-binlog" "github.com/pkg/errors" @@ -63,17 +64,17 @@ import ( // Session context type Session interface { sessionctx.Context - Status() uint16 // Flag of current status, such as autocommit. - LastInsertID() uint64 // LastInsertID is the last inserted auto_increment ID. - AffectedRows() uint64 // Affected rows by latest executed stmt. - Execute(context.Context, string) ([]ast.RecordSet, error) // Execute a sql statement. - String() string // String is used to debug. + Status() uint16 // Flag of current status, such as autocommit. + LastInsertID() uint64 // LastInsertID is the last inserted auto_increment ID. + AffectedRows() uint64 // Affected rows by latest executed stmt. + Execute(context.Context, string) ([]sqlexec.RecordSet, error) // Execute a sql statement. + String() string // String is used to debug. CommitTxn(context.Context) error RollbackTxn(context.Context) error // PrepareStmt executes prepare statement in binary protocol. PrepareStmt(sql string) (stmtID uint32, paramCount int, fields []*ast.ResultField, err error) // ExecutePreparedStmt executes a prepared statement. - ExecutePreparedStmt(ctx context.Context, stmtID uint32, param ...interface{}) (ast.RecordSet, error) + ExecutePreparedStmt(ctx context.Context, stmtID uint32, param ...interface{}) (sqlexec.RecordSet, error) DropPreparedStmt(stmtID uint32) error SetClientCapability(uint32) // Set client capability flags. SetConnectionID(uint64) @@ -95,7 +96,7 @@ var ( type stmtRecord struct { stmtID uint32 - st ast.Statement + st sqlexec.Statement stmtCtx *stmtctx.StatementContext params []interface{} } @@ -106,7 +107,7 @@ type StmtHistory struct { } // Add appends a stmt to history list. -func (h *StmtHistory) Add(stmtID uint32, st ast.Statement, stmtCtx *stmtctx.StatementContext, params ...interface{}) { +func (h *StmtHistory) Add(stmtID uint32, st sqlexec.Statement, stmtCtx *stmtctx.StatementContext, params ...interface{}) { s := &stmtRecord{ stmtID: stmtID, st: st, @@ -622,7 +623,7 @@ func createSessionWithDomainFunc(store kv.Storage) func(*domain.Domain) (pools.R } } -func drainRecordSet(ctx context.Context, se *session, rs ast.RecordSet) ([]chunk.Row, error) { +func drainRecordSet(ctx context.Context, se *session, rs sqlexec.RecordSet) ([]chunk.Row, error) { var rows []chunk.Row chk := rs.NewChunk() for { @@ -740,7 +741,7 @@ func (s *session) SetProcessInfo(sql string) { s.processInfo.Store(pi) } -func (s *session) executeStatement(ctx context.Context, connID uint64, stmtNode ast.StmtNode, stmt ast.Statement, recordSets []ast.RecordSet) ([]ast.RecordSet, error) { +func (s *session) executeStatement(ctx context.Context, connID uint64, stmtNode ast.StmtNode, stmt sqlexec.Statement, recordSets []sqlexec.RecordSet) ([]sqlexec.RecordSet, error) { s.SetValue(sessionctx.QueryString, stmt.OriginText()) if _, ok := stmtNode.(ast.DDLNode); ok { s.SetValue(sessionctx.LastExecuteDDL, true) @@ -765,7 +766,7 @@ func (s *session) executeStatement(ctx context.Context, connID uint64, stmtNode return recordSets, nil } -func (s *session) Execute(ctx context.Context, sql string) (recordSets []ast.RecordSet, err error) { +func (s *session) Execute(ctx context.Context, sql string) (recordSets []sqlexec.RecordSet, err error) { if recordSets, err = s.execute(ctx, sql); err != nil { err = errors.Trace(err) s.sessionVars.StmtCtx.AppendError(err) @@ -773,7 +774,7 @@ func (s *session) Execute(ctx context.Context, sql string) (recordSets []ast.Rec return } -func (s *session) execute(ctx context.Context, sql string) (recordSets []ast.RecordSet, err error) { +func (s *session) execute(ctx context.Context, sql string) (recordSets []sqlexec.RecordSet, err error) { s.PrepareTxnCtx(ctx) connID := s.sessionVars.ConnectionID err = s.loadCommonGlobalVariablesIfNeeded() @@ -913,7 +914,7 @@ func checkArgs(args ...interface{}) error { } // ExecutePreparedStmt executes a prepared statement. -func (s *session) ExecutePreparedStmt(ctx context.Context, stmtID uint32, args ...interface{}) (ast.RecordSet, error) { +func (s *session) ExecutePreparedStmt(ctx context.Context, stmtID uint32, args ...interface{}) (sqlexec.RecordSet, error) { err := checkArgs(args...) if err != nil { return nil, errors.Trace(err) @@ -1023,13 +1024,10 @@ func (s *session) GetSessionVars() *variable.SessionVars { func (s *session) Auth(user *auth.UserIdentity, authentication []byte, salt []byte) bool { pm := privilege.GetPrivilegeManager(s) - // Check IP or localhost. + // Check IP. if pm.ConnectionVerification(user.Username, user.Hostname, authentication, salt) { s.sessionVars.User = user return true - } else if user.Hostname == variable.DefHostname { - log.Errorf("User connection verification failed %s", user) - return false } // Check Hostname. @@ -1049,7 +1047,7 @@ func (s *session) Auth(user *auth.UserIdentity, authentication []byte, salt []by func getHostByIP(ip string) []string { if ip == "127.0.0.1" { - return []string{variable.DefHostname} + return []string{"localhost"} } addrs, err := net.LookupAddr(ip) terror.Log(errors.Trace(err)) diff --git a/session/session_test.go b/session/session_test.go index 7be247bde8771..860c327dca0a8 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -20,13 +20,15 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/privilege/privileges" "github.com/pingcap/tidb/session" @@ -36,9 +38,7 @@ import ( "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/store/mockstore/mocktikv" "github.com/pingcap/tidb/table/tables" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" diff --git a/session/tidb.go b/session/tidb.go index 9a8472cf83c9a..c32e4701afedb 100644 --- a/session/tidb.go +++ b/session/tidb.go @@ -23,17 +23,18 @@ import ( "sync" "time" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" @@ -132,16 +133,16 @@ func Parse(ctx sessionctx.Context, src string) ([]ast.StmtNode, error) { } // Compile is safe for concurrent use by multiple goroutines. -func Compile(ctx context.Context, sctx sessionctx.Context, stmtNode ast.StmtNode) (ast.Statement, error) { +func Compile(ctx context.Context, sctx sessionctx.Context, stmtNode ast.StmtNode) (sqlexec.Statement, error) { compiler := executor.Compiler{Ctx: sctx} stmt, err := compiler.Compile(ctx, stmtNode) return stmt, errors.Trace(err) } -// runStmt executes the ast.Statement and commit or rollback the current transaction. -func runStmt(ctx context.Context, sctx sessionctx.Context, s ast.Statement) (ast.RecordSet, error) { +// runStmt executes the sqlexec.Statement and commit or rollback the current transaction. +func runStmt(ctx context.Context, sctx sessionctx.Context, s sqlexec.Statement) (sqlexec.RecordSet, error) { var err error - var rs ast.RecordSet + var rs sqlexec.RecordSet se := sctx.(*session) rs, err = s.Exec(ctx) // All the history should be added here. @@ -203,7 +204,7 @@ func GetHistory(ctx sessionctx.Context) *StmtHistory { } // GetRows4Test gets all the rows from a RecordSet, only used for test. -func GetRows4Test(ctx context.Context, sctx sessionctx.Context, rs ast.RecordSet) ([]chunk.Row, error) { +func GetRows4Test(ctx context.Context, sctx sessionctx.Context, rs sqlexec.RecordSet) ([]chunk.Row, error) { if rs == nil { return nil, nil } diff --git a/session/tidb_test.go b/session/tidb_test.go index 99eaa32723ef1..38b3f693f1e80 100644 --- a/session/tidb_test.go +++ b/session/tidb_test.go @@ -22,13 +22,13 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/auth" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/logutil" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" "golang.org/x/net/context" @@ -178,7 +178,7 @@ func removeStore(c *C, dbPath string) { os.RemoveAll(dbPath) } -func exec(se Session, sql string, args ...interface{}) (ast.RecordSet, error) { +func exec(se Session, sql string, args ...interface{}) (sqlexec.RecordSet, error) { ctx := context.Background() if len(args) == 0 { rs, err := se.Execute(ctx, sql) @@ -198,7 +198,7 @@ func exec(se Session, sql string, args ...interface{}) (ast.RecordSet, error) { return rs, nil } -func mustExecSQL(c *C, se Session, sql string, args ...interface{}) ast.RecordSet { +func mustExecSQL(c *C, se Session, sql string, args ...interface{}) sqlexec.RecordSet { rs, err := exec(se, sql, args...) c.Assert(err, IsNil) return rs diff --git a/sessionctx/binloginfo/binloginfo.go b/sessionctx/binloginfo/binloginfo.go index 235614cede25d..1a5c100695796 100644 --- a/sessionctx/binloginfo/binloginfo.go +++ b/sessionctx/binloginfo/binloginfo.go @@ -21,12 +21,12 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb-tools/tidb-binlog/node" pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" binlog "github.com/pingcap/tipb/go-binlog" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/sessionctx/binloginfo/binloginfo_test.go b/sessionctx/binloginfo/binloginfo_test.go index a6f1e9cc1f9cf..5a8b93a724028 100644 --- a/sessionctx/binloginfo/binloginfo_test.go +++ b/sessionctx/binloginfo/binloginfo_test.go @@ -22,6 +22,7 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client" "github.com/pingcap/tidb/ddl" "github.com/pingcap/tidb/domain" @@ -30,7 +31,6 @@ import ( "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/binloginfo" "github.com/pingcap/tidb/store/mockstore" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/logutil" diff --git a/sessionctx/stmtctx/stmtctx.go b/sessionctx/stmtctx/stmtctx.go index e59d2da7194cb..66db63081c5b8 100644 --- a/sessionctx/stmtctx/stmtctx.go +++ b/sessionctx/stmtctx/stmtctx.go @@ -18,7 +18,7 @@ import ( "sync" "time" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/util/execdetails" "github.com/pingcap/tidb/util/memory" ) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 385c7f1643418..198d8921b9739 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -21,16 +21,16 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/auth" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client" - "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/auth" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/timeutil" diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index cc7a383e06d0c..4e46cd2a84777 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -17,11 +17,11 @@ import ( "strconv" "strings" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/logutil" ) diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go index 85d9b7f44bc6f..50a2cae5f5bfc 100644 --- a/sessionctx/variable/tidb_vars.go +++ b/sessionctx/variable/tidb_vars.go @@ -16,7 +16,7 @@ package variable import ( "os" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" ) /* @@ -204,7 +204,6 @@ const ( // Default TiDB system variable values. const ( - DefHostname = "localhost" DefIndexLookupConcurrency = 4 DefIndexLookupJoinConcurrency = 4 DefIndexSerialScanConcurrency = 1 diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go index 215e82a5b142d..8c4a5eaa08176 100644 --- a/sessionctx/variable/varsutil.go +++ b/sessionctx/variable/varsutil.go @@ -22,8 +22,8 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/timeutil" "github.com/pkg/errors" diff --git a/sessionctx/variable/varsutil_test.go b/sessionctx/variable/varsutil_test.go index 0b9e71d661a3d..013b46c44e4b1 100644 --- a/sessionctx/variable/varsutil_test.go +++ b/sessionctx/variable/varsutil_test.go @@ -19,9 +19,9 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testleak" ) diff --git a/statistics/bootstrap.go b/statistics/bootstrap.go index c4322a03acc56..66104e88fbe41 100644 --- a/statistics/bootstrap.go +++ b/statistics/bootstrap.go @@ -16,11 +16,11 @@ package statistics import ( "fmt" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/sqlexec" diff --git a/statistics/ddl.go b/statistics/ddl.go index acabf0fd71907..3abfc0b48896e 100644 --- a/statistics/ddl.go +++ b/statistics/ddl.go @@ -16,11 +16,10 @@ package statistics import ( "fmt" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/ddl/util" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" @@ -97,7 +96,7 @@ func (h *Handle) insertColStats2KV(tableID int64, colInfo *model.ColumnInfo) (er // If we didn't update anything by last SQL, it means the stats of this table does not exist. if h.mu.ctx.GetSessionVars().StmtCtx.AffectedRows() > 0 { // By this step we can get the count of this table, then we can sure the count and repeats of bucket. - var rs []ast.RecordSet + var rs []sqlexec.RecordSet rs, err = exec.Execute(ctx, fmt.Sprintf("select count from mysql.stats_meta where table_id = %d", tableID)) if len(rs) > 0 { defer terror.Call(rs[0].Close) diff --git a/statistics/ddl_test.go b/statistics/ddl_test.go index b5906e7224c18..8cda510bd55d1 100644 --- a/statistics/ddl_test.go +++ b/statistics/ddl_test.go @@ -15,7 +15,7 @@ package statistics_test import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/model" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/testkit" diff --git a/statistics/dump.go b/statistics/dump.go index 7e1fedd83b93d..505635dc2d2b6 100644 --- a/statistics/dump.go +++ b/statistics/dump.go @@ -16,9 +16,9 @@ package statistics import ( "time" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tipb/go-tipb" diff --git a/statistics/dump_test.go b/statistics/dump_test.go index 5564c688bdd82..c3824d38b88f3 100644 --- a/statistics/dump_test.go +++ b/statistics/dump_test.go @@ -17,9 +17,9 @@ import ( "fmt" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" diff --git a/statistics/feedback.go b/statistics/feedback.go index 81eccc6787e88..29023d56b4d12 100644 --- a/statistics/feedback.go +++ b/statistics/feedback.go @@ -23,9 +23,9 @@ import ( "time" "github.com/cznic/mathutil" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/types" diff --git a/statistics/feedback_test.go b/statistics/feedback_test.go index f5b83b44ee663..08058c386bef2 100644 --- a/statistics/feedback_test.go +++ b/statistics/feedback_test.go @@ -15,7 +15,7 @@ package statistics import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" ) diff --git a/statistics/handle.go b/statistics/handle.go index 3b0160343d569..d019cafa52083 100644 --- a/statistics/handle.go +++ b/statistics/handle.go @@ -19,9 +19,9 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/infoschema" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/table" diff --git a/statistics/handle_test.go b/statistics/handle_test.go index eb46e0758f023..31b890bcfcc13 100644 --- a/statistics/handle_test.go +++ b/statistics/handle_test.go @@ -18,9 +18,9 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/statistics" diff --git a/statistics/histogram.go b/statistics/histogram.go index f0c304d4da365..3c00b0531c057 100644 --- a/statistics/histogram.go +++ b/statistics/histogram.go @@ -20,12 +20,12 @@ import ( "strings" "time" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" diff --git a/statistics/sample.go b/statistics/sample.go index 6b58fb5916c38..70eed697a812a 100644 --- a/statistics/sample.go +++ b/statistics/sample.go @@ -17,12 +17,13 @@ import ( "fmt" "math/rand" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tipb/go-tipb" "github.com/pkg/errors" "golang.org/x/net/context" @@ -132,7 +133,7 @@ func (c *SampleCollector) collect(sc *stmtctx.StatementContext, d types.Datum) e // Also, if primary key is handle, it will directly build histogram for it. type SampleBuilder struct { Sc *stmtctx.StatementContext - RecordSet ast.RecordSet + RecordSet sqlexec.RecordSet ColLen int // ColLen is the number of columns need to be sampled. PkBuilder *SortedBuilder MaxBucketSize int64 @@ -175,7 +176,7 @@ func (s SampleBuilder) CollectColumnStats() ([]*SampleCollector, *SortedBuilder, panic(fmt.Sprintf("%T", s.RecordSet)) } for row := it.Begin(); row != it.End(); row = it.Next() { - datums := ast.RowToDatums(row, s.RecordSet.Fields()) + datums := RowToDatums(row, s.RecordSet.Fields()) if s.PkBuilder != nil { err = s.PkBuilder.Iterate(datums[0]) if err != nil { @@ -192,3 +193,12 @@ func (s SampleBuilder) CollectColumnStats() ([]*SampleCollector, *SortedBuilder, } } } + +// RowToDatums converts row to datum slice. +func RowToDatums(row chunk.Row, fields []*ast.ResultField) []types.Datum { + datums := make([]types.Datum, len(fields)) + for i, f := range fields { + datums[i] = row.GetDatum(i, &f.Column.FieldType) + } + return datums +} diff --git a/statistics/sample_test.go b/statistics/sample_test.go index dc3cc3e222303..dfc7b59df597b 100644 --- a/statistics/sample_test.go +++ b/statistics/sample_test.go @@ -17,18 +17,18 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" + "github.com/pingcap/tidb/util/sqlexec" ) var _ = Suite(&testSampleSuite{}) type testSampleSuite struct { count int - rs ast.RecordSet + rs sqlexec.RecordSet } func (s *testSampleSuite) SetUpSuite(c *C) { diff --git a/statistics/scalar.go b/statistics/scalar.go index 1ea756a6e6d0c..446a78a7383f6 100644 --- a/statistics/scalar.go +++ b/statistics/scalar.go @@ -17,7 +17,7 @@ import ( "encoding/binary" "math" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" ) diff --git a/statistics/scalar_test.go b/statistics/scalar_test.go index 31da575d12c12..47015fab2825e 100644 --- a/statistics/scalar_test.go +++ b/statistics/scalar_test.go @@ -17,7 +17,7 @@ import ( "math" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" ) diff --git a/statistics/selectivity.go b/statistics/selectivity.go index f7e87a4913308..e8764bba9c7d4 100644 --- a/statistics/selectivity.go +++ b/statistics/selectivity.go @@ -16,9 +16,9 @@ package statistics import ( "math" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/ranger" "github.com/pkg/errors" diff --git a/statistics/selectivity_test.go b/statistics/selectivity_test.go index 128f87ec55c92..ed98c6520f8c2 100644 --- a/statistics/selectivity_test.go +++ b/statistics/selectivity_test.go @@ -22,10 +22,10 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" diff --git a/statistics/statistics_test.go b/statistics/statistics_test.go index d719edad22df9..fb79e934c18be 100644 --- a/statistics/statistics_test.go +++ b/statistics/statistics_test.go @@ -19,9 +19,9 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" @@ -30,6 +30,7 @@ import ( "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/ranger" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -43,8 +44,8 @@ var _ = Suite(&testStatisticsSuite{}) type testStatisticsSuite struct { count int samples []types.Datum - rc ast.RecordSet - pk ast.RecordSet + rc sqlexec.RecordSet + pk sqlexec.RecordSet } type recordSet struct { @@ -169,7 +170,7 @@ func encodeKey(key types.Datum) types.Datum { return types.NewBytesDatum(buf) } -func buildPK(sctx sessionctx.Context, numBuckets, id int64, records ast.RecordSet) (int64, *Histogram, error) { +func buildPK(sctx sessionctx.Context, numBuckets, id int64, records sqlexec.RecordSet) (int64, *Histogram, error) { b := NewSortedBuilder(sctx.GetSessionVars().StmtCtx, numBuckets, id, types.NewFieldType(mysql.TypeLonglong)) ctx := context.Background() for { @@ -183,7 +184,7 @@ func buildPK(sctx sessionctx.Context, numBuckets, id int64, records ast.RecordSe } it := chunk.NewIterator4Chunk(chk) for row := it.Begin(); row != it.End(); row = it.Next() { - datums := ast.RowToDatums(row, records.Fields()) + datums := RowToDatums(row, records.Fields()) err = b.Iterate(datums[0]) if err != nil { return 0, nil, errors.Trace(err) @@ -193,7 +194,7 @@ func buildPK(sctx sessionctx.Context, numBuckets, id int64, records ast.RecordSe return b.Count, b.hist, nil } -func buildIndex(sctx sessionctx.Context, numBuckets, id int64, records ast.RecordSet) (int64, *Histogram, *CMSketch, error) { +func buildIndex(sctx sessionctx.Context, numBuckets, id int64, records sqlexec.RecordSet) (int64, *Histogram, *CMSketch, error) { b := NewSortedBuilder(sctx.GetSessionVars().StmtCtx, numBuckets, id, types.NewFieldType(mysql.TypeBlob)) cms := NewCMSketch(8, 2048) ctx := context.Background() @@ -208,7 +209,7 @@ func buildIndex(sctx sessionctx.Context, numBuckets, id int64, records ast.Recor break } for row := it.Begin(); row != it.End(); row = it.Next() { - datums := ast.RowToDatums(row, records.Fields()) + datums := RowToDatums(row, records.Fields()) buf, err := codec.EncodeKey(sctx.GetSessionVars().StmtCtx, nil, datums...) if err != nil { return 0, nil, nil, errors.Trace(err) @@ -282,7 +283,7 @@ func (s *testStatisticsSuite) TestBuild(c *C) { checkRepeats(c, col) c.Assert(col.Len(), Equals, 250) - tblCount, col, _, err := buildIndex(ctx, bucketCount, 1, ast.RecordSet(s.rc)) + tblCount, col, _, err := buildIndex(ctx, bucketCount, 1, sqlexec.RecordSet(s.rc)) c.Check(err, IsNil) checkRepeats(c, col) col.PreCalculateScalar() @@ -299,7 +300,7 @@ func (s *testStatisticsSuite) TestBuild(c *C) { c.Check(int(count), Equals, 0) s.pk.(*recordSet).cursor = 0 - tblCount, col, err = buildPK(ctx, bucketCount, 4, ast.RecordSet(s.pk)) + tblCount, col, err = buildPK(ctx, bucketCount, 4, sqlexec.RecordSet(s.pk)) c.Check(err, IsNil) checkRepeats(c, col) col.PreCalculateScalar() @@ -338,7 +339,7 @@ func (s *testStatisticsSuite) TestBuild(c *C) { func (s *testStatisticsSuite) TestHistogramProtoConversion(c *C) { ctx := mock.NewContext() s.rc.Close() - tblCount, col, _, err := buildIndex(ctx, 256, 1, ast.RecordSet(s.rc)) + tblCount, col, _, err := buildIndex(ctx, 256, 1, sqlexec.RecordSet(s.rc)) c.Check(err, IsNil) c.Check(int(tblCount), Equals, 100000) diff --git a/statistics/table.go b/statistics/table.go index 65c84a06499c6..275ad7f37f374 100644 --- a/statistics/table.go +++ b/statistics/table.go @@ -19,9 +19,9 @@ import ( "strings" "sync" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" diff --git a/statistics/update.go b/statistics/update.go index dc0bebd5a48d3..6e30bc3e2eb9f 100644 --- a/statistics/update.go +++ b/statistics/update.go @@ -21,9 +21,9 @@ import ( "sync" "time" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/util/chunk" diff --git a/statistics/update_test.go b/statistics/update_test.go index 710be1cb946c4..8a176f581fec2 100644 --- a/statistics/update_test.go +++ b/statistics/update_test.go @@ -19,10 +19,10 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/statistics" diff --git a/store/mockstore/mocktikv/analyze.go b/store/mockstore/mocktikv/analyze.go index bbda6c3020b00..2659a4cde994e 100644 --- a/store/mockstore/mocktikv/analyze.go +++ b/store/mockstore/mocktikv/analyze.go @@ -16,13 +16,13 @@ package mocktikv import ( "github.com/golang/protobuf/proto" "github.com/pingcap/kvproto/pkg/coprocessor" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/codec" "github.com/pingcap/tipb/go-tipb" @@ -188,7 +188,7 @@ func (h *rpcHandler) handleAnalyzeColumnsReq(req *coprocessor.Request, analyzeRe return &coprocessor.Response{Data: data}, nil } -// Fields implements the ast.RecordSet Fields interface. +// Fields implements the sqlexec.RecordSet Fields interface. func (e *analyzeColumnsExec) Fields() []*ast.ResultField { return e.fields } @@ -232,7 +232,7 @@ func (e *analyzeColumnsExec) NewChunk() *chunk.Chunk { return chunk.NewChunkWithCapacity(fields, 1) } -// Close implements the ast.RecordSet Close interface. +// Close implements the sqlexec.RecordSet Close interface. func (e *analyzeColumnsExec) Close() error { return nil } diff --git a/store/mockstore/mocktikv/cop_handler_dag.go b/store/mockstore/mocktikv/cop_handler_dag.go index 0d874793e121b..913f839c6d9e0 100644 --- a/store/mockstore/mocktikv/cop_handler_dag.go +++ b/store/mockstore/mocktikv/cop_handler_dag.go @@ -23,14 +23,14 @@ import ( "github.com/pingcap/kvproto/pkg/errorpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/tikvpb" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" mockpkg "github.com/pingcap/tidb/util/mock" diff --git a/store/mockstore/mocktikv/executor.go b/store/mockstore/mocktikv/executor.go index b3d78396fdf3e..29f478b8e277f 100644 --- a/store/mockstore/mocktikv/executor.go +++ b/store/mockstore/mocktikv/executor.go @@ -19,10 +19,10 @@ import ( "sort" "github.com/pingcap/kvproto/pkg/kvrpcpb" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/types" diff --git a/store/mockstore/mocktikv/mvcc_leveldb.go b/store/mockstore/mocktikv/mvcc_leveldb.go index 34abd116a3449..53cdb92c5a5d9 100644 --- a/store/mockstore/mocktikv/mvcc_leveldb.go +++ b/store/mockstore/mocktikv/mvcc_leveldb.go @@ -24,7 +24,7 @@ import ( "github.com/pingcap/goleveldb/leveldb/storage" "github.com/pingcap/goleveldb/leveldb/util" "github.com/pingcap/kvproto/pkg/kvrpcpb" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/store/mockstore/mocktikv/rpc.go b/store/mockstore/mocktikv/rpc.go index 8a51bce389ccb..380974cbed0fe 100644 --- a/store/mockstore/mocktikv/rpc.go +++ b/store/mockstore/mocktikv/rpc.go @@ -24,9 +24,9 @@ import ( "github.com/pingcap/kvproto/pkg/errorpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/tikv/tikvrpc" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" "golang.org/x/net/context" ) diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go index 345ae5de2996c..2c1655e2add88 100644 --- a/store/tikv/2pc.go +++ b/store/tikv/2pc.go @@ -21,12 +21,12 @@ import ( "time" pb "github.com/pingcap/kvproto/pkg/kvrpcpb" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/sessionctx/binloginfo" "github.com/pingcap/tidb/store/tikv/tikvrpc" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" binlog "github.com/pingcap/tipb/go-binlog" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/store/tikv/2pc_fail_test.go b/store/tikv/2pc_fail_test.go index 5fe4b2b0d8b4e..edb015a7d86f6 100644 --- a/store/tikv/2pc_fail_test.go +++ b/store/tikv/2pc_fail_test.go @@ -16,8 +16,8 @@ package tikv import ( gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" "golang.org/x/net/context" ) diff --git a/store/tikv/backoff.go b/store/tikv/backoff.go index 3fe5ae9b954c6..b52aeb552a044 100644 --- a/store/tikv/backoff.go +++ b/store/tikv/backoff.go @@ -20,10 +20,10 @@ import ( "strings" "time" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/store/tikv/client.go b/store/tikv/client.go index b1e95abc3b1e6..1633a01cde8ee 100644 --- a/store/tikv/client.go +++ b/store/tikv/client.go @@ -26,10 +26,10 @@ import ( "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/pingcap/kvproto/pkg/coprocessor" "github.com/pingcap/kvproto/pkg/tikvpb" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/metrics" "github.com/pingcap/tidb/store/tikv/tikvrpc" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "golang.org/x/net/context" diff --git a/store/tikv/error.go b/store/tikv/error.go index 9c78022c5fcae..9329de2eaf221 100644 --- a/store/tikv/error.go +++ b/store/tikv/error.go @@ -14,8 +14,8 @@ package tikv import ( - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/store/tikv/gcworker/gc_worker.go b/store/tikv/gcworker/gc_worker.go index bf15962e867e3..c0bd0557175da 100644 --- a/store/tikv/gcworker/gc_worker.go +++ b/store/tikv/gcworker/gc_worker.go @@ -25,6 +25,7 @@ import ( "github.com/pingcap/kvproto/pkg/errorpb" "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/kvproto/pkg/metapb" + "github.com/pingcap/parser/terror" "github.com/pingcap/pd/client" "github.com/pingcap/tidb/ddl/util" "github.com/pingcap/tidb/kv" @@ -35,7 +36,6 @@ import ( "github.com/pingcap/tidb/store/tikv" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/store/tikv/tikvrpc" - "github.com/pingcap/tidb/terror" tidbutil "github.com/pingcap/tidb/util" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/store/tikv/isolation_test.go b/store/tikv/isolation_test.go index eeb5aa80e185d..e95028269a135 100644 --- a/store/tikv/isolation_test.go +++ b/store/tikv/isolation_test.go @@ -22,8 +22,8 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/terror" "golang.org/x/net/context" ) diff --git a/store/tikv/safepoint_test.go b/store/tikv/safepoint_test.go index 76e3449d9a95f..975f099bfaece 100644 --- a/store/tikv/safepoint_test.go +++ b/store/tikv/safepoint_test.go @@ -18,8 +18,8 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" "golang.org/x/net/context" ) diff --git a/store/tikv/sql_fail_test.go b/store/tikv/sql_fail_test.go index 4fb976c557198..30bbc95c25ff7 100644 --- a/store/tikv/sql_fail_test.go +++ b/store/tikv/sql_fail_test.go @@ -20,10 +20,10 @@ import ( gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/session" . "github.com/pingcap/tidb/store/tikv" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testkit" "golang.org/x/net/context" diff --git a/store/tikv/tikv_test.go b/store/tikv/tikv_test.go index 2f759076cb6ab..a19a7d941075f 100644 --- a/store/tikv/tikv_test.go +++ b/store/tikv/tikv_test.go @@ -21,7 +21,7 @@ import ( "strings" . "github.com/pingcap/check" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" ) // OneByOneSuite is a suite, When with-tikv flag is true, there is only one storage, so the test suite have to run one by one. diff --git a/structure/structure.go b/structure/structure.go index 81853deeeafed..4f7eb0e50ec7d 100644 --- a/structure/structure.go +++ b/structure/structure.go @@ -14,8 +14,8 @@ package structure import ( + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/terror" ) // structure error codes. diff --git a/table/column.go b/table/column.go index 8e6bb6925a13d..d2b57b66e1727 100644 --- a/table/column.go +++ b/table/column.go @@ -21,15 +21,15 @@ import ( "strings" "unicode/utf8" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/table/column_test.go b/table/column_test.go index 4bf3bc104c0c3..3d34a1436892f 100644 --- a/table/column_test.go +++ b/table/column_test.go @@ -17,11 +17,11 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" ) diff --git a/table/index.go b/table/index.go index 8957025549dcd..1b7d247c6ed13 100644 --- a/table/index.go +++ b/table/index.go @@ -14,8 +14,8 @@ package table import ( + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" diff --git a/table/table.go b/table/table.go index ac99df34f397e..021bb6740ad4d 100644 --- a/table/table.go +++ b/table/table.go @@ -18,12 +18,12 @@ package table import ( + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" ) diff --git a/table/tables/gen_expr.go b/table/tables/gen_expr.go index fa94ca009c74d..f0f88e2924cc7 100644 --- a/table/tables/gen_expr.go +++ b/table/tables/gen_expr.go @@ -16,9 +16,9 @@ package tables import ( "fmt" - "github.com/pingcap/tidb/ast" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/parser" + "github.com/pingcap/parser" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pkg/errors" ) diff --git a/table/tables/gen_expr_test.go b/table/tables/gen_expr_test.go index 89de193f5cd42..9723e32e63841 100644 --- a/table/tables/gen_expr_test.go +++ b/table/tables/gen_expr_test.go @@ -15,7 +15,7 @@ package tables import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" ) var _ = Suite(&testGenExprSuite{}) diff --git a/table/tables/index.go b/table/tables/index.go index f4580d0e93978..f34330a83de5c 100644 --- a/table/tables/index.go +++ b/table/tables/index.go @@ -19,14 +19,14 @@ import ( "io" "unicode/utf8" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" ) diff --git a/table/tables/index_test.go b/table/tables/index_test.go index 5e8350e8dd46c..1abe161696f6f 100644 --- a/table/tables/index_test.go +++ b/table/tables/index_test.go @@ -18,14 +18,14 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/table/tables" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" diff --git a/table/tables/partition.go b/table/tables/partition.go index 762c4e7976e7f..efcaf596d7b62 100644 --- a/table/tables/partition.go +++ b/table/tables/partition.go @@ -19,9 +19,9 @@ import ( "sort" "strings" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/tablecodec" diff --git a/table/tables/tables.go b/table/tables/tables.go index ff411bc98e14f..483a9701cdea5 100644 --- a/table/tables/tables.go +++ b/table/tables/tables.go @@ -24,10 +24,10 @@ import ( "strings" "time" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/owner" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" diff --git a/table/tables/tables_test.go b/table/tables/tables_test.go index 0446a2d5c00d4..54e9919f6409a 100644 --- a/table/tables/tables_test.go +++ b/table/tables/tables_test.go @@ -17,9 +17,9 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/binloginfo" diff --git a/tablecodec/tablecodec.go b/tablecodec/tablecodec.go index ec07f38b0f05e..3f31f5613a9c3 100644 --- a/tablecodec/tablecodec.go +++ b/tablecodec/tablecodec.go @@ -19,10 +19,10 @@ import ( "math" "time" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" diff --git a/tablecodec/tablecodec_test.go b/tablecodec/tablecodec_test.go index 0c048e26e69c7..96605ee6abd01 100644 --- a/tablecodec/tablecodec_test.go +++ b/tablecodec/tablecodec_test.go @@ -21,8 +21,8 @@ import ( gofail "github.com/etcd-io/gofail/runtime" . "github.com/pingcap/check" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" diff --git a/terror/terror.go b/terror/terror.go index 3cc1c2d17105c..c38e0e18a1b24 100644 --- a/terror/terror.go +++ b/terror/terror.go @@ -18,7 +18,7 @@ import ( "fmt" "strconv" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/tidb-server/main.go b/tidb-server/main.go index f65ae2e7fa085..41058eedd8381 100644 --- a/tidb-server/main.go +++ b/tidb-server/main.go @@ -23,6 +23,8 @@ import ( "time" "github.com/opentracing/opentracing-go" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/pd/client" pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client" "github.com/pingcap/tidb/config" @@ -30,7 +32,6 @@ import ( "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/metrics" - "github.com/pingcap/tidb/mysql" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/privilege/privileges" "github.com/pingcap/tidb/server" @@ -41,7 +42,6 @@ import ( "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/store/tikv" "github.com/pingcap/tidb/store/tikv/gcworker" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/printer" "github.com/pingcap/tidb/util/signal" diff --git a/types/compare_test.go b/types/compare_test.go index 8bdd621b61ff3..cf51757fc637c 100644 --- a/types/compare_test.go +++ b/types/compare_test.go @@ -17,7 +17,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/util/testleak" ) diff --git a/types/convert.go b/types/convert.go index 08ec314b927bf..1ee25fe72f23d 100644 --- a/types/convert.go +++ b/types/convert.go @@ -22,9 +22,9 @@ import ( "strconv" "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" diff --git a/types/convert_test.go b/types/convert_test.go index c9103e92c17cb..96e48387db6fd 100644 --- a/types/convert_test.go +++ b/types/convert_test.go @@ -20,11 +20,11 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/testleak" "github.com/pkg/errors" ) @@ -464,7 +464,7 @@ func (s *testTypeConvertSuite) TestStrToNum(c *C) { func (s *testTypeConvertSuite) TestFieldTypeToStr(c *C) { defer testleak.AfterTest(c)() v := TypeToStr(mysql.TypeUnspecified, "not binary") - c.Assert(v, Equals, type2Str[mysql.TypeUnspecified]) + c.Assert(v, Equals, TypeStr(mysql.TypeUnspecified)) v = TypeToStr(mysql.TypeBlob, charset.CharsetBin) c.Assert(v, Equals, "blob") v = TypeToStr(mysql.TypeString, charset.CharsetBin) diff --git a/types/datum.go b/types/datum.go index bf0f03878deff..3665537800a4b 100644 --- a/types/datum.go +++ b/types/datum.go @@ -22,11 +22,11 @@ import ( "time" "unicode/utf8" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" log "github.com/sirupsen/logrus" diff --git a/types/datum_eval.go b/types/datum_eval.go index af8a7f993402b..9cbdaa4fa84fa 100644 --- a/types/datum_eval.go +++ b/types/datum_eval.go @@ -15,7 +15,7 @@ package types import ( "github.com/cznic/mathutil" - "github.com/pingcap/tidb/parser/opcode" + "github.com/pingcap/parser/opcode" "github.com/pkg/errors" ) diff --git a/types/datum_test.go b/types/datum_test.go index fc925ee7ecc5b..1d2eb562f5b73 100644 --- a/types/datum_test.go +++ b/types/datum_test.go @@ -19,7 +19,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types/json" ) diff --git a/types/errors.go b/types/errors.go index 52558ea5f18d6..9e1919b45d97e 100644 --- a/types/errors.go +++ b/types/errors.go @@ -14,8 +14,9 @@ package types import ( - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" + parser_types "github.com/pingcap/parser/types" ) var ( @@ -45,12 +46,12 @@ var ( ErrWrongFieldSpec = terror.ClassTypes.New(codeWrongFieldSpec, "Wrong Field Spec") // ErrBadNumber is return when parsing an invalid binary decimal number. ErrBadNumber = terror.ClassTypes.New(codeBadNumber, "Bad Number") + // ErrInvalidDefault is returned when meet a invalid default value. + ErrInvalidDefault = parser_types.ErrInvalidDefault // ErrCastAsSignedOverflow is returned when positive out-of-range integer, and convert to it's negative complement. ErrCastAsSignedOverflow = terror.ClassTypes.New(codeUnknown, msgCastAsSignedOverflow) // ErrCastNegIntAsUnsigned is returned when a negative integer be casted to an unsigned int. ErrCastNegIntAsUnsigned = terror.ClassTypes.New(codeUnknown, msgCastNegIntAsUnsigned) - // ErrInvalidDefault is returned when meet a invalid default value. - ErrInvalidDefault = terror.ClassTypes.New(codeInvalidDefault, "Invalid default value for '%s'") // ErrMBiggerThanD is returned when precision less than the scale. ErrMBiggerThanD = terror.ClassTypes.New(codeMBiggerThanD, mysql.MySQLErrName[mysql.ErrMBiggerThanD]) // ErrWarnDataOutOfRange is returned when the value in a numeric column that is outside the permissible range of the column data type. diff --git a/types/etc.go b/types/etc.go index 4f1bf1115d74e..626139a7d328a 100644 --- a/types/etc.go +++ b/types/etc.go @@ -19,30 +19,21 @@ package types import ( "io" - "strings" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/parser/opcode" - "github.com/pingcap/tidb/terror" - "github.com/pingcap/tidb/util/charset" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" + "github.com/pingcap/parser/terror" + ast "github.com/pingcap/parser/types" "github.com/pkg/errors" ) // IsTypeBlob returns a boolean indicating whether the tp is a blob type. -func IsTypeBlob(tp byte) bool { - switch tp { - case mysql.TypeTinyBlob, mysql.TypeMediumBlob, mysql.TypeBlob, mysql.TypeLongBlob: - return true - default: - return false - } -} +var IsTypeBlob = ast.IsTypeBlob // IsTypeChar returns a boolean indicating // whether the tp is the char type like a string type or a varchar type. -func IsTypeChar(tp byte) bool { - return tp == mysql.TypeString || tp == mysql.TypeVarchar -} +var IsTypeChar = ast.IsTypeChar // IsTypeVarchar returns a boolean indicating // whether the tp is the varchar type like a varstring type or a varchar type. @@ -113,36 +104,6 @@ func IsString(tp byte) bool { return IsTypeChar(tp) || IsTypeBlob(tp) || IsTypeVarchar(tp) || IsTypeUnspecified(tp) } -var type2Str = map[byte]string{ - mysql.TypeBit: "bit", - mysql.TypeBlob: "text", - mysql.TypeDate: "date", - mysql.TypeDatetime: "datetime", - mysql.TypeDecimal: "unspecified", - mysql.TypeNewDecimal: "decimal", - mysql.TypeDouble: "double", - mysql.TypeEnum: "enum", - mysql.TypeFloat: "float", - mysql.TypeGeometry: "geometry", - mysql.TypeInt24: "mediumint", - mysql.TypeJSON: "json", - mysql.TypeLong: "int", - mysql.TypeLonglong: "bigint", - mysql.TypeLongBlob: "longtext", - mysql.TypeMediumBlob: "mediumtext", - mysql.TypeNull: "null", - mysql.TypeSet: "set", - mysql.TypeShort: "smallint", - mysql.TypeString: "char", - mysql.TypeDuration: "time", - mysql.TypeTimestamp: "timestamp", - mysql.TypeTiny: "tinyint", - mysql.TypeTinyBlob: "tinytext", - mysql.TypeVarchar: "varchar", - mysql.TypeVarString: "var_string", - mysql.TypeYear: "year", -} - var kind2Str = map[byte]string{ KindNull: "null", KindInt64: "bigint", @@ -166,9 +127,7 @@ var kind2Str = map[byte]string{ } // TypeStr converts tp to a string. -func TypeStr(tp byte) (r string) { - return type2Str[tp] -} +var TypeStr = ast.TypeStr // KindStr converts kind to a string. func KindStr(kind byte) (r string) { @@ -181,18 +140,7 @@ func KindStr(kind byte) (r string) { // Args: // tp: type enum // cs: charset -func TypeToStr(tp byte, cs string) (r string) { - ts := type2Str[tp] - if cs != charset.CharsetBin { - return ts - } - if IsTypeBlob(tp) { - ts = strings.Replace(ts, "text", "blob", 1) - } else if IsTypeChar(tp) { - ts = strings.Replace(ts, "char", "binary", 1) - } - return ts -} +var TypeToStr = ast.TypeToStr // EOFAsNil filtrates errors, // If err is equal to io.EOF returns nil. diff --git a/types/etc_test.go b/types/etc_test.go index 60d272bff2866..32de5aa88ee20 100644 --- a/types/etc_test.go +++ b/types/etc_test.go @@ -18,8 +18,8 @@ import ( "testing" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/util/testleak" ) diff --git a/types/eval_type.go b/types/eval_type.go index 47775953d97c5..3eb17cae856f9 100644 --- a/types/eval_type.go +++ b/types/eval_type.go @@ -13,30 +13,26 @@ package types +import ast "github.com/pingcap/parser/types" + // EvalType indicates the specified types that arguments and result of a built-in function should be. -type EvalType byte +type EvalType = ast.EvalType const ( // ETInt represents type INT in evaluation. - ETInt EvalType = iota + ETInt = ast.ETInt // ETReal represents type REAL in evaluation. - ETReal + ETReal = ast.ETReal // ETDecimal represents type DECIMAL in evaluation. - ETDecimal + ETDecimal = ast.ETDecimal // ETString represents type STRING in evaluation. - ETString + ETString = ast.ETString // ETDatetime represents type DATETIME in evaluation. - ETDatetime + ETDatetime = ast.ETDatetime // ETTimestamp represents type TIMESTAMP in evaluation. - ETTimestamp + ETTimestamp = ast.ETTimestamp // ETDuration represents type DURATION in evaluation. - ETDuration + ETDuration = ast.ETDuration // ETJson represents type JSON in evaluation. - ETJson + ETJson = ast.ETJson ) - -// IsStringKind returns true for ETString, ETDatetime, ETTimestamp, ETDuration, ETJson EvalTypes. -func (et EvalType) IsStringKind() bool { - return et == ETString || et == ETDatetime || - et == ETTimestamp || et == ETDuration || et == ETJson -} diff --git a/types/field_type.go b/types/field_type.go index bb247ba8e7e20..9da5c8044a0fd 100644 --- a/types/field_type.go +++ b/types/field_type.go @@ -14,15 +14,12 @@ package types import ( - "fmt" - "io" "strconv" - "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" + ast "github.com/pingcap/parser/types" "github.com/pingcap/tidb/types/json" - "github.com/pingcap/tidb/util/charset" - "github.com/pingcap/tidb/util/format" ) // UnspecifiedLength is unspecified length. @@ -31,16 +28,7 @@ const ( ) // FieldType records field type information. -type FieldType struct { - Tp byte - Flag uint - Flen int - Decimal int - Charset string - Collate string - // Elems is the element list for enum and set type. - Elems []string -} +type FieldType = ast.FieldType // NewFieldType returns a FieldType, // with a type and other information about field type. @@ -52,27 +40,6 @@ func NewFieldType(tp byte) *FieldType { } } -// Equal checks whether two FieldType objects are equal. -func (ft *FieldType) Equal(other *FieldType) bool { - // We do not need to compare whole `ft.Flag == other.Flag` when wrapping cast upon an Expression. - // but need compare unsigned_flag of ft.Flag. - partialEqual := ft.Tp == other.Tp && - ft.Flen == other.Flen && - ft.Decimal == other.Decimal && - ft.Charset == other.Charset && - ft.Collate == other.Collate && - mysql.HasUnsignedFlag(ft.Flag) == mysql.HasUnsignedFlag(other.Flag) - if !partialEqual || len(ft.Elems) != len(other.Elems) { - return false - } - for i := range ft.Elems { - if ft.Elems[i] != other.Elems[i] { - return false - } - } - return true -} - // AggFieldType aggregates field types for a multi-argument function like `IF`, `IFNULL`, `COALESCE` // whose return type is determined by the arguments' FieldTypes. // Aggregation is performed by MergeFieldType function. @@ -152,172 +119,6 @@ func setTypeFlag(flag *uint, flagItem uint, on bool) { } } -// EvalType gets the type in evaluation. -func (ft *FieldType) EvalType() EvalType { - switch ft.Tp { - case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong, - mysql.TypeBit, mysql.TypeYear: - return ETInt - case mysql.TypeFloat, mysql.TypeDouble: - return ETReal - case mysql.TypeNewDecimal: - return ETDecimal - case mysql.TypeDate, mysql.TypeDatetime: - return ETDatetime - case mysql.TypeTimestamp: - return ETTimestamp - case mysql.TypeDuration: - return ETDuration - case mysql.TypeJSON: - return ETJson - } - return ETString -} - -// Hybrid checks whether a type is a hybrid type, which can represent different types of value in specific context. -func (ft *FieldType) Hybrid() bool { - return ft.Tp == mysql.TypeEnum || ft.Tp == mysql.TypeBit || ft.Tp == mysql.TypeSet -} - -// Init initializes the FieldType data. -func (ft *FieldType) Init(tp byte) { - ft.Tp = tp - ft.Flen = UnspecifiedLength - ft.Decimal = UnspecifiedLength -} - -// CompactStr only considers Tp/CharsetBin/Flen/Deimal. -// This is used for showing column type in infoschema. -func (ft *FieldType) CompactStr() string { - ts := TypeToStr(ft.Tp, ft.Charset) - suffix := "" - - defaultFlen, defaultDecimal := mysql.GetDefaultFieldLengthAndDecimal(ft.Tp) - isDecimalNotDefault := ft.Decimal != defaultDecimal && ft.Decimal != 0 && ft.Decimal != UnspecifiedLength - - // displayFlen and displayDecimal are flen and decimal values with `-1` substituted with default value. - displayFlen, displayDecimal := ft.Flen, ft.Decimal - if displayFlen == 0 || displayFlen == UnspecifiedLength { - displayFlen = defaultFlen - } - if displayDecimal == 0 || displayDecimal == UnspecifiedLength { - displayDecimal = defaultDecimal - } - - switch ft.Tp { - case mysql.TypeEnum, mysql.TypeSet: - // Format is ENUM ('e1', 'e2') or SET ('e1', 'e2') - es := make([]string, 0, len(ft.Elems)) - for _, e := range ft.Elems { - e = format.OutputFormat(e) - es = append(es, e) - } - suffix = fmt.Sprintf("('%s')", strings.Join(es, "','")) - case mysql.TypeTimestamp, mysql.TypeDatetime, mysql.TypeDuration: - if isDecimalNotDefault { - suffix = fmt.Sprintf("(%d)", displayDecimal) - } - case mysql.TypeDouble, mysql.TypeFloat: - // 1. Flen Not Default, Decimal Not Default -> Valid - // 2. Flen Not Default, Decimal Default (-1) -> Invalid - // 3. Flen Default, Decimal Not Default -> Valid - // 4. Flen Default, Decimal Default -> Valid (hide) - if isDecimalNotDefault { - suffix = fmt.Sprintf("(%d,%d)", displayFlen, displayDecimal) - } - case mysql.TypeNewDecimal: - suffix = fmt.Sprintf("(%d,%d)", displayFlen, displayDecimal) - case mysql.TypeBit, mysql.TypeShort, mysql.TypeTiny, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong, mysql.TypeVarchar, mysql.TypeString, mysql.TypeVarString: - // Flen is always shown. - suffix = fmt.Sprintf("(%d)", displayFlen) - } - return ts + suffix -} - -// InfoSchemaStr joins the CompactStr with unsigned flag and -// returns a string. -func (ft *FieldType) InfoSchemaStr() string { - suffix := "" - if mysql.HasUnsignedFlag(ft.Flag) { - suffix = " unsigned" - } - return ft.CompactStr() + suffix -} - -// String joins the information of FieldType and returns a string. -// Note: when flen or decimal is unspecified, this function will use the default value instead of -1. -func (ft *FieldType) String() string { - strs := []string{ft.CompactStr()} - if mysql.HasUnsignedFlag(ft.Flag) { - strs = append(strs, "UNSIGNED") - } - if mysql.HasZerofillFlag(ft.Flag) { - strs = append(strs, "ZEROFILL") - } - if mysql.HasBinaryFlag(ft.Flag) && ft.Tp != mysql.TypeString { - strs = append(strs, "BINARY") - } - - if IsTypeChar(ft.Tp) || IsTypeBlob(ft.Tp) { - if ft.Charset != "" && ft.Charset != charset.CharsetBin { - strs = append(strs, fmt.Sprintf("CHARACTER SET %s", ft.Charset)) - } - if ft.Collate != "" && ft.Collate != charset.CharsetBin { - strs = append(strs, fmt.Sprintf("COLLATE %s", ft.Collate)) - } - } - - return strings.Join(strs, " ") -} - -// FormatAsCastType is used for write AST back to string. -func (ft *FieldType) FormatAsCastType(w io.Writer) { - switch ft.Tp { - case mysql.TypeVarString: - if ft.Charset == charset.CharsetBin && ft.Collate == charset.CollationBin { - fmt.Fprint(w, "BINARY") - } else { - fmt.Fprint(w, "CHAR") - } - if ft.Flen != UnspecifiedLength { - fmt.Fprintf(w, "(%d)", ft.Flen) - } - if ft.Flag&mysql.BinaryFlag != 0 { - fmt.Fprint(w, " BINARY") - } - if ft.Charset != charset.CharsetBin && ft.Charset != charset.CharsetUTF8 { - fmt.Fprintf(w, " %s", ft.Charset) - } - case mysql.TypeDate: - fmt.Fprint(w, "DATE") - case mysql.TypeDatetime: - fmt.Fprint(w, "DATETIME") - if ft.Decimal > 0 { - fmt.Fprintf(w, "(%d)", ft.Decimal) - } - case mysql.TypeNewDecimal: - fmt.Fprint(w, "DECIMAL") - if ft.Flen > 0 && ft.Decimal > 0 { - fmt.Fprintf(w, "(%d, %d)", ft.Flen, ft.Decimal) - } else if ft.Flen > 0 { - fmt.Fprintf(w, "(%d)", ft.Flen) - } - case mysql.TypeDuration: - fmt.Fprint(w, "TIME") - if ft.Decimal > 0 { - fmt.Fprintf(w, "(%d)", ft.Decimal) - } - case mysql.TypeLonglong: - if ft.Flag&mysql.UnsignedFlag != 0 { - fmt.Fprint(w, "UNSIGNED") - } else { - fmt.Fprint(w, "SIGNED") - } - case mysql.TypeJSON: - fmt.Fprint(w, "JSON") - } -} - // DefaultParamTypeForValue returns the default FieldType for the parameterized value. func DefaultParamTypeForValue(value interface{}, tp *FieldType) { switch value.(type) { @@ -1416,21 +1217,4 @@ func SetBinChsClnFlag(ft *FieldType) { } // VarStorageLen indicates this column is a variable length column. -const VarStorageLen = -1 - -// StorageLength is the length of stored value for the type. -func (ft *FieldType) StorageLength() int { - switch ft.Tp { - case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, - mysql.TypeLonglong, mysql.TypeDouble, mysql.TypeFloat, mysql.TypeYear, mysql.TypeDuration, - mysql.TypeDate, mysql.TypeDatetime, mysql.TypeTimestamp, mysql.TypeEnum, mysql.TypeSet, - mysql.TypeBit: - // This may not be the accurate length, because we may encode them as varint. - return 8 - case mysql.TypeNewDecimal: - precision, frac := ft.Flen-ft.Decimal, ft.Decimal - return precision/digitsPerWord*wordSize + dig2bytes[precision%digitsPerWord] + frac/digitsPerWord*wordSize + dig2bytes[frac%digitsPerWord] - default: - return VarStorageLen - } -} +const VarStorageLen = ast.VarStorageLen diff --git a/types/field_type_test.go b/types/field_type_test.go index 71a6ea2983f55..f1d0292270223 100644 --- a/types/field_type_test.go +++ b/types/field_type_test.go @@ -15,8 +15,8 @@ package types import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/util/charset" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/util/testleak" ) diff --git a/types/format_test.go b/types/format_test.go index fb9b199c1f61b..16fbf6a963971 100644 --- a/types/format_test.go +++ b/types/format_test.go @@ -15,7 +15,7 @@ package types_test import ( . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" ) diff --git a/types/json/binary.go b/types/json/binary.go index 0d0cd022d0dbb..a4b61511d1c2e 100644 --- a/types/json/binary.go +++ b/types/json/binary.go @@ -25,7 +25,7 @@ import ( "strings" "unicode/utf8" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/util/hack" "github.com/pkg/errors" ) diff --git a/types/json/constants.go b/types/json/constants.go index f5bc92daf336c..03c9a5aa7a5a2 100644 --- a/types/json/constants.go +++ b/types/json/constants.go @@ -17,8 +17,8 @@ import ( "encoding/binary" "unicode/utf8" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" ) // TypeCode indicates JSON type. diff --git a/types/mydecimal.go b/types/mydecimal.go index 97d037b80455b..dec19cfee333d 100644 --- a/types/mydecimal.go +++ b/types/mydecimal.go @@ -17,8 +17,8 @@ import ( "math" "strconv" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/types/parser_driver/value_expr.go b/types/parser_driver/value_expr.go new file mode 100644 index 0000000000000..09a8a8a1fb430 --- /dev/null +++ b/types/parser_driver/value_expr.go @@ -0,0 +1,177 @@ +// Copyright 2018 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package driver + +import ( + "fmt" + "io" + "strconv" + + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/util/hack" +) + +// The purpose of driver package is to decompose the dependency of the parser and +// types package. +// It provides the NewValueExpr function for the ast package, so the ast package +// do not depends on the concrete definition of `types.Datum`, thus get rid of +// the dependency of the types package. +// The parser package depends on the ast package, but not the types package. +// The whole relationship: +// ast imports [] +// tidb/types imports [parser/types] +// parser imports [ast, parser/types] +// driver imports [ast, tidb/types] +// tidb imports [parser, driver] + +func init() { + ast.NewValueExpr = newValueExpr + ast.NewParamMarkerExpr = newParamMarkerExpr + ast.NewDecimal = func(str string) (interface{}, error) { + dec := new(types.MyDecimal) + err := dec.FromString(hack.Slice(str)) + return dec, err + } + ast.NewHexLiteral = func(str string) (interface{}, error) { + h, err := types.NewHexLiteral(str) + return h, err + } + ast.NewBitLiteral = func(str string) (interface{}, error) { + b, err := types.NewBitLiteral(str) + return b, err + } +} + +var ( + _ ast.ParamMarkerExpr = &ParamMarkerExpr{} + _ ast.ValueExpr = &ValueExpr{} +) + +// ValueExpr is the simple value expression. +type ValueExpr struct { + ast.TexprNode + types.Datum + projectionOffset int +} + +// GetDatumString implements the ast.ValueExpr interface. +func (n *ValueExpr) GetDatumString() string { + return n.GetString() +} + +// Format the ExprNode into a Writer. +func (n *ValueExpr) Format(w io.Writer) { + var s string + switch n.Kind() { + case types.KindNull: + s = "NULL" + case types.KindInt64: + if n.Type.Flag&mysql.IsBooleanFlag != 0 { + if n.GetInt64() > 0 { + s = "TRUE" + } else { + s = "FALSE" + } + } else { + s = strconv.FormatInt(n.GetInt64(), 10) + } + case types.KindUint64: + s = strconv.FormatUint(n.GetUint64(), 10) + case types.KindFloat32: + s = strconv.FormatFloat(n.GetFloat64(), 'e', -1, 32) + case types.KindFloat64: + s = strconv.FormatFloat(n.GetFloat64(), 'e', -1, 64) + case types.KindString, types.KindBytes: + s = strconv.Quote(n.GetString()) + case types.KindMysqlDecimal: + s = n.GetMysqlDecimal().String() + case types.KindBinaryLiteral: + if n.Type.Flag&mysql.UnsignedFlag != 0 { + s = fmt.Sprintf("x'%x'", n.GetBytes()) + } else { + s = n.GetBinaryLiteral().ToBitLiteralString(true) + } + default: + panic("Can't format to string") + } + fmt.Fprint(w, s) +} + +// newValueExpr creates a ValueExpr with value, and sets default field type. +func newValueExpr(value interface{}) ast.ValueExpr { + if ve, ok := value.(*ValueExpr); ok { + return ve + } + ve := &ValueExpr{} + ve.SetValue(value) + types.DefaultTypeForValue(value, &ve.Type) + ve.projectionOffset = -1 + return ve +} + +// SetProjectionOffset sets ValueExpr.projectionOffset for logical plan builder. +func (n *ValueExpr) SetProjectionOffset(offset int) { + n.projectionOffset = offset +} + +// GetProjectionOffset returns ValueExpr.projectionOffset. +func (n *ValueExpr) GetProjectionOffset() int { + return n.projectionOffset +} + +// Accept implements Node interface. +func (n *ValueExpr) Accept(v ast.Visitor) (ast.Node, bool) { + newNode, skipChildren := v.Enter(n) + if skipChildren { + return v.Leave(newNode) + } + n = newNode.(*ValueExpr) + return v.Leave(n) +} + +// ParamMarkerExpr expression holds a place for another expression. +// Used in parsing prepare statement. +type ParamMarkerExpr struct { + ValueExpr + Offset int + Order int +} + +func newParamMarkerExpr(offset int) ast.ParamMarkerExpr { + return &ParamMarkerExpr{ + Offset: offset, + } +} + +// Format the ExprNode into a Writer. +func (n *ParamMarkerExpr) Format(w io.Writer) { + panic("Not implemented") +} + +// Accept implements Node Accept interface. +func (n *ParamMarkerExpr) Accept(v ast.Visitor) (ast.Node, bool) { + newNode, skipChildren := v.Enter(n) + if skipChildren { + return v.Leave(newNode) + } + n = newNode.(*ParamMarkerExpr) + return v.Leave(n) +} + +// SetOrder implements the ast.ParamMarkerExpr interface. +func (n *ParamMarkerExpr) SetOrder(order int) { + n.Order = order +} diff --git a/types/time.go b/types/time.go index b5a027657f198..5133835985411 100644 --- a/types/time.go +++ b/types/time.go @@ -23,9 +23,9 @@ import ( gotime "time" "unicode" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) diff --git a/types/time_test.go b/types/time_test.go index d0e0cb25eac76..6a5736bd27f13 100644 --- a/types/time_test.go +++ b/types/time_test.go @@ -18,7 +18,7 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/mock" diff --git a/util/admin/admin.go b/util/admin/admin.go index a137c41ab410f..4d7a110de7471 100644 --- a/util/admin/admin.go +++ b/util/admin/admin.go @@ -18,17 +18,17 @@ import ( "io" "sort" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" - "github.com/pingcap/tidb/model" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/tablecodec" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/chunk" @@ -730,7 +730,7 @@ func fillGenColData(sessCtx sessionctx.Context, rowMap map[int64]types.Datum, t if !col.IsGenerated() || col.GeneratedStored == true { continue } - genColumnName := model.GetTableColumnID(tableInfo, col.ColumnInfo) + genColumnName := GetTableColumnID(tableInfo, col.ColumnInfo) if expr, ok := genExprs[genColumnName]; ok { var val types.Datum val, err = expr.Eval(chunk.MutRowFromDatums(row).ToRow()) @@ -747,6 +747,11 @@ func fillGenColData(sessCtx sessionctx.Context, rowMap map[int64]types.Datum, t return nil } +// GetTableColumnID gets a ID of a column with table ID // TableColumnID is composed by table ID and column ID. +func GetTableColumnID(tableInfo *model.TableInfo, col *model.ColumnInfo) string { + return fmt.Sprintf("%d_%d", tableInfo.ID, col.ID) +} + // admin error codes. const ( codeDataNotEqual terror.ErrCode = 1 diff --git a/util/admin/admin_test.go b/util/admin/admin_test.go index 1e88fe08a67bc..d678f7d4543fc 100644 --- a/util/admin/admin_test.go +++ b/util/admin/admin_test.go @@ -19,10 +19,10 @@ import ( "time" . "github.com/pingcap/check" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" diff --git a/util/auth/auth.go b/util/auth/auth.go index 0c60b7d67d892..d3873768cc00f 100644 --- a/util/auth/auth.go +++ b/util/auth/auth.go @@ -19,7 +19,7 @@ import ( "encoding/hex" "fmt" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/terror" "github.com/pkg/errors" ) diff --git a/util/charset/charset.go b/util/charset/charset.go index 6967b9537a65c..c065ada4aed72 100644 --- a/util/charset/charset.go +++ b/util/charset/charset.go @@ -16,7 +16,7 @@ package charset import ( "strings" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pkg/errors" ) diff --git a/util/chunk/chunk_test.go b/util/chunk/chunk_test.go index 799a6e703ca64..af61a97ae5bd3 100644 --- a/util/chunk/chunk_test.go +++ b/util/chunk/chunk_test.go @@ -23,7 +23,7 @@ import ( "unsafe" "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" diff --git a/util/chunk/codec.go b/util/chunk/codec.go index 20401f95f762b..43a5f5b17327d 100644 --- a/util/chunk/codec.go +++ b/util/chunk/codec.go @@ -19,7 +19,7 @@ import ( "unsafe" "github.com/cznic/mathutil" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" ) diff --git a/util/chunk/codec_test.go b/util/chunk/codec_test.go index 99aa4027647d1..abf5351784cc8 100644 --- a/util/chunk/codec_test.go +++ b/util/chunk/codec_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/hack" diff --git a/util/chunk/compare.go b/util/chunk/compare.go index 60dc70ced817b..a8adbfc4174a9 100644 --- a/util/chunk/compare.go +++ b/util/chunk/compare.go @@ -16,7 +16,7 @@ package chunk import ( "sort" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" ) diff --git a/util/chunk/iterator_test.go b/util/chunk/iterator_test.go index eb4f9d7c04cf7..5438f062a1383 100644 --- a/util/chunk/iterator_test.go +++ b/util/chunk/iterator_test.go @@ -15,7 +15,7 @@ package chunk import ( "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" ) diff --git a/util/chunk/list_test.go b/util/chunk/list_test.go index 646812331ceb8..18982727ba40a 100644 --- a/util/chunk/list_test.go +++ b/util/chunk/list_test.go @@ -19,7 +19,7 @@ import ( "time" "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" ) diff --git a/util/chunk/mutrow.go b/util/chunk/mutrow.go index 1eba29a2f9e5c..17a3c4f4dd31c 100644 --- a/util/chunk/mutrow.go +++ b/util/chunk/mutrow.go @@ -18,7 +18,7 @@ import ( "math" "unsafe" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/hack" diff --git a/util/chunk/mutrow_test.go b/util/chunk/mutrow_test.go index bf2e925c7fb41..1405773f027f4 100644 --- a/util/chunk/mutrow_test.go +++ b/util/chunk/mutrow_test.go @@ -18,7 +18,7 @@ import ( "time" "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" diff --git a/util/chunk/row.go b/util/chunk/row.go index dcf573eea66b5..df2bd96df91f6 100644 --- a/util/chunk/row.go +++ b/util/chunk/row.go @@ -17,7 +17,7 @@ import ( "time" "unsafe" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/hack" diff --git a/util/codec/bench_test.go b/util/codec/bench_test.go index 4929458dcf994..0dd8d2d05b5d3 100644 --- a/util/codec/bench_test.go +++ b/util/codec/bench_test.go @@ -16,7 +16,7 @@ package codec import ( "testing" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" ) diff --git a/util/codec/codec.go b/util/codec/codec.go index 01d330ae8f68e..80839b5ca5340 100644 --- a/util/codec/codec.go +++ b/util/codec/codec.go @@ -17,9 +17,9 @@ import ( "encoding/binary" "time" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/util/codec/codec_test.go b/util/codec/codec_test.go index 07b38e79c5cbe..56a1489addd04 100644 --- a/util/codec/codec_test.go +++ b/util/codec/codec_test.go @@ -20,9 +20,9 @@ import ( "time" . "github.com/pingcap/check" - "github.com/pingcap/tidb/mysql" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/types/json" "github.com/pingcap/tidb/util/chunk" diff --git a/util/filesort/filesort.go b/util/filesort/filesort.go index 6701ca825324e..5b61cc904b7c2 100644 --- a/util/filesort/filesort.go +++ b/util/filesort/filesort.go @@ -25,8 +25,8 @@ import ( "sync/atomic" "time" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" diff --git a/util/kvencoder/kv_encoder.go b/util/kvencoder/kv_encoder.go index 9fb4167172619..9184e0d439aec 100644 --- a/util/kvencoder/kv_encoder.go +++ b/util/kvencoder/kv_encoder.go @@ -20,11 +20,11 @@ import ( "sync" "sync/atomic" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/store/mockstore" "github.com/pingcap/tidb/tablecodec" diff --git a/util/memory/action.go b/util/memory/action.go index 1873d3c2cca24..7e8ddaf49ded1 100644 --- a/util/memory/action.go +++ b/util/memory/action.go @@ -16,8 +16,8 @@ package memory import ( "sync" - "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/terror" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" log "github.com/sirupsen/logrus" ) diff --git a/util/mock/context.go b/util/mock/context.go index 0ddd2d02f4493..1461b4141cc66 100644 --- a/util/mock/context.go +++ b/util/mock/context.go @@ -19,7 +19,6 @@ import ( "sync" "time" - "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/owner" "github.com/pingcap/tidb/sessionctx" @@ -58,7 +57,7 @@ func (txn *wrapTxn) Valid() bool { } // Execute implements sqlexec.SQLExecutor Execute interface. -func (c *Context) Execute(ctx context.Context, sql string) ([]ast.RecordSet, error) { +func (c *Context) Execute(ctx context.Context, sql string) ([]sqlexec.RecordSet, error) { return nil, errors.Errorf("Not Support.") } diff --git a/util/printer/printer.go b/util/printer/printer.go index 510c87c2592da..fdae8b19f32bc 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -18,8 +18,8 @@ import ( "encoding/json" "fmt" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/config" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/util/israce" log "github.com/sirupsen/logrus" ) diff --git a/util/ranger/checker.go b/util/ranger/checker.go index 6973d6bec8304..74ea582ca94de 100644 --- a/util/ranger/checker.go +++ b/util/ranger/checker.go @@ -14,9 +14,9 @@ package ranger import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/types" ) diff --git a/util/ranger/detacher.go b/util/ranger/detacher.go index 31be5566d0843..529f4cb92c9a8 100644 --- a/util/ranger/detacher.go +++ b/util/ranger/detacher.go @@ -14,9 +14,9 @@ package ranger import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/model" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pkg/errors" diff --git a/util/ranger/points.go b/util/ranger/points.go index 4f31943d88f53..0b830545e578f 100644 --- a/util/ranger/points.go +++ b/util/ranger/points.go @@ -18,11 +18,11 @@ import ( "math" "sort" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/expression" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/stmtctx" - "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" "github.com/pkg/errors" diff --git a/util/ranger/ranger.go b/util/ranger/ranger.go index 2a7c1ca87d7b4..5631c1ff7c995 100644 --- a/util/ranger/ranger.go +++ b/util/ranger/ranger.go @@ -19,14 +19,14 @@ import ( "sort" "unicode/utf8" - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" + "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/types" - "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/codec" "github.com/pkg/errors" ) diff --git a/util/ranger/ranger_test.go b/util/ranger/ranger_test.go index 56ec9261417d3..8947aec481cc5 100644 --- a/util/ranger/ranger_test.go +++ b/util/ranger/ranger_test.go @@ -18,10 +18,10 @@ import ( "testing" . "github.com/pingcap/check" + "github.com/pingcap/parser" "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/kv" - "github.com/pingcap/tidb/parser" plannercore "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx" diff --git a/util/sqlexec/restricted_sql_executor.go b/util/sqlexec/restricted_sql_executor.go index e95574ea8c354..672845de616bc 100644 --- a/util/sqlexec/restricted_sql_executor.go +++ b/util/sqlexec/restricted_sql_executor.go @@ -14,7 +14,7 @@ package sqlexec import ( - "github.com/pingcap/tidb/ast" + "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/util/chunk" "golang.org/x/net/context" @@ -42,7 +42,7 @@ type RestrictedSQLExecutor interface { // For example, privilege/privileges package need execute SQL, if it use // session.Session.Execute, then privilege/privileges and tidb would become a circle. type SQLExecutor interface { - Execute(ctx context.Context, sql string) ([]ast.RecordSet, error) + Execute(ctx context.Context, sql string) ([]RecordSet, error) } // SQLParser is an interface provides parsing sql statement. @@ -52,3 +52,41 @@ type SQLExecutor interface { type SQLParser interface { ParseSQL(sql, charset, collation string) ([]ast.StmtNode, error) } + +// Statement is an interface for SQL execution. +// NOTE: all Statement implementations must be safe for +// concurrent using by multiple goroutines. +// If the Exec method requires any Execution domain local data, +// they must be held out of the implementing instance. +type Statement interface { + // OriginText gets the origin SQL text. + OriginText() string + + // Exec executes SQL and gets a Recordset. + Exec(ctx context.Context) (RecordSet, error) + + // IsPrepared returns whether this statement is prepared statement. + IsPrepared() bool + + // IsReadOnly returns if the statement is read only. For example: SelectStmt without lock. + IsReadOnly() bool + + // RebuildPlan rebuilds the plan of the statement. + RebuildPlan() (schemaVersion int64, err error) +} + +// RecordSet is an abstract result set interface to help get data from Plan. +type RecordSet interface { + // Fields gets result fields. + Fields() []*ast.ResultField + + // Next reads records into chunk. + Next(ctx context.Context, chk *chunk.Chunk) error + + // NewChunk creates a new chunk with initial capacity. + NewChunk() *chunk.Chunk + + // Close closes the underlying iterator, call Next after Close will + // restart the iteration. + Close() error +} diff --git a/util/testkit/testkit.go b/util/testkit/testkit.go index 08cc9a2d87355..cea25aab3ef75 100644 --- a/util/testkit/testkit.go +++ b/util/testkit/testkit.go @@ -20,9 +20,9 @@ import ( "sync/atomic" "github.com/pingcap/check" - "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/session" + "github.com/pingcap/tidb/util/sqlexec" "github.com/pingcap/tidb/util/testutil" "github.com/pkg/errors" "golang.org/x/net/context" @@ -123,7 +123,7 @@ func NewTestKitWithInit(c *check.C, store kv.Storage) *TestKit { var connectionID uint64 // Exec executes a sql statement. -func (tk *TestKit) Exec(sql string, args ...interface{}) (ast.RecordSet, error) { +func (tk *TestKit) Exec(sql string, args ...interface{}) (sqlexec.RecordSet, error) { var err error if tk.Se == nil { tk.Se, err = session.CreateSession4Test(tk.store) @@ -133,7 +133,7 @@ func (tk *TestKit) Exec(sql string, args ...interface{}) (ast.RecordSet, error) } ctx := context.Background() if len(args) == 0 { - var rss []ast.RecordSet + var rss []sqlexec.RecordSet rss, err = tk.Se.Execute(ctx, sql) if err == nil && len(rss) > 0 { return rss[0], nil @@ -180,9 +180,9 @@ func (tk *TestKit) MustQuery(sql string, args ...interface{}) *Result { return tk.ResultSetToResult(rs, comment) } -// ResultSetToResult converts ast.RecordSet to testkit.Result. +// ResultSetToResult converts sqlexec.RecordSet to testkit.Result. // It is used to check results of execute statement in binary mode. -func (tk *TestKit) ResultSetToResult(rs ast.RecordSet, comment check.CommentInterface) *Result { +func (tk *TestKit) ResultSetToResult(rs sqlexec.RecordSet, comment check.CommentInterface) *Result { rows, err := session.GetRows4Test(context.Background(), tk.Se, rs) tk.c.Assert(errors.ErrorStack(err), check.Equals, "", comment) err = rs.Close() diff --git a/vendor/github.com/BurntSushi/toml/.gitignore b/vendor/github.com/BurntSushi/toml/.gitignore new file mode 100644 index 0000000000000..0cd3800377d4d --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/.gitignore @@ -0,0 +1,5 @@ +TAGS +tags +.*.swp +tomlcheck/tomlcheck +toml.test diff --git a/vendor/github.com/BurntSushi/toml/.travis.yml b/vendor/github.com/BurntSushi/toml/.travis.yml new file mode 100644 index 0000000000000..8b8afc4f0e00d --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/.travis.yml @@ -0,0 +1,15 @@ +language: go +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - tip +install: + - go install ./... + - go get github.com/BurntSushi/toml-test +script: + - export PATH="$PATH:$HOME/gopath/bin" + - make test diff --git a/vendor/github.com/BurntSushi/toml/COMPATIBLE b/vendor/github.com/BurntSushi/toml/COMPATIBLE new file mode 100644 index 0000000000000..6efcfd0ce55ef --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/COMPATIBLE @@ -0,0 +1,3 @@ +Compatible with TOML version +[v0.4.0](https://github.com/toml-lang/toml/blob/v0.4.0/versions/en/toml-v0.4.0.md) + diff --git a/vendor/github.com/BurntSushi/toml/Makefile b/vendor/github.com/BurntSushi/toml/Makefile new file mode 100644 index 0000000000000..3600848d331ab --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/Makefile @@ -0,0 +1,19 @@ +install: + go install ./... + +test: install + go test -v + toml-test toml-test-decoder + toml-test -encoder toml-test-encoder + +fmt: + gofmt -w *.go */*.go + colcheck *.go */*.go + +tags: + find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS + +push: + git push origin master + git push github master + diff --git a/vendor/github.com/BurntSushi/toml/README.md b/vendor/github.com/BurntSushi/toml/README.md new file mode 100644 index 0000000000000..7c1b37ecc7a02 --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/README.md @@ -0,0 +1,218 @@ +## TOML parser and encoder for Go with reflection + +TOML stands for Tom's Obvious, Minimal Language. This Go package provides a +reflection interface similar to Go's standard library `json` and `xml` +packages. This package also supports the `encoding.TextUnmarshaler` and +`encoding.TextMarshaler` interfaces so that you can define custom data +representations. (There is an example of this below.) + +Spec: https://github.com/toml-lang/toml + +Compatible with TOML version +[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md) + +Documentation: https://godoc.org/github.com/BurntSushi/toml + +Installation: + +```bash +go get github.com/BurntSushi/toml +``` + +Try the toml validator: + +```bash +go get github.com/BurntSushi/toml/cmd/tomlv +tomlv some-toml-file.toml +``` + +[![Build Status](https://travis-ci.org/BurntSushi/toml.svg?branch=master)](https://travis-ci.org/BurntSushi/toml) [![GoDoc](https://godoc.org/github.com/BurntSushi/toml?status.svg)](https://godoc.org/github.com/BurntSushi/toml) + +### Testing + +This package passes all tests in +[toml-test](https://github.com/BurntSushi/toml-test) for both the decoder +and the encoder. + +### Examples + +This package works similarly to how the Go standard library handles `XML` +and `JSON`. Namely, data is loaded into Go values via reflection. + +For the simplest example, consider some TOML file as just a list of keys +and values: + +```toml +Age = 25 +Cats = [ "Cauchy", "Plato" ] +Pi = 3.14 +Perfection = [ 6, 28, 496, 8128 ] +DOB = 1987-07-05T05:45:00Z +``` + +Which could be defined in Go as: + +```go +type Config struct { + Age int + Cats []string + Pi float64 + Perfection []int + DOB time.Time // requires `import time` +} +``` + +And then decoded with: + +```go +var conf Config +if _, err := toml.Decode(tomlData, &conf); err != nil { + // handle error +} +``` + +You can also use struct tags if your struct field name doesn't map to a TOML +key value directly: + +```toml +some_key_NAME = "wat" +``` + +```go +type TOML struct { + ObscureKey string `toml:"some_key_NAME"` +} +``` + +### Using the `encoding.TextUnmarshaler` interface + +Here's an example that automatically parses duration strings into +`time.Duration` values: + +```toml +[[song]] +name = "Thunder Road" +duration = "4m49s" + +[[song]] +name = "Stairway to Heaven" +duration = "8m03s" +``` + +Which can be decoded with: + +```go +type song struct { + Name string + Duration duration +} +type songs struct { + Song []song +} +var favorites songs +if _, err := toml.Decode(blob, &favorites); err != nil { + log.Fatal(err) +} + +for _, s := range favorites.Song { + fmt.Printf("%s (%s)\n", s.Name, s.Duration) +} +``` + +And you'll also need a `duration` type that satisfies the +`encoding.TextUnmarshaler` interface: + +```go +type duration struct { + time.Duration +} + +func (d *duration) UnmarshalText(text []byte) error { + var err error + d.Duration, err = time.ParseDuration(string(text)) + return err +} +``` + +### More complex usage + +Here's an example of how to load the example from the official spec page: + +```toml +# This is a TOML document. Boom. + +title = "TOML Example" + +[owner] +name = "Tom Preston-Werner" +organization = "GitHub" +bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." +dob = 1979-05-27T07:32:00Z # First class dates? Why not? + +[database] +server = "192.168.1.1" +ports = [ 8001, 8001, 8002 ] +connection_max = 5000 +enabled = true + +[servers] + + # You can indent as you please. Tabs or spaces. TOML don't care. + [servers.alpha] + ip = "10.0.0.1" + dc = "eqdc10" + + [servers.beta] + ip = "10.0.0.2" + dc = "eqdc10" + +[clients] +data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it + +# Line breaks are OK when inside arrays +hosts = [ + "alpha", + "omega" +] +``` + +And the corresponding Go types are: + +```go +type tomlConfig struct { + Title string + Owner ownerInfo + DB database `toml:"database"` + Servers map[string]server + Clients clients +} + +type ownerInfo struct { + Name string + Org string `toml:"organization"` + Bio string + DOB time.Time +} + +type database struct { + Server string + Ports []int + ConnMax int `toml:"connection_max"` + Enabled bool +} + +type server struct { + IP string + DC string +} + +type clients struct { + Data [][]interface{} + Hosts []string +} +``` + +Note that a case insensitive match will be tried if an exact match can't be +found. + +A working example of the above can be found in `_examples/example.{go,toml}`. diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING deleted file mode 100644 index 5a8e332545f66..0000000000000 --- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING +++ /dev/null @@ -1,14 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. - diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING deleted file mode 100644 index 5a8e332545f66..0000000000000 --- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING +++ /dev/null @@ -1,14 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. - diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING b/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING deleted file mode 100644 index 5a8e332545f66..0000000000000 --- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING +++ /dev/null @@ -1,14 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. - diff --git a/vendor/github.com/BurntSushi/toml/decode_test.go b/vendor/github.com/BurntSushi/toml/decode_test.go new file mode 100644 index 0000000000000..95bc987f0c74d --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/decode_test.go @@ -0,0 +1,1461 @@ +package toml + +import ( + "fmt" + "log" + "math" + "reflect" + "strings" + "testing" + "time" +) + +func TestDecodeSimple(t *testing.T) { + var testSimple = ` +age = 250 +andrew = "gallant" +kait = "brady" +now = 1987-07-05T05:45:00Z +nowEast = 2017-06-22T16:15:21+08:00 +nowWest = 2017-06-22T02:14:36-06:00 +yesOrNo = true +pi = 3.14 +colors = [ + ["red", "green", "blue"], + ["cyan", "magenta", "yellow", "black"], +] + +[My.Cats] +plato = "cat 1" +cauchy = "cat 2" +` + + type cats struct { + Plato string + Cauchy string + } + type simple struct { + Age int + Colors [][]string + Pi float64 + YesOrNo bool + Now time.Time + NowEast time.Time + NowWest time.Time + Andrew string + Kait string + My map[string]cats + } + + var val simple + _, err := Decode(testSimple, &val) + if err != nil { + t.Fatal(err) + } + + now, err := time.Parse("2006-01-02T15:04:05", "1987-07-05T05:45:00") + if err != nil { + panic(err) + } + nowEast, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-06-22T16:15:21+08:00") + if err != nil { + panic(err) + } + nowWest, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-06-22T02:14:36-06:00") + if err != nil { + panic(err) + } + var answer = simple{ + Age: 250, + Andrew: "gallant", + Kait: "brady", + Now: now, + NowEast: nowEast, + NowWest: nowWest, + YesOrNo: true, + Pi: 3.14, + Colors: [][]string{ + {"red", "green", "blue"}, + {"cyan", "magenta", "yellow", "black"}, + }, + My: map[string]cats{ + "Cats": {Plato: "cat 1", Cauchy: "cat 2"}, + }, + } + if !reflect.DeepEqual(val, answer) { + t.Fatalf("Expected\n-----\n%#v\n-----\nbut got\n-----\n%#v\n", + answer, val) + } +} + +func TestDecodeEmbedded(t *testing.T) { + type Dog struct{ Name string } + type Age int + type cat struct{ Name string } + + for _, test := range []struct { + label string + input string + decodeInto interface{} + wantDecoded interface{} + }{ + { + label: "embedded struct", + input: `Name = "milton"`, + decodeInto: &struct{ Dog }{}, + wantDecoded: &struct{ Dog }{Dog{"milton"}}, + }, + { + label: "embedded non-nil pointer to struct", + input: `Name = "milton"`, + decodeInto: &struct{ *Dog }{}, + wantDecoded: &struct{ *Dog }{&Dog{"milton"}}, + }, + { + label: "embedded nil pointer to struct", + input: ``, + decodeInto: &struct{ *Dog }{}, + wantDecoded: &struct{ *Dog }{nil}, + }, + { + label: "unexported embedded struct", + input: `Name = "socks"`, + decodeInto: &struct{ cat }{}, + wantDecoded: &struct{ cat }{cat{"socks"}}, + }, + { + label: "embedded int", + input: `Age = -5`, + decodeInto: &struct{ Age }{}, + wantDecoded: &struct{ Age }{-5}, + }, + } { + _, err := Decode(test.input, test.decodeInto) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(test.wantDecoded, test.decodeInto) { + t.Errorf("%s: want decoded == %+v, got %+v", + test.label, test.wantDecoded, test.decodeInto) + } + } +} + +func TestDecodeIgnoredFields(t *testing.T) { + type simple struct { + Number int `toml:"-"` + } + const input = ` +Number = 123 +- = 234 +` + var s simple + if _, err := Decode(input, &s); err != nil { + t.Fatal(err) + } + if s.Number != 0 { + t.Errorf("got: %d; want 0", s.Number) + } +} + +func TestTableArrays(t *testing.T) { + var tomlTableArrays = ` +[[albums]] +name = "Born to Run" + + [[albums.songs]] + name = "Jungleland" + + [[albums.songs]] + name = "Meeting Across the River" + +[[albums]] +name = "Born in the USA" + + [[albums.songs]] + name = "Glory Days" + + [[albums.songs]] + name = "Dancing in the Dark" +` + + type Song struct { + Name string + } + + type Album struct { + Name string + Songs []Song + } + + type Music struct { + Albums []Album + } + + expected := Music{[]Album{ + {"Born to Run", []Song{{"Jungleland"}, {"Meeting Across the River"}}}, + {"Born in the USA", []Song{{"Glory Days"}, {"Dancing in the Dark"}}}, + }} + var got Music + if _, err := Decode(tomlTableArrays, &got); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(expected, got) { + t.Fatalf("\n%#v\n!=\n%#v\n", expected, got) + } +} + +func TestTableNesting(t *testing.T) { + for _, tt := range []struct { + t string + want []string + }{ + {"[a.b.c]", []string{"a", "b", "c"}}, + {`[a."b.c"]`, []string{"a", "b.c"}}, + {`[a.'b.c']`, []string{"a", "b.c"}}, + {`[a.' b ']`, []string{"a", " b "}}, + {"[ d.e.f ]", []string{"d", "e", "f"}}, + {"[ g . h . i ]", []string{"g", "h", "i"}}, + {`[ j . "ʞ" . 'l' ]`, []string{"j", "ʞ", "l"}}, + } { + var m map[string]interface{} + if _, err := Decode(tt.t, &m); err != nil { + t.Errorf("Decode(%q): got error: %s", tt.t, err) + continue + } + if keys := extractNestedKeys(m); !reflect.DeepEqual(keys, tt.want) { + t.Errorf("Decode(%q): got nested keys %#v; want %#v", + tt.t, keys, tt.want) + } + } +} + +func extractNestedKeys(v map[string]interface{}) []string { + var result []string + for { + if len(v) != 1 { + return result + } + for k, m := range v { + result = append(result, k) + var ok bool + v, ok = m.(map[string]interface{}) + if !ok { + return result + } + } + + } +} + +// Case insensitive matching tests. +// A bit more comprehensive than needed given the current implementation, +// but implementations change. +// Probably still missing demonstrations of some ugly corner cases regarding +// case insensitive matching and multiple fields. +func TestCase(t *testing.T) { + var caseToml = ` +tOpString = "string" +tOpInt = 1 +tOpFloat = 1.1 +tOpBool = true +tOpdate = 2006-01-02T15:04:05Z +tOparray = [ "array" ] +Match = "i should be in Match only" +MatcH = "i should be in MatcH only" +once = "just once" +[nEst.eD] +nEstedString = "another string" +` + + type InsensitiveEd struct { + NestedString string + } + + type InsensitiveNest struct { + Ed InsensitiveEd + } + + type Insensitive struct { + TopString string + TopInt int + TopFloat float64 + TopBool bool + TopDate time.Time + TopArray []string + Match string + MatcH string + Once string + OncE string + Nest InsensitiveNest + } + + tme, err := time.Parse(time.RFC3339, time.RFC3339[:len(time.RFC3339)-5]) + if err != nil { + panic(err) + } + expected := Insensitive{ + TopString: "string", + TopInt: 1, + TopFloat: 1.1, + TopBool: true, + TopDate: tme, + TopArray: []string{"array"}, + MatcH: "i should be in MatcH only", + Match: "i should be in Match only", + Once: "just once", + OncE: "", + Nest: InsensitiveNest{ + Ed: InsensitiveEd{NestedString: "another string"}, + }, + } + var got Insensitive + if _, err := Decode(caseToml, &got); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(expected, got) { + t.Fatalf("\n%#v\n!=\n%#v\n", expected, got) + } +} + +func TestPointers(t *testing.T) { + type Object struct { + Type string + Description string + } + + type Dict struct { + NamedObject map[string]*Object + BaseObject *Object + Strptr *string + Strptrs []*string + } + s1, s2, s3 := "blah", "abc", "def" + expected := &Dict{ + Strptr: &s1, + Strptrs: []*string{&s2, &s3}, + NamedObject: map[string]*Object{ + "foo": {"FOO", "fooooo!!!"}, + "bar": {"BAR", "ba-ba-ba-ba-barrrr!!!"}, + }, + BaseObject: &Object{"BASE", "da base"}, + } + + ex1 := ` +Strptr = "blah" +Strptrs = ["abc", "def"] + +[NamedObject.foo] +Type = "FOO" +Description = "fooooo!!!" + +[NamedObject.bar] +Type = "BAR" +Description = "ba-ba-ba-ba-barrrr!!!" + +[BaseObject] +Type = "BASE" +Description = "da base" +` + dict := new(Dict) + _, err := Decode(ex1, dict) + if err != nil { + t.Errorf("Decode error: %v", err) + } + if !reflect.DeepEqual(expected, dict) { + t.Fatalf("\n%#v\n!=\n%#v\n", expected, dict) + } +} + +func TestDecodeDatetime(t *testing.T) { + const noTimestamp = "2006-01-02T15:04:05" + for _, tt := range []struct { + s string + t string + format string + }{ + {"1979-05-27T07:32:00Z", "1979-05-27T07:32:00Z", time.RFC3339}, + {"1979-05-27T00:32:00-07:00", "1979-05-27T00:32:00-07:00", time.RFC3339}, + { + "1979-05-27T00:32:00.999999-07:00", + "1979-05-27T00:32:00.999999-07:00", + time.RFC3339, + }, + {"1979-05-27T07:32:00", "1979-05-27T07:32:00", noTimestamp}, + { + "1979-05-27T00:32:00.999999", + "1979-05-27T00:32:00.999999", + noTimestamp, + }, + {"1979-05-27", "1979-05-27T00:00:00", noTimestamp}, + } { + var x struct{ D time.Time } + input := "d = " + tt.s + if _, err := Decode(input, &x); err != nil { + t.Errorf("Decode(%q): got error: %s", input, err) + continue + } + want, err := time.ParseInLocation(tt.format, tt.t, time.Local) + if err != nil { + panic(err) + } + if !x.D.Equal(want) { + t.Errorf("Decode(%q): got %s; want %s", input, x.D, want) + } + } +} + +func TestDecodeBadDatetime(t *testing.T) { + var x struct{ T time.Time } + for _, s := range []string{ + "123", + "2006-01-50T00:00:00Z", + "2006-01-30T00:00", + "2006-01-30T", + } { + input := "T = " + s + if _, err := Decode(input, &x); err == nil { + t.Errorf("Expected invalid DateTime error for %q", s) + } + } +} + +func TestDecodeMultilineStrings(t *testing.T) { + var x struct { + S string + } + const s0 = `s = """ +a b \n c +d e f +"""` + if _, err := Decode(s0, &x); err != nil { + t.Fatal(err) + } + if want := "a b \n c\nd e f\n"; x.S != want { + t.Errorf("got: %q; want: %q", x.S, want) + } + const s1 = `s = """a b c\ +"""` + if _, err := Decode(s1, &x); err != nil { + t.Fatal(err) + } + if want := "a b c"; x.S != want { + t.Errorf("got: %q; want: %q", x.S, want) + } +} + +type sphere struct { + Center [3]float64 + Radius float64 +} + +func TestDecodeSimpleArray(t *testing.T) { + var s1 sphere + if _, err := Decode(`center = [0.0, 1.5, 0.0]`, &s1); err != nil { + t.Fatal(err) + } +} + +func TestDecodeArrayWrongSize(t *testing.T) { + var s1 sphere + if _, err := Decode(`center = [0.1, 2.3]`, &s1); err == nil { + t.Fatal("Expected array type mismatch error") + } +} + +func TestDecodeLargeIntoSmallInt(t *testing.T) { + type table struct { + Value int8 + } + var tab table + if _, err := Decode(`value = 500`, &tab); err == nil { + t.Fatal("Expected integer out-of-bounds error.") + } +} + +func TestDecodeSizedInts(t *testing.T) { + type table struct { + U8 uint8 + U16 uint16 + U32 uint32 + U64 uint64 + U uint + I8 int8 + I16 int16 + I32 int32 + I64 int64 + I int + } + answer := table{1, 1, 1, 1, 1, -1, -1, -1, -1, -1} + toml := ` + u8 = 1 + u16 = 1 + u32 = 1 + u64 = 1 + u = 1 + i8 = -1 + i16 = -1 + i32 = -1 + i64 = -1 + i = -1 + ` + var tab table + if _, err := Decode(toml, &tab); err != nil { + t.Fatal(err.Error()) + } + if answer != tab { + t.Fatalf("Expected %#v but got %#v", answer, tab) + } +} + +func TestDecodeInts(t *testing.T) { + for _, tt := range []struct { + s string + want int64 + }{ + {"0", 0}, + {"+99", 99}, + {"-10", -10}, + {"1_234_567", 1234567}, + {"1_2_3_4", 1234}, + {"-9_223_372_036_854_775_808", math.MinInt64}, + {"9_223_372_036_854_775_807", math.MaxInt64}, + } { + var x struct{ N int64 } + input := "n = " + tt.s + if _, err := Decode(input, &x); err != nil { + t.Errorf("Decode(%q): got error: %s", input, err) + continue + } + if x.N != tt.want { + t.Errorf("Decode(%q): got %d; want %d", input, x.N, tt.want) + } + } +} + +func TestDecodeFloats(t *testing.T) { + for _, tt := range []struct { + s string + want float64 + }{ + {"+1.0", 1}, + {"3.1415", 3.1415}, + {"-0.01", -0.01}, + {"5e+22", 5e22}, + {"1e6", 1e6}, + {"-2E-2", -2e-2}, + {"6.626e-34", 6.626e-34}, + {"9_224_617.445_991_228_313", 9224617.445991228313}, + {"9_876.54_32e1_0", 9876.5432e10}, + } { + var x struct{ N float64 } + input := "n = " + tt.s + if _, err := Decode(input, &x); err != nil { + t.Errorf("Decode(%q): got error: %s", input, err) + continue + } + if x.N != tt.want { + t.Errorf("Decode(%q): got %f; want %f", input, x.N, tt.want) + } + } +} + +func TestDecodeMalformedNumbers(t *testing.T) { + for _, tt := range []struct { + s string + want string + }{ + {"++99", "expected a digit"}, + {"0..1", "must be followed by one or more digits"}, + {"0.1.2", "Invalid float value"}, + {"1e2.3", "Invalid float value"}, + {"1e2e3", "Invalid float value"}, + {"_123", "expected value"}, + {"123_", "surrounded by digits"}, + {"1._23", "surrounded by digits"}, + {"1e__23", "surrounded by digits"}, + {"123.", "must be followed by one or more digits"}, + {"1.e2", "must be followed by one or more digits"}, + } { + var x struct{ N interface{} } + input := "n = " + tt.s + _, err := Decode(input, &x) + if err == nil { + t.Errorf("Decode(%q): got nil, want error containing %q", + input, tt.want) + continue + } + if !strings.Contains(err.Error(), tt.want) { + t.Errorf("Decode(%q): got %q, want error containing %q", + input, err, tt.want) + } + } +} + +func TestDecodeBadValues(t *testing.T) { + for _, tt := range []struct { + v interface{} + want string + }{ + {3, "non-pointer int"}, + {(*int)(nil), "nil"}, + } { + _, err := Decode(`x = 3`, tt.v) + if err == nil { + t.Errorf("Decode(%v): got nil; want error containing %q", + tt.v, tt.want) + continue + } + if !strings.Contains(err.Error(), tt.want) { + t.Errorf("Decode(%v): got %q; want error containing %q", + tt.v, err, tt.want) + } + } +} + +func TestUnmarshaler(t *testing.T) { + + var tomlBlob = ` +[dishes.hamboogie] +name = "Hamboogie with fries" +price = 10.99 + +[[dishes.hamboogie.ingredients]] +name = "Bread Bun" + +[[dishes.hamboogie.ingredients]] +name = "Lettuce" + +[[dishes.hamboogie.ingredients]] +name = "Real Beef Patty" + +[[dishes.hamboogie.ingredients]] +name = "Tomato" + +[dishes.eggsalad] +name = "Egg Salad with rice" +price = 3.99 + +[[dishes.eggsalad.ingredients]] +name = "Egg" + +[[dishes.eggsalad.ingredients]] +name = "Mayo" + +[[dishes.eggsalad.ingredients]] +name = "Rice" +` + m := &menu{} + if _, err := Decode(tomlBlob, m); err != nil { + t.Fatal(err) + } + + if len(m.Dishes) != 2 { + t.Log("two dishes should be loaded with UnmarshalTOML()") + t.Errorf("expected %d but got %d", 2, len(m.Dishes)) + } + + eggSalad := m.Dishes["eggsalad"] + if _, ok := interface{}(eggSalad).(dish); !ok { + t.Errorf("expected a dish") + } + + if eggSalad.Name != "Egg Salad with rice" { + t.Errorf("expected the dish to be named 'Egg Salad with rice'") + } + + if len(eggSalad.Ingredients) != 3 { + t.Log("dish should be loaded with UnmarshalTOML()") + t.Errorf("expected %d but got %d", 3, len(eggSalad.Ingredients)) + } + + found := false + for _, i := range eggSalad.Ingredients { + if i.Name == "Rice" { + found = true + break + } + } + if !found { + t.Error("Rice was not loaded in UnmarshalTOML()") + } + + // test on a value - must be passed as * + o := menu{} + if _, err := Decode(tomlBlob, &o); err != nil { + t.Fatal(err) + } + +} + +func TestDecodeInlineTable(t *testing.T) { + input := ` +[CookieJar] +Types = {Chocolate = "yummy", Oatmeal = "best ever"} + +[Seasons] +Locations = {NY = {Temp = "not cold", Rating = 4}, MI = {Temp = "freezing", Rating = 9}} +` + type cookieJar struct { + Types map[string]string + } + type properties struct { + Temp string + Rating int + } + type seasons struct { + Locations map[string]properties + } + type wrapper struct { + CookieJar cookieJar + Seasons seasons + } + var got wrapper + + meta, err := Decode(input, &got) + if err != nil { + t.Fatal(err) + } + want := wrapper{ + CookieJar: cookieJar{ + Types: map[string]string{ + "Chocolate": "yummy", + "Oatmeal": "best ever", + }, + }, + Seasons: seasons{ + Locations: map[string]properties{ + "NY": { + Temp: "not cold", + Rating: 4, + }, + "MI": { + Temp: "freezing", + Rating: 9, + }, + }, + }, + } + if !reflect.DeepEqual(got, want) { + t.Fatalf("after decode, got:\n\n%#v\n\nwant:\n\n%#v", got, want) + } + if len(meta.keys) != 12 { + t.Errorf("after decode, got %d meta keys; want 12", len(meta.keys)) + } + if len(meta.types) != 12 { + t.Errorf("after decode, got %d meta types; want 12", len(meta.types)) + } +} + +func TestDecodeInlineTableArray(t *testing.T) { + type point struct { + X, Y, Z int + } + var got struct { + Points []point + } + // Example inline table array from the spec. + const in = ` +points = [ { x = 1, y = 2, z = 3 }, + { x = 7, y = 8, z = 9 }, + { x = 2, y = 4, z = 8 } ] + +` + if _, err := Decode(in, &got); err != nil { + t.Fatal(err) + } + want := []point{ + {X: 1, Y: 2, Z: 3}, + {X: 7, Y: 8, Z: 9}, + {X: 2, Y: 4, Z: 8}, + } + if !reflect.DeepEqual(got.Points, want) { + t.Errorf("got %#v; want %#v", got.Points, want) + } +} + +func TestDecodeMalformedInlineTable(t *testing.T) { + for _, tt := range []struct { + s string + want string + }{ + {"{,}", "unexpected comma"}, + {"{x = 3 y = 4}", "expected a comma or an inline table terminator"}, + {"{x=3,,y=4}", "unexpected comma"}, + {"{x=3,\ny=4}", "newlines not allowed"}, + {"{x=3\n,y=4}", "newlines not allowed"}, + } { + var x struct{ A map[string]int } + input := "a = " + tt.s + _, err := Decode(input, &x) + if err == nil { + t.Errorf("Decode(%q): got nil, want error containing %q", + input, tt.want) + continue + } + if !strings.Contains(err.Error(), tt.want) { + t.Errorf("Decode(%q): got %q, want error containing %q", + input, err, tt.want) + } + } +} + +type menu struct { + Dishes map[string]dish +} + +func (m *menu) UnmarshalTOML(p interface{}) error { + m.Dishes = make(map[string]dish) + data, _ := p.(map[string]interface{}) + dishes := data["dishes"].(map[string]interface{}) + for n, v := range dishes { + if d, ok := v.(map[string]interface{}); ok { + nd := dish{} + nd.UnmarshalTOML(d) + m.Dishes[n] = nd + } else { + return fmt.Errorf("not a dish") + } + } + return nil +} + +type dish struct { + Name string + Price float32 + Ingredients []ingredient +} + +func (d *dish) UnmarshalTOML(p interface{}) error { + data, _ := p.(map[string]interface{}) + d.Name, _ = data["name"].(string) + d.Price, _ = data["price"].(float32) + ingredients, _ := data["ingredients"].([]map[string]interface{}) + for _, e := range ingredients { + n, _ := interface{}(e).(map[string]interface{}) + name, _ := n["name"].(string) + i := ingredient{name} + d.Ingredients = append(d.Ingredients, i) + } + return nil +} + +type ingredient struct { + Name string +} + +func TestDecodeSlices(t *testing.T) { + type T struct { + S []string + } + for i, tt := range []struct { + v T + input string + want T + }{ + {T{}, "", T{}}, + {T{[]string{}}, "", T{[]string{}}}, + {T{[]string{"a", "b"}}, "", T{[]string{"a", "b"}}}, + {T{}, "S = []", T{[]string{}}}, + {T{[]string{}}, "S = []", T{[]string{}}}, + {T{[]string{"a", "b"}}, "S = []", T{[]string{}}}, + {T{}, `S = ["x"]`, T{[]string{"x"}}}, + {T{[]string{}}, `S = ["x"]`, T{[]string{"x"}}}, + {T{[]string{"a", "b"}}, `S = ["x"]`, T{[]string{"x"}}}, + } { + if _, err := Decode(tt.input, &tt.v); err != nil { + t.Errorf("[%d] %s", i, err) + continue + } + if !reflect.DeepEqual(tt.v, tt.want) { + t.Errorf("[%d] got %#v; want %#v", i, tt.v, tt.want) + } + } +} + +func TestDecodePrimitive(t *testing.T) { + type S struct { + P Primitive + } + type T struct { + S []int + } + slicep := func(s []int) *[]int { return &s } + arrayp := func(a [2]int) *[2]int { return &a } + mapp := func(m map[string]int) *map[string]int { return &m } + for i, tt := range []struct { + v interface{} + input string + want interface{} + }{ + // slices + {slicep(nil), "", slicep(nil)}, + {slicep([]int{}), "", slicep([]int{})}, + {slicep([]int{1, 2, 3}), "", slicep([]int{1, 2, 3})}, + {slicep(nil), "P = [1,2]", slicep([]int{1, 2})}, + {slicep([]int{}), "P = [1,2]", slicep([]int{1, 2})}, + {slicep([]int{1, 2, 3}), "P = [1,2]", slicep([]int{1, 2})}, + + // arrays + {arrayp([2]int{2, 3}), "", arrayp([2]int{2, 3})}, + {arrayp([2]int{2, 3}), "P = [3,4]", arrayp([2]int{3, 4})}, + + // maps + {mapp(nil), "", mapp(nil)}, + {mapp(map[string]int{}), "", mapp(map[string]int{})}, + {mapp(map[string]int{"a": 1}), "", mapp(map[string]int{"a": 1})}, + {mapp(nil), "[P]\na = 2", mapp(map[string]int{"a": 2})}, + {mapp(map[string]int{}), "[P]\na = 2", mapp(map[string]int{"a": 2})}, + {mapp(map[string]int{"a": 1, "b": 3}), "[P]\na = 2", mapp(map[string]int{"a": 2, "b": 3})}, + + // structs + {&T{nil}, "[P]", &T{nil}}, + {&T{[]int{}}, "[P]", &T{[]int{}}}, + {&T{[]int{1, 2, 3}}, "[P]", &T{[]int{1, 2, 3}}}, + {&T{nil}, "[P]\nS = [1,2]", &T{[]int{1, 2}}}, + {&T{[]int{}}, "[P]\nS = [1,2]", &T{[]int{1, 2}}}, + {&T{[]int{1, 2, 3}}, "[P]\nS = [1,2]", &T{[]int{1, 2}}}, + } { + var s S + md, err := Decode(tt.input, &s) + if err != nil { + t.Errorf("[%d] Decode error: %s", i, err) + continue + } + if err := md.PrimitiveDecode(s.P, tt.v); err != nil { + t.Errorf("[%d] PrimitiveDecode error: %s", i, err) + continue + } + if !reflect.DeepEqual(tt.v, tt.want) { + t.Errorf("[%d] got %#v; want %#v", i, tt.v, tt.want) + } + } +} + +func TestDecodeErrors(t *testing.T) { + for _, s := range []string{ + `x="`, + `x='`, + `x='''`, + + // Cases found by fuzzing in + // https://github.com/BurntSushi/toml/issues/155. + `""�`, // used to panic with index out of range + `e="""`, // used to hang + } { + var x struct{} + _, err := Decode(s, &x) + if err == nil { + t.Errorf("Decode(%q): got nil error", s) + } + } +} + +// Test for https://github.com/BurntSushi/toml/pull/166. +func TestDecodeBoolArray(t *testing.T) { + for _, tt := range []struct { + s string + got interface{} + want interface{} + }{ + { + "a = [true, false]", + &struct{ A []bool }{}, + &struct{ A []bool }{[]bool{true, false}}, + }, + { + "a = {a = true, b = false}", + &struct{ A map[string]bool }{}, + &struct{ A map[string]bool }{map[string]bool{"a": true, "b": false}}, + }, + } { + if _, err := Decode(tt.s, tt.got); err != nil { + t.Errorf("Decode(%q): %s", tt.s, err) + continue + } + if !reflect.DeepEqual(tt.got, tt.want) { + t.Errorf("Decode(%q): got %#v; want %#v", tt.s, tt.got, tt.want) + } + } +} + +func ExampleMetaData_PrimitiveDecode() { + var md MetaData + var err error + + var tomlBlob = ` +ranking = ["Springsteen", "J Geils"] + +[bands.Springsteen] +started = 1973 +albums = ["Greetings", "WIESS", "Born to Run", "Darkness"] + +[bands."J Geils"] +started = 1970 +albums = ["The J. Geils Band", "Full House", "Blow Your Face Out"] +` + + type band struct { + Started int + Albums []string + } + type classics struct { + Ranking []string + Bands map[string]Primitive + } + + // Do the initial decode. Reflection is delayed on Primitive values. + var music classics + if md, err = Decode(tomlBlob, &music); err != nil { + log.Fatal(err) + } + + // MetaData still includes information on Primitive values. + fmt.Printf("Is `bands.Springsteen` defined? %v\n", + md.IsDefined("bands", "Springsteen")) + + // Decode primitive data into Go values. + for _, artist := range music.Ranking { + // A band is a primitive value, so we need to decode it to get a + // real `band` value. + primValue := music.Bands[artist] + + var aBand band + if err = md.PrimitiveDecode(primValue, &aBand); err != nil { + log.Fatal(err) + } + fmt.Printf("%s started in %d.\n", artist, aBand.Started) + } + // Check to see if there were any fields left undecoded. + // Note that this won't be empty before decoding the Primitive value! + fmt.Printf("Undecoded: %q\n", md.Undecoded()) + + // Output: + // Is `bands.Springsteen` defined? true + // Springsteen started in 1973. + // J Geils started in 1970. + // Undecoded: [] +} + +func ExampleDecode() { + var tomlBlob = ` +# Some comments. +[alpha] +ip = "10.0.0.1" + + [alpha.config] + Ports = [ 8001, 8002 ] + Location = "Toronto" + Created = 1987-07-05T05:45:00Z + +[beta] +ip = "10.0.0.2" + + [beta.config] + Ports = [ 9001, 9002 ] + Location = "New Jersey" + Created = 1887-01-05T05:55:00Z +` + + type serverConfig struct { + Ports []int + Location string + Created time.Time + } + + type server struct { + IP string `toml:"ip,omitempty"` + Config serverConfig `toml:"config"` + } + + type servers map[string]server + + var config servers + if _, err := Decode(tomlBlob, &config); err != nil { + log.Fatal(err) + } + + for _, name := range []string{"alpha", "beta"} { + s := config[name] + fmt.Printf("Server: %s (ip: %s) in %s created on %s\n", + name, s.IP, s.Config.Location, + s.Config.Created.Format("2006-01-02")) + fmt.Printf("Ports: %v\n", s.Config.Ports) + } + + // Output: + // Server: alpha (ip: 10.0.0.1) in Toronto created on 1987-07-05 + // Ports: [8001 8002] + // Server: beta (ip: 10.0.0.2) in New Jersey created on 1887-01-05 + // Ports: [9001 9002] +} + +type duration struct { + time.Duration +} + +func (d *duration) UnmarshalText(text []byte) error { + var err error + d.Duration, err = time.ParseDuration(string(text)) + return err +} + +// Example Unmarshaler shows how to decode TOML strings into your own +// custom data type. +func Example_unmarshaler() { + blob := ` +[[song]] +name = "Thunder Road" +duration = "4m49s" + +[[song]] +name = "Stairway to Heaven" +duration = "8m03s" +` + type song struct { + Name string + Duration duration + } + type songs struct { + Song []song + } + var favorites songs + if _, err := Decode(blob, &favorites); err != nil { + log.Fatal(err) + } + + // Code to implement the TextUnmarshaler interface for `duration`: + // + // type duration struct { + // time.Duration + // } + // + // func (d *duration) UnmarshalText(text []byte) error { + // var err error + // d.Duration, err = time.ParseDuration(string(text)) + // return err + // } + + for _, s := range favorites.Song { + fmt.Printf("%s (%s)\n", s.Name, s.Duration) + } + // Output: + // Thunder Road (4m49s) + // Stairway to Heaven (8m3s) +} + +// Example StrictDecoding shows how to detect whether there are keys in the +// TOML document that weren't decoded into the value given. This is useful +// for returning an error to the user if they've included extraneous fields +// in their configuration. +func Example_strictDecoding() { + var blob = ` +key1 = "value1" +key2 = "value2" +key3 = "value3" +` + type config struct { + Key1 string + Key3 string + } + + var conf config + md, err := Decode(blob, &conf) + if err != nil { + log.Fatal(err) + } + fmt.Printf("Undecoded keys: %q\n", md.Undecoded()) + // Output: + // Undecoded keys: ["key2"] +} + +// Example UnmarshalTOML shows how to implement a struct type that knows how to +// unmarshal itself. The struct must take full responsibility for mapping the +// values passed into the struct. The method may be used with interfaces in a +// struct in cases where the actual type is not known until the data is +// examined. +func Example_unmarshalTOML() { + + var blob = ` +[[parts]] +type = "valve" +id = "valve-1" +size = 1.2 +rating = 4 + +[[parts]] +type = "valve" +id = "valve-2" +size = 2.1 +rating = 5 + +[[parts]] +type = "pipe" +id = "pipe-1" +length = 2.1 +diameter = 12 + +[[parts]] +type = "cable" +id = "cable-1" +length = 12 +rating = 3.1 +` + o := &order{} + err := Unmarshal([]byte(blob), o) + if err != nil { + log.Fatal(err) + } + + fmt.Println(len(o.parts)) + + for _, part := range o.parts { + fmt.Println(part.Name()) + } + + // Code to implement UmarshalJSON. + + // type order struct { + // // NOTE `order.parts` is a private slice of type `part` which is an + // // interface and may only be loaded from toml using the + // // UnmarshalTOML() method of the Umarshaler interface. + // parts parts + // } + + // func (o *order) UnmarshalTOML(data interface{}) error { + + // // NOTE the example below contains detailed type casting to show how + // // the 'data' is retrieved. In operational use, a type cast wrapper + // // may be preferred e.g. + // // + // // func AsMap(v interface{}) (map[string]interface{}, error) { + // // return v.(map[string]interface{}) + // // } + // // + // // resulting in: + // // d, _ := AsMap(data) + // // + + // d, _ := data.(map[string]interface{}) + // parts, _ := d["parts"].([]map[string]interface{}) + + // for _, p := range parts { + + // typ, _ := p["type"].(string) + // id, _ := p["id"].(string) + + // // detect the type of part and handle each case + // switch p["type"] { + // case "valve": + + // size := float32(p["size"].(float64)) + // rating := int(p["rating"].(int64)) + + // valve := &valve{ + // Type: typ, + // ID: id, + // Size: size, + // Rating: rating, + // } + + // o.parts = append(o.parts, valve) + + // case "pipe": + + // length := float32(p["length"].(float64)) + // diameter := int(p["diameter"].(int64)) + + // pipe := &pipe{ + // Type: typ, + // ID: id, + // Length: length, + // Diameter: diameter, + // } + + // o.parts = append(o.parts, pipe) + + // case "cable": + + // length := int(p["length"].(int64)) + // rating := float32(p["rating"].(float64)) + + // cable := &cable{ + // Type: typ, + // ID: id, + // Length: length, + // Rating: rating, + // } + + // o.parts = append(o.parts, cable) + + // } + // } + + // return nil + // } + + // type parts []part + + // type part interface { + // Name() string + // } + + // type valve struct { + // Type string + // ID string + // Size float32 + // Rating int + // } + + // func (v *valve) Name() string { + // return fmt.Sprintf("VALVE: %s", v.ID) + // } + + // type pipe struct { + // Type string + // ID string + // Length float32 + // Diameter int + // } + + // func (p *pipe) Name() string { + // return fmt.Sprintf("PIPE: %s", p.ID) + // } + + // type cable struct { + // Type string + // ID string + // Length int + // Rating float32 + // } + + // func (c *cable) Name() string { + // return fmt.Sprintf("CABLE: %s", c.ID) + // } + + // Output: + // 4 + // VALVE: valve-1 + // VALVE: valve-2 + // PIPE: pipe-1 + // CABLE: cable-1 + +} + +type order struct { + // NOTE `order.parts` is a private slice of type `part` which is an + // interface and may only be loaded from toml using the UnmarshalTOML() + // method of the Umarshaler interface. + parts parts +} + +func (o *order) UnmarshalTOML(data interface{}) error { + + // NOTE the example below contains detailed type casting to show how + // the 'data' is retrieved. In operational use, a type cast wrapper + // may be preferred e.g. + // + // func AsMap(v interface{}) (map[string]interface{}, error) { + // return v.(map[string]interface{}) + // } + // + // resulting in: + // d, _ := AsMap(data) + // + + d, _ := data.(map[string]interface{}) + parts, _ := d["parts"].([]map[string]interface{}) + + for _, p := range parts { + + typ, _ := p["type"].(string) + id, _ := p["id"].(string) + + // detect the type of part and handle each case + switch p["type"] { + case "valve": + + size := float32(p["size"].(float64)) + rating := int(p["rating"].(int64)) + + valve := &valve{ + Type: typ, + ID: id, + Size: size, + Rating: rating, + } + + o.parts = append(o.parts, valve) + + case "pipe": + + length := float32(p["length"].(float64)) + diameter := int(p["diameter"].(int64)) + + pipe := &pipe{ + Type: typ, + ID: id, + Length: length, + Diameter: diameter, + } + + o.parts = append(o.parts, pipe) + + case "cable": + + length := int(p["length"].(int64)) + rating := float32(p["rating"].(float64)) + + cable := &cable{ + Type: typ, + ID: id, + Length: length, + Rating: rating, + } + + o.parts = append(o.parts, cable) + + } + } + + return nil +} + +type parts []part + +type part interface { + Name() string +} + +type valve struct { + Type string + ID string + Size float32 + Rating int +} + +func (v *valve) Name() string { + return fmt.Sprintf("VALVE: %s", v.ID) +} + +type pipe struct { + Type string + ID string + Length float32 + Diameter int +} + +func (p *pipe) Name() string { + return fmt.Sprintf("PIPE: %s", p.ID) +} + +type cable struct { + Type string + ID string + Length int + Rating float32 +} + +func (c *cable) Name() string { + return fmt.Sprintf("CABLE: %s", c.ID) +} diff --git a/vendor/github.com/BurntSushi/toml/encode_test.go b/vendor/github.com/BurntSushi/toml/encode_test.go new file mode 100644 index 0000000000000..673b7b0093ca7 --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/encode_test.go @@ -0,0 +1,615 @@ +package toml + +import ( + "bytes" + "fmt" + "log" + "net" + "testing" + "time" +) + +func TestEncodeRoundTrip(t *testing.T) { + type Config struct { + Age int + Cats []string + Pi float64 + Perfection []int + DOB time.Time + Ipaddress net.IP + } + + var inputs = Config{ + 13, + []string{"one", "two", "three"}, + 3.145, + []int{11, 2, 3, 4}, + time.Now(), + net.ParseIP("192.168.59.254"), + } + + var firstBuffer bytes.Buffer + e := NewEncoder(&firstBuffer) + err := e.Encode(inputs) + if err != nil { + t.Fatal(err) + } + var outputs Config + if _, err := Decode(firstBuffer.String(), &outputs); err != nil { + t.Logf("Could not decode:\n-----\n%s\n-----\n", + firstBuffer.String()) + t.Fatal(err) + } + + // could test each value individually, but I'm lazy + var secondBuffer bytes.Buffer + e2 := NewEncoder(&secondBuffer) + err = e2.Encode(outputs) + if err != nil { + t.Fatal(err) + } + if firstBuffer.String() != secondBuffer.String() { + t.Error( + firstBuffer.String(), + "\n\n is not identical to\n\n", + secondBuffer.String()) + } +} + +// XXX(burntsushi) +// I think these tests probably should be removed. They are good, but they +// ought to be obsolete by toml-test. +func TestEncode(t *testing.T) { + type Embedded struct { + Int int `toml:"_int"` + } + type NonStruct int + + date := time.Date(2014, 5, 11, 20, 30, 40, 0, time.FixedZone("IST", 3600)) + dateStr := "2014-05-11T19:30:40Z" + + tests := map[string]struct { + input interface{} + wantOutput string + wantError error + }{ + "bool field": { + input: struct { + BoolTrue bool + BoolFalse bool + }{true, false}, + wantOutput: "BoolTrue = true\nBoolFalse = false\n", + }, + "int fields": { + input: struct { + Int int + Int8 int8 + Int16 int16 + Int32 int32 + Int64 int64 + }{1, 2, 3, 4, 5}, + wantOutput: "Int = 1\nInt8 = 2\nInt16 = 3\nInt32 = 4\nInt64 = 5\n", + }, + "uint fields": { + input: struct { + Uint uint + Uint8 uint8 + Uint16 uint16 + Uint32 uint32 + Uint64 uint64 + }{1, 2, 3, 4, 5}, + wantOutput: "Uint = 1\nUint8 = 2\nUint16 = 3\nUint32 = 4" + + "\nUint64 = 5\n", + }, + "float fields": { + input: struct { + Float32 float32 + Float64 float64 + }{1.5, 2.5}, + wantOutput: "Float32 = 1.5\nFloat64 = 2.5\n", + }, + "string field": { + input: struct{ String string }{"foo"}, + wantOutput: "String = \"foo\"\n", + }, + "string field and unexported field": { + input: struct { + String string + unexported int + }{"foo", 0}, + wantOutput: "String = \"foo\"\n", + }, + "datetime field in UTC": { + input: struct{ Date time.Time }{date}, + wantOutput: fmt.Sprintf("Date = %s\n", dateStr), + }, + "datetime field as primitive": { + // Using a map here to fail if isStructOrMap() returns true for + // time.Time. + input: map[string]interface{}{ + "Date": date, + "Int": 1, + }, + wantOutput: fmt.Sprintf("Date = %s\nInt = 1\n", dateStr), + }, + "array fields": { + input: struct { + IntArray0 [0]int + IntArray3 [3]int + }{[0]int{}, [3]int{1, 2, 3}}, + wantOutput: "IntArray0 = []\nIntArray3 = [1, 2, 3]\n", + }, + "slice fields": { + input: struct{ IntSliceNil, IntSlice0, IntSlice3 []int }{ + nil, []int{}, []int{1, 2, 3}, + }, + wantOutput: "IntSlice0 = []\nIntSlice3 = [1, 2, 3]\n", + }, + "datetime slices": { + input: struct{ DatetimeSlice []time.Time }{ + []time.Time{date, date}, + }, + wantOutput: fmt.Sprintf("DatetimeSlice = [%s, %s]\n", + dateStr, dateStr), + }, + "nested arrays and slices": { + input: struct { + SliceOfArrays [][2]int + ArrayOfSlices [2][]int + SliceOfArraysOfSlices [][2][]int + ArrayOfSlicesOfArrays [2][][2]int + SliceOfMixedArrays [][2]interface{} + ArrayOfMixedSlices [2][]interface{} + }{ + [][2]int{{1, 2}, {3, 4}}, + [2][]int{{1, 2}, {3, 4}}, + [][2][]int{ + { + {1, 2}, {3, 4}, + }, + { + {5, 6}, {7, 8}, + }, + }, + [2][][2]int{ + { + {1, 2}, {3, 4}, + }, + { + {5, 6}, {7, 8}, + }, + }, + [][2]interface{}{ + {1, 2}, {"a", "b"}, + }, + [2][]interface{}{ + {1, 2}, {"a", "b"}, + }, + }, + wantOutput: `SliceOfArrays = [[1, 2], [3, 4]] +ArrayOfSlices = [[1, 2], [3, 4]] +SliceOfArraysOfSlices = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] +ArrayOfSlicesOfArrays = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] +SliceOfMixedArrays = [[1, 2], ["a", "b"]] +ArrayOfMixedSlices = [[1, 2], ["a", "b"]] +`, + }, + "empty slice": { + input: struct{ Empty []interface{} }{[]interface{}{}}, + wantOutput: "Empty = []\n", + }, + "(error) slice with element type mismatch (string and integer)": { + input: struct{ Mixed []interface{} }{[]interface{}{1, "a"}}, + wantError: errArrayMixedElementTypes, + }, + "(error) slice with element type mismatch (integer and float)": { + input: struct{ Mixed []interface{} }{[]interface{}{1, 2.5}}, + wantError: errArrayMixedElementTypes, + }, + "slice with elems of differing Go types, same TOML types": { + input: struct { + MixedInts []interface{} + MixedFloats []interface{} + }{ + []interface{}{ + int(1), int8(2), int16(3), int32(4), int64(5), + uint(1), uint8(2), uint16(3), uint32(4), uint64(5), + }, + []interface{}{float32(1.5), float64(2.5)}, + }, + wantOutput: "MixedInts = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]\n" + + "MixedFloats = [1.5, 2.5]\n", + }, + "(error) slice w/ element type mismatch (one is nested array)": { + input: struct{ Mixed []interface{} }{ + []interface{}{1, []interface{}{2}}, + }, + wantError: errArrayMixedElementTypes, + }, + "(error) slice with 1 nil element": { + input: struct{ NilElement1 []interface{} }{[]interface{}{nil}}, + wantError: errArrayNilElement, + }, + "(error) slice with 1 nil element (and other non-nil elements)": { + input: struct{ NilElement []interface{} }{ + []interface{}{1, nil}, + }, + wantError: errArrayNilElement, + }, + "simple map": { + input: map[string]int{"a": 1, "b": 2}, + wantOutput: "a = 1\nb = 2\n", + }, + "map with interface{} value type": { + input: map[string]interface{}{"a": 1, "b": "c"}, + wantOutput: "a = 1\nb = \"c\"\n", + }, + "map with interface{} value type, some of which are structs": { + input: map[string]interface{}{ + "a": struct{ Int int }{2}, + "b": 1, + }, + wantOutput: "b = 1\n\n[a]\n Int = 2\n", + }, + "nested map": { + input: map[string]map[string]int{ + "a": {"b": 1}, + "c": {"d": 2}, + }, + wantOutput: "[a]\n b = 1\n\n[c]\n d = 2\n", + }, + "nested struct": { + input: struct{ Struct struct{ Int int } }{ + struct{ Int int }{1}, + }, + wantOutput: "[Struct]\n Int = 1\n", + }, + "nested struct and non-struct field": { + input: struct { + Struct struct{ Int int } + Bool bool + }{struct{ Int int }{1}, true}, + wantOutput: "Bool = true\n\n[Struct]\n Int = 1\n", + }, + "2 nested structs": { + input: struct{ Struct1, Struct2 struct{ Int int } }{ + struct{ Int int }{1}, struct{ Int int }{2}, + }, + wantOutput: "[Struct1]\n Int = 1\n\n[Struct2]\n Int = 2\n", + }, + "deeply nested structs": { + input: struct { + Struct1, Struct2 struct{ Struct3 *struct{ Int int } } + }{ + struct{ Struct3 *struct{ Int int } }{&struct{ Int int }{1}}, + struct{ Struct3 *struct{ Int int } }{nil}, + }, + wantOutput: "[Struct1]\n [Struct1.Struct3]\n Int = 1" + + "\n\n[Struct2]\n", + }, + "nested struct with nil struct elem": { + input: struct { + Struct struct{ Inner *struct{ Int int } } + }{ + struct{ Inner *struct{ Int int } }{nil}, + }, + wantOutput: "[Struct]\n", + }, + "nested struct with no fields": { + input: struct { + Struct struct{ Inner struct{} } + }{ + struct{ Inner struct{} }{struct{}{}}, + }, + wantOutput: "[Struct]\n [Struct.Inner]\n", + }, + "struct with tags": { + input: struct { + Struct struct { + Int int `toml:"_int"` + } `toml:"_struct"` + Bool bool `toml:"_bool"` + }{ + struct { + Int int `toml:"_int"` + }{1}, true, + }, + wantOutput: "_bool = true\n\n[_struct]\n _int = 1\n", + }, + "embedded struct": { + input: struct{ Embedded }{Embedded{1}}, + wantOutput: "_int = 1\n", + }, + "embedded *struct": { + input: struct{ *Embedded }{&Embedded{1}}, + wantOutput: "_int = 1\n", + }, + "nested embedded struct": { + input: struct { + Struct struct{ Embedded } `toml:"_struct"` + }{struct{ Embedded }{Embedded{1}}}, + wantOutput: "[_struct]\n _int = 1\n", + }, + "nested embedded *struct": { + input: struct { + Struct struct{ *Embedded } `toml:"_struct"` + }{struct{ *Embedded }{&Embedded{1}}}, + wantOutput: "[_struct]\n _int = 1\n", + }, + "embedded non-struct": { + input: struct{ NonStruct }{5}, + wantOutput: "NonStruct = 5\n", + }, + "array of tables": { + input: struct { + Structs []*struct{ Int int } `toml:"struct"` + }{ + []*struct{ Int int }{{1}, {3}}, + }, + wantOutput: "[[struct]]\n Int = 1\n\n[[struct]]\n Int = 3\n", + }, + "array of tables order": { + input: map[string]interface{}{ + "map": map[string]interface{}{ + "zero": 5, + "arr": []map[string]int{ + { + "friend": 5, + }, + }, + }, + }, + wantOutput: "[map]\n zero = 5\n\n [[map.arr]]\n friend = 5\n", + }, + "(error) top-level slice": { + input: []struct{ Int int }{{1}, {2}, {3}}, + wantError: errNoKey, + }, + "(error) slice of slice": { + input: struct { + Slices [][]struct{ Int int } + }{ + [][]struct{ Int int }{{{1}}, {{2}}, {{3}}}, + }, + wantError: errArrayNoTable, + }, + "(error) map no string key": { + input: map[int]string{1: ""}, + wantError: errNonString, + }, + "(error) empty key name": { + input: map[string]int{"": 1}, + wantError: errAnything, + }, + "(error) empty map name": { + input: map[string]interface{}{ + "": map[string]int{"v": 1}, + }, + wantError: errAnything, + }, + } + for label, test := range tests { + encodeExpected(t, label, test.input, test.wantOutput, test.wantError) + } +} + +func TestEncodeNestedTableArrays(t *testing.T) { + type song struct { + Name string `toml:"name"` + } + type album struct { + Name string `toml:"name"` + Songs []song `toml:"songs"` + } + type springsteen struct { + Albums []album `toml:"albums"` + } + value := springsteen{ + []album{ + {"Born to Run", + []song{{"Jungleland"}, {"Meeting Across the River"}}}, + {"Born in the USA", + []song{{"Glory Days"}, {"Dancing in the Dark"}}}, + }, + } + expected := `[[albums]] + name = "Born to Run" + + [[albums.songs]] + name = "Jungleland" + + [[albums.songs]] + name = "Meeting Across the River" + +[[albums]] + name = "Born in the USA" + + [[albums.songs]] + name = "Glory Days" + + [[albums.songs]] + name = "Dancing in the Dark" +` + encodeExpected(t, "nested table arrays", value, expected, nil) +} + +func TestEncodeArrayHashWithNormalHashOrder(t *testing.T) { + type Alpha struct { + V int + } + type Beta struct { + V int + } + type Conf struct { + V int + A Alpha + B []Beta + } + + val := Conf{ + V: 1, + A: Alpha{2}, + B: []Beta{{3}}, + } + expected := "V = 1\n\n[A]\n V = 2\n\n[[B]]\n V = 3\n" + encodeExpected(t, "array hash with normal hash order", val, expected, nil) +} + +func TestEncodeWithOmitEmpty(t *testing.T) { + type simple struct { + Bool bool `toml:"bool,omitempty"` + String string `toml:"string,omitempty"` + Array [0]byte `toml:"array,omitempty"` + Slice []int `toml:"slice,omitempty"` + Map map[string]string `toml:"map,omitempty"` + } + + var v simple + encodeExpected(t, "fields with omitempty are omitted when empty", v, "", nil) + v = simple{ + Bool: true, + String: " ", + Slice: []int{2, 3, 4}, + Map: map[string]string{"foo": "bar"}, + } + expected := `bool = true +string = " " +slice = [2, 3, 4] + +[map] + foo = "bar" +` + encodeExpected(t, "fields with omitempty are not omitted when non-empty", + v, expected, nil) +} + +func TestEncodeWithOmitZero(t *testing.T) { + type simple struct { + Number int `toml:"number,omitzero"` + Real float64 `toml:"real,omitzero"` + Unsigned uint `toml:"unsigned,omitzero"` + } + + value := simple{0, 0.0, uint(0)} + expected := "" + + encodeExpected(t, "simple with omitzero, all zero", value, expected, nil) + + value.Number = 10 + value.Real = 20 + value.Unsigned = 5 + expected = `number = 10 +real = 20.0 +unsigned = 5 +` + encodeExpected(t, "simple with omitzero, non-zero", value, expected, nil) +} + +func TestEncodeOmitemptyWithEmptyName(t *testing.T) { + type simple struct { + S []int `toml:",omitempty"` + } + v := simple{[]int{1, 2, 3}} + expected := "S = [1, 2, 3]\n" + encodeExpected(t, "simple with omitempty, no name, non-empty field", + v, expected, nil) +} + +func TestEncodeAnonymousStruct(t *testing.T) { + type Inner struct{ N int } + type Outer0 struct{ Inner } + type Outer1 struct { + Inner `toml:"inner"` + } + + v0 := Outer0{Inner{3}} + expected := "N = 3\n" + encodeExpected(t, "embedded anonymous untagged struct", v0, expected, nil) + + v1 := Outer1{Inner{3}} + expected = "[inner]\n N = 3\n" + encodeExpected(t, "embedded anonymous tagged struct", v1, expected, nil) +} + +func TestEncodeAnonymousStructPointerField(t *testing.T) { + type Inner struct{ N int } + type Outer0 struct{ *Inner } + type Outer1 struct { + *Inner `toml:"inner"` + } + + v0 := Outer0{} + expected := "" + encodeExpected(t, "nil anonymous untagged struct pointer field", v0, expected, nil) + + v0 = Outer0{&Inner{3}} + expected = "N = 3\n" + encodeExpected(t, "non-nil anonymous untagged struct pointer field", v0, expected, nil) + + v1 := Outer1{} + expected = "" + encodeExpected(t, "nil anonymous tagged struct pointer field", v1, expected, nil) + + v1 = Outer1{&Inner{3}} + expected = "[inner]\n N = 3\n" + encodeExpected(t, "non-nil anonymous tagged struct pointer field", v1, expected, nil) +} + +func TestEncodeIgnoredFields(t *testing.T) { + type simple struct { + Number int `toml:"-"` + } + value := simple{} + expected := "" + encodeExpected(t, "ignored field", value, expected, nil) +} + +func encodeExpected( + t *testing.T, label string, val interface{}, wantStr string, wantErr error, +) { + var buf bytes.Buffer + enc := NewEncoder(&buf) + err := enc.Encode(val) + if err != wantErr { + if wantErr != nil { + if wantErr == errAnything && err != nil { + return + } + t.Errorf("%s: want Encode error %v, got %v", label, wantErr, err) + } else { + t.Errorf("%s: Encode failed: %s", label, err) + } + } + if err != nil { + return + } + if got := buf.String(); wantStr != got { + t.Errorf("%s: want\n-----\n%q\n-----\nbut got\n-----\n%q\n-----\n", + label, wantStr, got) + } +} + +func ExampleEncoder_Encode() { + date, _ := time.Parse(time.RFC822, "14 Mar 10 18:00 UTC") + var config = map[string]interface{}{ + "date": date, + "counts": []int{1, 1, 2, 3, 5, 8}, + "hash": map[string]string{ + "key1": "val1", + "key2": "val2", + }, + } + buf := new(bytes.Buffer) + if err := NewEncoder(buf).Encode(config); err != nil { + log.Fatal(err) + } + fmt.Println(buf.String()) + + // Output: + // counts = [1, 1, 2, 3, 5, 8] + // date = 2010-03-14T18:00:00Z + // + // [hash] + // key1 = "val1" + // key2 = "val2" +} diff --git a/vendor/github.com/BurntSushi/toml/session.vim b/vendor/github.com/BurntSushi/toml/session.vim new file mode 100644 index 0000000000000..562164be06030 --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/session.vim @@ -0,0 +1 @@ +au BufWritePost *.go silent!make tags > /dev/null 2>&1 diff --git a/vendor/github.com/apache/thrift/.clang-format b/vendor/github.com/apache/thrift/.clang-format new file mode 100644 index 0000000000000..a62eef8576c14 --- /dev/null +++ b/vendor/github.com/apache/thrift/.clang-format @@ -0,0 +1,56 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +ConstructorInitializerIndentWidth: 2 +AlignEscapedNewlinesLeft: false +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AlwaysBreakTemplateDeclarations: true +AlwaysBreakBeforeMultilineStrings: true +BreakBeforeBinaryOperators: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BinPackParameters: false +ColumnLimit: 100 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +DerivePointerAlignment: false +IndentCaseLabels: false +IndentWrappedFunctionNames: false +IndentFunctionDeclarationAfterType: false +MaxEmptyLinesToKeep: 1 +KeepEmptyLinesAtTheStartOfBlocks: true +NamespaceIndentation: None +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 190 +PenaltyBreakComment: 300 +PenaltyBreakString: 10000 +PenaltyBreakFirstLessLess: 120 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 1200 +PointerAlignment: Left +SpacesBeforeTrailingComments: 1 +Cpp11BracedListStyle: true +Standard: Auto +IndentWidth: 2 +TabWidth: 4 +UseTab: Never +BreakBeforeBraces: Attach +SpacesInParentheses: false +SpacesInAngles: false +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +SpaceBeforeParens: ControlStatements +DisableFormat: false +... + diff --git a/vendor/github.com/apache/thrift/.dockerignore b/vendor/github.com/apache/thrift/.dockerignore new file mode 100644 index 0000000000000..2d2ecd68da83a --- /dev/null +++ b/vendor/github.com/apache/thrift/.dockerignore @@ -0,0 +1 @@ +.git/ diff --git a/vendor/github.com/apache/thrift/.editorconfig b/vendor/github.com/apache/thrift/.editorconfig new file mode 100644 index 0000000000000..3611762c8a3d9 --- /dev/null +++ b/vendor/github.com/apache/thrift/.editorconfig @@ -0,0 +1,112 @@ +# +## Licensed to the Apache Software Foundation (ASF) under one +## or more contributor license agreements. See the NOTICE file +## distributed with this work for additional information +## regarding copyright ownership. The ASF licenses this file +## to you under the Apache License, Version 2.0 (the +## "License"); you may not use this file except in compliance +## with the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, +## software distributed under the License is distributed on an +## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +## KIND, either express or implied. See the License for the +## specific language governing permissions and limitations +## under the License. +## +# + +# EditorConfig: http://editorconfig.org +# see doc/coding_standards.md + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# ActionScript +# [*.as] + +# C +# [*.c] + +# C++ +[*.cpp] +indent_style = space +indent_size = 2 + +# C-Sharp +# [*.cs] + +# D +# [*.d] + +# Erlang +# [*.erl] + +# Go-lang +[*.go] +indent_style = tab +indent_size = 8 + +# C header files +# [*.h] + +# Haskell +# [*.hs] + +# Haxe +# [*.hx] + +# Java +# [*.java] + +# Javascript +[*.js] +indent_style = space +indent_size = 2 + +# JSON +[*.json] +indent_style = space +indent_size = 2 + +# Lua +# [*.lua] + +[*.markdown] +indent_style = space +trim_trailing_whitespace = false + +[*.md] +indent_style = space +trim_trailing_whitespace = false + +# OCaml +# [*.ml] + +# Delphi Pascal +# [*.pas] + +# PHP +# [*.php] + +# Perl +# [*.pm] + +# Python +# [*.py] + +# Ruby +# [*.rb] + +# Typescript +# [*.ts] + +# XML +# [*.xml] diff --git a/vendor/github.com/apache/thrift/.gitattributes b/vendor/github.com/apache/thrift/.gitattributes new file mode 100644 index 0000000000000..176a458f94e0e --- /dev/null +++ b/vendor/github.com/apache/thrift/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/vendor/github.com/apache/thrift/.gitignore b/vendor/github.com/apache/thrift/.gitignore new file mode 100644 index 0000000000000..140c93b003fa7 --- /dev/null +++ b/vendor/github.com/apache/thrift/.gitignore @@ -0,0 +1,326 @@ +# generic ignores +*.la +*.lo +*.o +*.deps +*.dirstamp +*.libs +*.log +*.trs +*.suo +*.pyc +*.cache +*.user +*.ipch +*.sdf +*.jar +*.exe +*.dll +*_ReSharper* +*.opensdf +*.swp +*.hi +*~ + +.*project +junit*.properties +.idea +gen-* +Makefile +Makefile.in +aclocal.m4 +acinclude.m4 +autom4te.cache +cmake-* +node_modules +compile +test-driver +erl_crash.dump + +.sonar +.DS_Store +.svn +.vagrant + +/contrib/.vagrant/ +/aclocal/libtool.m4 +/aclocal/lt*.m4 +/autoscan.log +/autoscan-*.log +/cmake_* +/compiler/cpp/compiler.VC.db +/compiler/cpp/compiler.VC.VC.opendb +/compiler/cpp/test/plugin/t_cpp_generator.cc +/compiler/cpp/src/thrift/plugin/plugin_constants.cpp +/compiler/cpp/src/thrift/plugin/plugin_constants.h +/compiler/cpp/src/thrift/plugin/plugin_types.cpp +/compiler/cpp/src/thrift/plugin/plugin_types.h +/compiler/cpp/test/*test +/compiler/cpp/test/thrift-gen-* +/compiler/cpp/src/thrift/thrift-bootstrap +/compiler/cpp/src/thrift/plugin/gen.stamp +/compiler/cpp/Debug +/compiler/cpp/Release +/compiler/cpp/src/thrift/libparse.a +/compiler/cpp/src/thrift/thriftl.cc +/compiler/cpp/src/thrift/thrifty.cc +/compiler/cpp/src/thrift/thrifty.hh +/compiler/cpp/src/thrift/windows/version.h +/compiler/cpp/thrift +/compiler/cpp/thriftl.cc +/compiler/cpp/thrifty.cc +/compiler/cpp/lex.yythriftl.cc +/compiler/cpp/thrifty.h +/compiler/cpp/thrifty.hh +/compiler/cpp/src/thrift/version.h +/config.* +/configure +/configure.lineno +/configure.scan +/contrib/fb303/config.cache +/contrib/fb303/config.log +/contrib/fb303/config.status +/contrib/fb303/configure +/contrib/fb303/cpp/libfb303.a +/contrib/fb303/java/build/ +/contrib/fb303/py/build/ +/contrib/fb303/py/fb303/FacebookService-remote +/contrib/fb303/py/fb303/FacebookService.py +/contrib/fb303/py/fb303/__init__.py +/contrib/fb303/py/fb303/constants.py +/contrib/fb303/py/fb303/ttypes.py +/depcomp +/install-sh +/lib/cpp/Debug/ +/lib/cpp/Debug-mt/ +/lib/cpp/Release/ +/lib/cpp/Release-mt/ +/lib/cpp/src/thrift/qt/moc_TQTcpServer.cpp +/lib/cpp/src/thrift/qt/moc__TQTcpServer.cpp +/lib/cpp/src/thrift/config.h +/lib/cpp/src/thrift/stamp-h2 +/lib/cpp/test/Benchmark +/lib/cpp/test/AllProtocolsTest +/lib/cpp/test/DebugProtoTest +/lib/cpp/test/DenseProtoTest +/lib/cpp/test/EnumTest +/lib/cpp/test/JSONProtoTest +/lib/cpp/test/OptionalRequiredTest +/lib/cpp/test/SecurityTest +/lib/cpp/test/SpecializationTest +/lib/cpp/test/ReflectionTest +/lib/cpp/test/RecursiveTest +/lib/cpp/test/TFDTransportTest +/lib/cpp/test/TFileTransportTest +/lib/cpp/test/TInterruptTest +/lib/cpp/test/TNonblockingServerTest +/lib/cpp/test/TPipedTransportTest +/lib/cpp/test/TServerIntegrationTest +/lib/cpp/test/TSocketInterruptTest +/lib/cpp/test/TransportTest +/lib/cpp/test/UnitTests +/lib/cpp/test/ZlibTest +/lib/cpp/test/OpenSSLManualInitTest +/lib/cpp/test/concurrency_test +/lib/cpp/test/link_test +/lib/cpp/test/processor_test +/lib/cpp/test/tests.xml +/lib/cpp/concurrency_test +/lib/cpp/*.pc +/lib/cpp/x64/Debug/ +/lib/cpp/x64/Debug-mt/ +/lib/cpp/x64/Release +/lib/cpp/x64/Release-mt +/lib/c_glib/*.gcda +/lib/c_glib/*.gcno +/lib/c_glib/*.loT +/lib/c_glib/src/thrift/config.h +/lib/c_glib/src/thrift/stamp-h3 +/lib/c_glib/test/*.gcno +/lib/c_glib/test/testwrapper.sh +/lib/c_glib/test/testwrapper-test* +/lib/c_glib/test/testapplicationexception +/lib/c_glib/test/testbinaryprotocol +/lib/c_glib/test/testcompactprotocol +/lib/c_glib/test/testbufferedtransport +/lib/c_glib/test/testcontainertest +/lib/c_glib/test/testdebugproto +/lib/c_glib/test/testfdtransport +/lib/c_glib/test/testframedtransport +/lib/c_glib/test/testmemorybuffer +/lib/c_glib/test/testoptionalrequired +/lib/c_glib/test/testsimpleserver +/lib/c_glib/test/teststruct +/lib/c_glib/test/testthrifttest +/lib/c_glib/test/testthrifttestclient +/lib/c_glib/test/testtransportsocket +/lib/c_glib/test/testserialization +/lib/c_glib/thriftc.pc +/lib/c_glib/thrift_c_glib.pc +/lib/csharp/**/bin/ +/lib/csharp/**/obj/ +/lib/csharp/src/packages +/lib/d/test/*.pem +/lib/d/libthriftd*.a +/lib/d/test/async_test +/lib/d/test/client_pool_test +/lib/d/test/serialization_benchmark +/lib/d/test/stress_test_server +/lib/d/test/thrift_test_client +/lib/d/test/thrift_test_server +/lib/d/test/transport_test +/lib/d/unittest/ +/lib/dart/coverage +/lib/dart/**/.packages +/lib/dart/**/packages +/lib/dart/**/.pub/ +/lib/dart/**/pubspec.lock +/lib/delphi/src/*.dcu +/lib/delphi/test/*.identcache +/lib/delphi/test/*.local +/lib/delphi/test/*.dcu +/lib/delphi/test/*.2007 +/lib/delphi/test/*.dproj +/lib/delphi/test/*.dproj +/lib/delphi/test/codegen/*.bat +/lib/delphi/test/skip/*.local +/lib/delphi/test/skip/*.identcache +/lib/delphi/test/skip/*.identcache +/lib/delphi/test/skip/*.dproj +/lib/delphi/test/skip/*.dproj +/lib/delphi/test/skip/*.2007 +/lib/delphi/test/serializer/*.identcache +/lib/delphi/test/serializer/*.dproj +/lib/delphi/test/serializer/*.local +/lib/delphi/test/serializer/*.2007 +/lib/delphi/test/serializer/*.dcu +/lib/delphi/test/multiplexed/*.dproj +/lib/delphi/test/multiplexed/*.2007 +/lib/delphi/test/multiplexed/*.local +/lib/delphi/test/multiplexed/*.identcache +/lib/delphi/test/multiplexed/*.dcu +/lib/delphi/test/typeregistry/*.2007 +/lib/delphi/test/typeregistry/*.dproj +/lib/delphi/test/typeregistry/*.identcache +/lib/delphi/test/typeregistry/*.local +/lib/delphi/test/typeregistry/*.dcu +/lib/erl/.generated +/lib/erl/.eunit +/lib/erl/ebin +/lib/erl/deps/ +/lib/erl/src/thrift.app.src +/lib/erl/test/*.hrl +/lib/erl/test/*.beam +/lib/haxe/test/bin +/lib/hs/dist +/lib/java/build +/lib/js/test/build +/lib/nodejs/coverage +/lib/nodejs/node_modules/ +/lib/perl/MANIFEST +/lib/perl/MYMETA.json +/lib/perl/MYMETA.yml +/lib/perl/Makefile-perl.mk +/lib/perl/blib +/lib/perl/pm_to_blib +/lib/py/build +/lib/py/thrift.egg-info/ +/lib/rb/Gemfile.lock +/lib/rb/debug_proto_test +/lib/rb/.config +/lib/rb/ext/conftest.dSYM/ +/lib/rb/ext/mkmf.log +/lib/rb/ext/thrift_native.bundle +/lib/rb/ext/thrift_native.so +/lib/rb/test/ +/lib/rb/thrift-*.gem +/lib/php/src/ext/thrift_protocol/Makefile.* +/lib/php/src/ext/thrift_protocol/build/ +/lib/php/src/ext/thrift_protocol/config.* +/lib/php/src/ext/thrift_protocol/configure +/lib/php/src/ext/thrift_protocol/configure.in +/lib/php/src/ext/thrift_protocol/install-sh +/lib/php/src/ext/thrift_protocol/libtool +/lib/php/src/ext/thrift_protocol/ltmain.sh +/lib/php/src/ext/thrift_protocol/missing +/lib/php/src/ext/thrift_protocol/mkinstalldirs +/lib/php/src/ext/thrift_protocol/modules/ +/lib/php/src/ext/thrift_protocol/php_thrift_protocol.lo +/lib/php/src/ext/thrift_protocol/run-tests.php +/lib/php/src/ext/thrift_protocol/thrift_protocol.la +/lib/php/src/ext/thrift_protocol/tmp-php.ini +/lib/php/src/packages/ +/lib/php/test/TEST-*.xml +/lib/php/test/packages/ +/lib/py/dist/ +/lib/erl/logs/ +/lib/go/test/gopath/ +/lib/go/test/ThriftTest.thrift +/libtool +/ltmain.sh +/missing +/node_modules/ +/stamp-h1 +/test/features/results.json +/test/results.json +/test/c_glib/test_client +/test/c_glib/test_server +/test/cpp/StressTest +/test/cpp/StressTestNonBlocking +/test/cpp/TestClient +/test/cpp/TestServer +/test/dart/**/.packages +/test/dart/**/packages +/test/dart/**/.pub/ +/test/dart/**/pubspec.lock +/test/log/ +/test/test.log +/test/erl/.generated +/test/erl/ebin +/test/go/bin/ +/test/go/ThriftTest.thrift +/test/go/gopath +/test/go/pkg/ +/test/go/src/code.google.com/ +/test/go/src/github.com/golang/ +/test/go/src/gen/ +/test/go/src/thrift +/test/haxe/bin +/test/hs/TestClient +/test/hs/TestServer +/test/py.twisted/_trial_temp/ +/test/rb/Gemfile.lock +/tutorial/cpp/TutorialClient +/tutorial/cpp/TutorialServer +/tutorial/c_glib/tutorial_client +/tutorial/c_glib/tutorial_server +/tutorial/csharp/CsharpServer/obj +/tutorial/csharp/CsharpServer/bin +/tutorial/csharp/CsharpClient/obj +/tutorial/csharp/CsharpClient/bin +/tutorial/d/async_client +/tutorial/d/client +/tutorial/d/server +/tutorial/dart/**/.packages +/tutorial/dart/**/packages +/tutorial/dart/**/.pub/ +/tutorial/dart/**/pubspec.lock +/tutorial/delphi/*.dsk +/tutorial/delphi/*.local +/tutorial/delphi/*.tvsconfig +/tutorial/delphi/DelphiClient/dcu +/tutorial/delphi/DelphiServer/dcu +/tutorial/delphi/DelphiClient/*.local +/tutorial/delphi/DelphiClient/*.identcache +/tutorial/delphi/DelphiServer/*.identcache +/tutorial/delphi/DelphiServer/*.local +/tutorial/go/go-tutorial +/tutorial/go/calculator-remote +/tutorial/go/src/shared +/tutorial/go/src/tutorial +/tutorial/go/src/git.apache.org +/tutorial/haxe/bin +/tutorial/hs/dist/ +/tutorial/java/build/ +/tutorial/js/build/ +/ylwrap diff --git a/vendor/github.com/apache/thrift/.travis.yml b/vendor/github.com/apache/thrift/.travis.yml new file mode 100644 index 0000000000000..81a88c3ce0da7 --- /dev/null +++ b/vendor/github.com/apache/thrift/.travis.yml @@ -0,0 +1,199 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# build Apache Thrift on Travis CI - https://travis-ci.org/ + +sudo: required +dist: trusty + +services: + - docker + +install: + - (travis_wait ./build/docker/check_unmodified.sh $DISTRO && touch .unmodified) || true + - if [ ! -f .unmodified ]; then travis_retry travis_wait docker build -q -t thrift-build:$DISTRO build/docker/$DISTRO; fi + +script: + - docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build:$DISTRO build/docker/scripts/$SCRIPT $BUILD_ARG + +env: + global: + - TEST_NAME="" + - SCRIPT="cmake.sh" + - BUILD_ARG="" + - BUILD_ENV="-e CC=clang -e CXX=clang++" + - DISTRO=ubuntu + - BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds + + matrix: + - TEST_NAME="Cross Language Tests (Binary and Header Protocols)" + SCRIPT="cross-test.sh" + BUILD_ARG="-'(binary|header)'" + BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4" + + - TEST_NAME="Cross Language Tests (Debian) (Binary and Header Protocols)" + SCRIPT="cross-test.sh" + BUILD_ARG="-'(binary|header)'" + BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4" + DISTRO=debian + + - TEST_NAME="Cross Language Tests (Compact and JSON Protocols)" + SCRIPT="cross-test.sh" + BUILD_ARG="-'(compact|json)'" + BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4" + + - TEST_NAME="Cross Language Tests (Debian) (Compact and JSON Protocols)" + SCRIPT="cross-test.sh" + BUILD_ARG="-'(compact|json)'" + BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4" + DISTRO=debian + + # TODO: Remove them once migrated to CMake + # Autotools builds + - TEST_NAME="C C++ C# D Erlang Haxe Go (automake)" + SCRIPT="autotools.sh" + BUILD_ARG="--without-dart --without-haskell --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby" + + - TEST_NAME="C C++ - GCC (automake)" + SCRIPT="autotools.sh" + BUILD_ARG="--without-csharp --without-java --without-erlang --without-nodejs --without-lua --without-python --without-perl --without-php --without-php_extension --without-dart --without-ruby --without-haskell --without-go --without-haxe --without-d" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="Java Lua PHP Ruby Dart (automake)" + SCRIPT="autotools.sh" + BUILD_ARG="--without-cpp --without-haskell --without-c_glib --without-csharp --without-d --without-erlang --without-go --without-haxe --without-nodejs --without-python --without-perl" + + # These are flaky (due to cabal and npm network/server failures) and also have lengthy output + - TEST_NAME="Haskell Node.js Python Perl (automake)" + SCRIPT="autotools.sh" + BUILD_ARG="--without-cpp --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-php --without-php_extension --without-ruby" + + # CMake build + - TEST_NAME="All" + + - TEST_NAME="All (Debian)" + DISTRO=debian + + - TEST_NAME="C C++ - GCC" + BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS" + BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="C++ (Boost Thread)" + BUILD_LIBS="CPP TESTING TUTORIALS" + BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + + - TEST_NAME="C++ (Boost Thread - GCC)" + BUILD_LIBS="CPP TESTING TUTORIALS" + BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="C++ (Std Thread)" + BUILD_LIBS="CPP TESTING TUTORIALS" + BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + + - TEST_NAME="C++ (Std Thread - GCC)" + BUILD_LIBS="CPP TESTING TUTORIALS" + BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="Compiler (mingw)" + BUILD_LIBS="" + BUILD_ARG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF" + BUILD_ENV="" + + - TEST_NAME="All - GCC (CentOS)" + BUILD_ENV="-e CC=gcc -e CXX=g++" + DISTRO=centos + + - TEST_NAME="C C++ - Clang (CentOS)" + BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS" + BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + DISTRO=centos + + - TEST_NAME="Python 2.6 (CentOS 6)" + BUILD_LIBS="PYTHON TESTING TUTORIALS" + BUILD_ARG="-DWITH_PYTHON=ON -DWITH_CPP=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF" + BUILD_ENV="-e CC=gcc -e CXX=g++" + DISTRO=centos6 + + # Distribution + - TEST_NAME="make dist" + SCRIPT="make-dist.sh" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="Debian Packages" + SCRIPT="dpkg.sh" + BUILD_ENV="-e CC=gcc -e CXX=g++" + + - TEST_NAME="make dist (Debian)" + SCRIPT="make-dist.sh" + BUILD_ENV="-e CC=gcc -e CXX=g++" + DISTRO=debian + + - TEST_NAME="Debian Packages (Debian)" + SCRIPT="dpkg.sh" + BUILD_ENV="-e CC=gcc -e CXX=g++" + DISTRO=debian + +matrix: + include: + # QA jobs for code analytics and metrics + # + # C/C++ static code analysis with cppcheck + # add --error-exitcode=1 to --enable=all as soon as everything is fixed + # + # Python code style check with flake8 + # + # search for TODO etc within source tree + # some statistics about the code base + # some info about the build machine + - env: TEST_NAME="cppcheck, flake8, TODO FIXME HACK, LoC and system info" + install: + - travis_retry sudo apt-get update + - travis_retry sudo apt-get install -ym cppcheck sloccount python-flake8 + script: + # Compiler cppcheck (All) + - cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src + # C++ cppcheck (All) + - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp + # C Glib cppcheck (All) + - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib + # Silent error checks + - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src + - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp + - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib + # Python code style + - flake8 --ignore=E501 lib/py + - flake8 tutorial/py + - flake8 --ignore=E501 test/py + - flake8 test/py.twisted + - flake8 test/py.tornado + - flake8 --ignore=E501 test/test.py + - flake8 --ignore=E501 test/crossrunner + - flake8 test/features + # TODO etc + - grep -r TODO * + - grep -r FIXME * + - grep -r HACK * + # LoC + - sloccount . + # System Info + - dpkg -l + - uname -a diff --git a/vendor/github.com/apache/thrift/CHANGES b/vendor/github.com/apache/thrift/CHANGES new file mode 100644 index 0000000000000..7b674d6f65862 --- /dev/null +++ b/vendor/github.com/apache/thrift/CHANGES @@ -0,0 +1,2366 @@ +Apache Thrift Changelog + +Thrift 0.10.0 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1840] - Thrift Generated Code Causes Global Variable Leaks + * [THRIFT-1828] - moc_TQTcpServer.cpp was removed from source tree but is in thrift-0.9.0.tar.gz + * [THRIFT-1790] - cocoa: Duplicate interface definition error + * [THRIFT-1776] - TPipeServer should implement "listen", so that TServerEventHandler preServe will work right + * [THRIFT-1351] - Compiler does not care about binary strings + * [THRIFT-1229] - Python fastbinary.c can not handle unicode as generated python code + * [THRIFT-749] - C++ TBufferedTransports do not flush their buffers on delete + * [THRIFT-747] - C++ TSocket->close calls shutdown breaking forked parent process + * [THRIFT-732] - server exits abnormally when client calls send_xxx function without calling recv_xxx function + * [THRIFT-3942] - TSSLSocket does not honor send and receive timeouts + * [THRIFT-3941] - WinXP version of thrift_poll() relies on undefined behavior by passing a destructed variable to select() + * [THRIFT-3940] - Visual Studio project file for compiler is broken + * [THRIFT-3943] - Coverity Scan identified some high severity defects + * [THRIFT-3929] - PHP "nsglobal" Option Results in Syntax Error in Generated Code (Trailing Backslash) + * [THRIFT-3936] - Cannot compile 0.10.0 development tip with VS2013 and earlier (snprintf, uint32_t) + * [THRIFT-3935] - Incorrect skipping of map and set + * [THRIFT-3920] - Ruby: Ensuring that HTTP failures will clear the http transport outbuf var + * [THRIFT-3919] - C# TTLSServerSocket does not use clientTimeout + * [THRIFT-3917] - Check backports.ssl_match_hostname module version + * [THRIFT-3909] - Fix c_glib static lib CMake build + * [THRIFT-3904] - Typo in node tutorial leads to wrong transport being used + * [THRIFT-3848] - As an implementer of a perl socket server, I do not want to have to remember to ignore SIGCHLD for it to work properly + * [THRIFT-3844] - thrift_protocol cannot compile in 7.0.7 + * [THRIFT-3843] - integer issues with Haxe PHP targets cause ZigZag encoding to fail + * [THRIFT-3842] - Dart generates incorrect code for a const struct + * [THRIFT-3841] - dart compact protocol incorrectly serializes/deserialized doubles + * [THRIFT-3708] - NameError: global name 'TProtocol' is not defined + * [THRIFT-3704] - "TConnectedClient died: Could not refill buffer" message shown when using HTTP Server + * [THRIFT-3678] - Fix javadoc errors on JDK 8 + * [THRIFT-3014] - AppVeyor support + * [THRIFT-2994] - Node.js TJSONProtocol cannot be used for object serialization. + * [THRIFT-2974] - writeToParcel throws NPE for optional enum fields + * [THRIFT-2948] - Python TJSONProtocol doesn't handle structs with binary fields containing invalid unicode. + * [THRIFT-2845] - ChildService.Plo: No such file or directory + * [THRIFT-3276] - Binary data does not decode correctly using the TJSONProtocol when the base64 encoded data is padded. + * [THRIFT-3253] - Using latest version of D gives deprecation notices + * [THRIFT-2883] - TTwisted.py, during ConnectionLost processing: exceptions.RuntimeError: dictionary changed size during iteration + * [THRIFT-2019] - Writing on a disconnected socket on Mac causes SIG PIPE + * [THRIFT-2020] - Thrift library has some empty files that haven't really been deleted + * [THRIFT-2049] - Go compiler doesn't build on native Windows + * [THRIFT-2024] - TServer.cpp warns on 64-bit platforms about truncating an rlim_t into an int + * [THRIFT-2023] - gettimeofday implementation on Windows errors when no time zone is passed in. + * [THRIFT-2022] - CoB and dense code generation still uses TR1 bind, even though that doesn't work with clang + * [THRIFT-2027] - Minor 64-bit and NOMINMAX issues in C++ library + * [THRIFT-2156] - TServerSocket::listen() is throwing exceptions with misleading information + * [THRIFT-2154] - Missing #deepCopy should return T + * [THRIFT-3157] - TBase signature should be TBase, F extends TFieldIdEnum> + * [THRIFT-3156] - Node TLS: server executes processing logic two full times + * [THRIFT-3154] - tutorial/py.tornado throw EOF exception + * [THRIFT-3063] - C++ build -Wunused-parameter warnings on processor_test, TransportTest + * [THRIFT-3056] - Add string/collection length limits for Python protocol readers + * [THRIFT-3237] - Fix TNamedPipeServer::createNamedPipe memory leak + * [THRIFT-3233] - Fix C++ ThreadManager::Impl::removeWorker worker join + * [THRIFT-3232] - Cannot deserialize json messages created with fieldNamesAsString + * [THRIFT-3206] - Fix Visual Studio build failure due 'pthread_self': identifier not found + * [THRIFT-3200] - JS and nodejs do not encode JSON protocol binary fields as base64 + * [THRIFT-3199] - Exception field has basic metadata + * [THRIFT-3182] - TFramedTransport is in an invalid state after frame size exception + * [THRIFT-2536] - new TSocket, uninitialised value reported by valgrind + * [THRIFT-2527] - Apache Thrift IDL Compiler code generated for Node.js should be jshint clean + * [THRIFT-2519] - "processor" class is not being generated + * [THRIFT-2431] - TFileTransportTest fails with "check delta < XXX failed" + * [THRIFT-2708] - Erlang library does not support "oneway" message type + * [THRIFT-3377] - Deep copy is actually shallow when using typedef members + * [THRIFT-3376] - C# and Python JSON protocol double values lose precision + * [THRIFT-3373] - Various fixes for cross test servers and clients + * [THRIFT-3370] - errno extern variable redefined. Not compiling for Android + * [THRIFT-3379] - Potential out of range panic in Go JSON protocols + * [THRIFT-3371] - Abstract namespace Unix domain sockets broken in C++ + * [THRIFT-3380] - nodejs: 0.9.2 -> 0.9.3 upgrade breaks Protocol and Transport requires + * [THRIFT-3367] - Fix bad links to coding_standards.md #634 + * [THRIFT-3401] - Nested collections emit Objective-C code that cannot compile + * [THRIFT-3403] - JSON String reader doesn't recognize UTF-16 surrogate pairs + * [THRIFT-3362] - make check fails for C++ at the SecurityTest + * [THRIFT-3395] - Cocoa compiler produces corrupt code when boxing enums inside map. + * [THRIFT-3394] - compiler generates uncompilable code + * [THRIFT-3388] - hash doesn't work on set/list + * [THRIFT-3391] - Wrong bool formatting in test server + * [THRIFT-3390] - TTornado server doesn't handle closed connections properly + * [THRIFT-3382] - TBase class for C++ Library + * [THRIFT-3392] - Java TZlibTransport does not close its wrapper streams upon close() + * [THRIFT-3383] - i64 related warnings + * [THRIFT-3386] - misc. warnings with make check + * [THRIFT-3385] - warning: format ‘%lu’ expects ‘long unsigned int’, but has type ‘std::basic_string::size_type {aka unsigned int} + * [THRIFT-3355] - npm WARN package.json thrift@1.0.0-dev No license field. + * [THRIFT-3360] - Improve cross test servers and clients further + * [THRIFT-3359] - Binary field incompatibilities + * [THRIFT-3354] - Fix word-extraction substr bug in initialism code + * [THRIFT-3350] - Python JSON protocol does not encode binary as Base64 + * [THRIFT-3577] - assertion failed at line 512 of testcontainertest.c + * [THRIFT-3576] - Boost test --log_format arg does not accept lowercase + * [THRIFT-3575] - Go compiler tries to use unexported library methods when using read_write_private + * [THRIFT-3574] - Cocoa generator makes uncompilable imports + * [THRIFT-3570] - Remove duplicate instances that are added by upstream + * [THRIFT-3571] - Make feature test result browsable + * [THRIFT-3569] - c_glib protocols do not check number of bytes read by transport + * [THRIFT-3568] - THeader server crashes on readSlow + * [THRIFT-3567] - GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed + * [THRIFT-3566] - C++/Qt: TQTcpServerTest::test_communicate() is never executed + * [THRIFT-3564] - C++/Qt: potential core dump in TQTcpServer in case an exception occurs in TAsyncProcessor::process() + * [THRIFT-3558] - typos in c_glib tests + * [THRIFT-3559] - Fix awkward extra semi-colons with Cocoa container literals + * [THRIFT-3555] - 'configure' script does not honor --with-openssl= for libcrypto for BN_init + * [THRIFT-3554] - Constant decls may lead to "Error: internal error: prepare_member_name_mapping() already active for different struct" + * [THRIFT-3552] - glib_c Memory Leak + * [THRIFT-3551] - Thrift perl library missing package declaration + * [THRIFT-3549] - Exceptions are not properly stringified in Perl library + * [THRIFT-3546] - NodeJS code should not be namespaced (and is currently not strict-mode compliant) + * [THRIFT-3545] - Container type literals do not compile + * [THRIFT-3538] - Remove UnboundMethodType in TProtocolDecorator + * [THRIFT-3536] - Error 'char' does not contain a definition for 'IsLowSurrogate' for WP7 target + * [THRIFT-3534] - Link error when building with Qt5 + * [THRIFT-3533] - Can not send nil pointer as service method argument + * [THRIFT-3507] - THttpClient does not use proxy from http_proxy, https_proxy environment variables + * [THRIFT-3502] - C++ TServerSocket passes small buffer to getsockname + * [THRIFT-3501] - Forward slash in comment causes compiler error + * [THRIFT-3498] - C++ library assumes optional function pthread_attr_setschedpolicy is available + * [THRIFT-3497] - Build fails with "invalid use of incomplete type" + * [THRIFT-3496] - C++: Cob style client fails when sending a consecutive request + * [THRIFT-3493] - libthrift does not compile on windows using visual studio + * [THRIFT-3488] - warning: unused variable 'program' + * [THRIFT-3489] - warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] + * [THRIFT-3487] - Full support for newer Delphi versions + * [THRIFT-3528] - Fix warnings in thrift.ll + * [THRIFT-3527] - -gen py:dynamic,utf8strings ignores utf8strings option + * [THRIFT-3526] - Code generated by py:utf8strings does not work for Python3 + * [THRIFT-3524] - dcc32 warning "W1000 Symbol 'IsLowSurrogate' is deprecated: 'Use TCharHelper'" in Thrift.Protocol.JSON.pas + * [THRIFT-3525] - py:dynamic fails to handle binary list/set/map element + * [THRIFT-3521] - TSimpleJSONProtocolTest is not deterministic (fails when run on JDK 8) + * [THRIFT-3520] - Dart TSocket onError stream should be typed as Object + * [THRIFT-3519] - fastbinary does not work with -gen py:utf8strings + * [THRIFT-3518] - TConcurrentClientSyncInfo files were missing for Visual Studio + * [THRIFT-3512] - c_glib: Build fails due to missing features.h + * [THRIFT-3483] - Incorrect empty binary handling introduced by THRIFT-3359 + * [THRIFT-3479] - Oneway calls should not return exceptions to clients + * [THRIFT-3478] - Restore dropped method to THsHaServer.java + * [THRIFT-3477] - Parser fails on enum item that starts with 'E' letter and continues with number + * [THRIFT-3476] - Missing include in ./src/thrift/protocol/TJSONProtocol.cpp + * [THRIFT-3474] - Docker: thrift-compiler + * [THRIFT-3473] - When "optional' is used with a struct member, C++ server seems to not return it correctly + * [THRIFT-3468] - Dart TSocketTransport onError handler is too restrictive + * [THRIFT-3451] - thrift_protocol PHP extension missing config.m4 file + * [THRIFT-3456] - rounding issue in static assert + * [THRIFT-3455] - struct write method's return value is incorrect + * [THRIFT-3454] - Python Tornado tutorial is broken + * [THRIFT-3463] - Java can't be disabled in CMake build + * [THRIFT-3450] - NPE when using SSL + * [THRIFT-3449] - TBaseAsyncProcessor fb.responseReady() never called for oneway functions + * [THRIFT-3471] - Dart generator does not handle uppercase argument names + * [THRIFT-3470] - Sporadic timeouts with pipes + * [THRIFT-3465] - Go Code With Complex Const Initializer Compilation Depends On Struct Order + * [THRIFT-3464] - Fix several defects in c_glib code generator + * [THRIFT-3462] - Cocoa generates Incorrect #import header names + * [THRIFT-3453] - remove rat_exclude + * [THRIFT-3418] - Use of ciphers in ssl.wrap_socket() breaks python 2.6 compatibility + * [THRIFT-3417] - "namespace xsd" is not really working + * [THRIFT-3413] - Thrift code generation bug in Go when extending service + * [THRIFT-3420] - C++: TSSLSockets are not interruptable + * [THRIFT-3415] - include unistd.h conditionally + * [THRIFT-3414] - #include in THeaderTransport.h breaks windows build + * [THRIFT-3411] - Go generates remotes with wrong package qualifiers when including + * [THRIFT-3430] - Go THttpClient does not read HTTP response body to completion when closing + * [THRIFT-3423] - First call to thrift_transport:read_exact fails to dispatch correct function + * [THRIFT-3422] - Go TServerSocket doesn't close on Interrupt + * [THRIFT-3421] - rebar as dependency instead of bundling (was: rebar fails if PWD contains Unicode) + * [THRIFT-3428] - Go test fails when running make check + * [THRIFT-3445] - Throwable messages are hidden from JVM stack trace output + * [THRIFT-3443] - Thrift include can generate uncompilable code + * [THRIFT-3444] - Large 64 bit Integer does not preserve value through Node.js JSONProtocol + * [THRIFT-3436] - misc. cross test issues with UTF-8 path names + * [THRIFT-3435] - Put generated Java code for fullcamel tests in a separate package/namespace + * [THRIFT-3433] - Doubles aren't interpreted correctly + * [THRIFT-3437] - Mingw-w64 build fail + * [THRIFT-3434] - Dart generator produces empty name in pubspec.yaml for includes without namespaces + * [THRIFT-3408] - JSON generator emits incorrect types + * [THRIFT-3406] - Cocoa client should not schedule streams on main runloop + * [THRIFT-3404] - JSON String reader doesn't recognize UTF-16 surrogate pair + * [THRIFT-3636] - Double precision is not fully preserved in C++ TJSONProtocol + * [THRIFT-3632] - c_glib testserialization fails with glib assertion + * [THRIFT-3619] - Using Thrift 0.9.3 with googletest on Linux gcc 4.9 / C++11 + * [THRIFT-3617] - CMake does not build gv/xml generators + * [THRIFT-3615] - Fix Python SSL client resource leak on connection failure + * [THRIFT-3616] - lib/py/test/test_sslsocket.py is flaky + * [THRIFT-3643] - Perl SSL server crushes if a client disconnect without handshake + * [THRIFT-3639] - C# Thrift library forces TLS 1.0, thwarting TLS 1.2 usage + * [THRIFT-3633] - Travis "C C++ - GCC" build was using clang + * [THRIFT-3634] - Fix Python TSocket resource leak on connection failure + * [THRIFT-3630] - Debian/Ubuntu install docs need an update + * [THRIFT-3629] - Parser sets exitcode on errors, but generator does not + * [THRIFT-3608] - lib/cpp/test/SecurityTest is flaky in jenkins Thrift-precommit build. + * [THRIFT-3601] - Better conformance to PEP8 for generated code + * [THRIFT-3599] - Validate client IP address against cert's SubjectAltName + * [THRIFT-3598] - TBufferedTransport doesn't instantiate client connection + * [THRIFT-3597] - `make check` hangs in go tests + * [THRIFT-3589] - Dart generator uses wrong name in constructor for uppercase arguments with defaults + * [THRIFT-3588] - Using TypeScript with --noImplicitAny fails + * [THRIFT-3584] - boolean false value cannot be transferred + * [THRIFT-3578] - Make THeaderTransport detect TCompact framed and unframed + * [THRIFT-3323] - Python library does not handle escaped forward slash ("/") in JSON + * [THRIFT-3322] - CMake generated "make check" failes on python_test + * [THRIFT-3321] - Thrift can't be added as a subdirectory of another CMake-based project + * [THRIFT-3314] - Dots in file names of includes causes dots in javascript variable names + * [THRIFT-3307] - Segfault in Ruby serializer + * [THRIFT-3309] - Missing TConstant.php in /lib/php/Makefile.am + * [THRIFT-3810] - unresolved external symbol public: virtual void __cdecl apache::thrift::server::TServerFramework::serve(void) + * [THRIFT-3736] - C++ library build fails if OpenSSL does not surrpot SSLv3 + * [THRIFT-3878] - Compile error in TSSLSocket.cpp with new OpenSSL [CRYPTO_num_locks] + * [THRIFT-3949] - missing make dist entry for compiler/cpp/test + * [THRIFT-449] - The wire format of the JSON Protocol may not always be valid JSON if it contains non-UTF8 encoded strings + * [THRIFT-162] - Thrift structures are unhashable, preventing them from being used as set elements + * [THRIFT-3961] - TConnectedClient does not terminate the connection to the client if an exception while processing the received message occures. + * [THRIFT-3881] - Travis CI builds are failing due to docker failures (three retries, and gives up) + * [THRIFT-3937] - Cannot compile 0.10.0 development tip with gcc-4.6.x + * [THRIFT-3964] - Unsupported mechanism type ????? due to dependency on default OS-dependent charset + * [THRIFT-3038] - Use of volatile in cpp library + * [THRIFT-3301] - Java generated code uses imports that can lead to class name collisions with IDL defined types + * [THRIFT-3348] - PHP TCompactProtocol bool&int64 readvalue bug + * [THRIFT-3955] - TThreadedServer Memory Leak + * [THRIFT-3829] - Thrift does not install Python Libraries if Twisted is not installed + * [THRIFT-3932] - C++ ThreadManager has a rare termination race + * [THRIFT-3828] - cmake fails when Boost_INCLUDE_DIRS (and other variables passed to include_directories()) is empty + * [THRIFT-3958] - CMake WITH_MT option for windows static runtime linking does not support the cmake build type RelWithDebInfo + * [THRIFT-3957] - TConnectedClient does not disconnect from clients when their timeout is reached. + * [THRIFT-3953] - TSSLSocket::close should handle exceptions from waitForEvent because it is called by the destructor. + * [THRIFT-3977] - PHP extension creates undefined values when deserializing sets + * [THRIFT-3947] - sockaddr type isn't always large enough for the return of getsockname + * [THRIFT-2755] - ThreadSanitizer reports data race in ThreadManager::Impl::addWorker + * [THRIFT-3948] - errno is not the correct method of getting the error in windows + * [THRIFT-4008] - broken ci due to upstream dependency versioning break + * [THRIFT-3999] - Fix Debian & Ubuntu package dependencies + * [THRIFT-3886] - PHP cross test client returns 0 even when failing + * [THRIFT-3997] - building thrift libs does not support new openssl + +## Documentation + * [THRIFT-3867] - Specify BinaryProtocol and CompactProtocol + +## Epic + * [THRIFT-3049] - As an iOS developer, I want a generator and library that produces Swift code + * [THRIFT-2336] - UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + +## Improvement + * [THRIFT-1867] - Python client/server should support client-side certificates. + * [THRIFT-1313] - c_glib compact support + * [THRIFT-1385] - make install doesn't install java library in the setted folder + * [THRIFT-1437] - Update RPM spec + * [THRIFT-847] - Test Framework harmonization across all languages + * [THRIFT-819] - add Enumeration for protocol, transport and server types + * [THRIFT-3927] - Emit an error instead of throw an error in the async callback + * [THRIFT-3931] - TSimpleServer: If process request encounter UNKNOWN_METHOD, don't close transport. + * [THRIFT-3934] - Automatically resolve OpenSSL binary version on Windows CI + * [THRIFT-3918] - Run subset of make cross + * [THRIFT-3908] - Remove redundant dependencies from Dockerfile + * [THRIFT-3907] - Skip Docker image build on CI when unchanged + * [THRIFT-3868] - Java struct equals should do identity check before field comparison + * [THRIFT-3849] - Port Go serializer and deserializer to dart + * [THRIFT-2989] - Complete CMake build for Apache Thrift + * [THRIFT-2980] - ThriftMemoryBuffer doesn't have a constructor option to take an existing buffer + * [THRIFT-2856] - refactor erlang basic transports and unify interfaces + * [THRIFT-2877] - Optimize generated hashCode + * [THRIFT-2869] - JSON: run schema validation from tests + * [THRIFT-3112] - [Java] AsyncMethodCallback should be typed in generated AsyncIface + * [THRIFT-3263] - PHP jsonSerialize() should cast scalar types + * [THRIFT-2905] - Cocoa compiler should have option to produce "modern" Objective-C + * [THRIFT-2821] - Enable the use of custom HTTP-Header in the Transport + * [THRIFT-2093] - added the ability to set compression level in C++ zlib transport + * [THRIFT-2089] - Compiler ignores duplicate typenames + * [THRIFT-2056] - Moved all #include config.h statements to #include + * [THRIFT-2031] - Make SO_KEEPALIVE configurable for C++ lib + * [THRIFT-2021] - Improve large binary protocol string performance + * [THRIFT-2028] - Cleanup threading headers / libraries + * [THRIFT-2014] - Change C++ lib includes to use style throughout + * [THRIFT-2312] - travis.yml: build everything + * [THRIFT-1915] - Multiplexing Services + * [THRIFT-1736] - Visual Studio top level project files within msvc + * [THRIFT-1735] - integrate tutorial into regular build + * [THRIFT-1533] - Make TTransport should be Closeable + * [THRIFT-35] - Move language tests into their appropriate library directory + * [THRIFT-1079] - Support i64 in AS3 + * [THRIFT-1108] - SSL support for the Ruby library + * [THRIFT-3856] - update debian package deependencies + * [THRIFT-3833] - haxe http server implementation (by embeding into php web server) + * [THRIFT-3839] - Performance issue with big message deserialization using php extension + * [THRIFT-3820] - Erlang: Detect OTP >= 18 to use new time correction + * [THRIFT-3816] - Reduce docker build duration on Travis-CI + * [THRIFT-3815] - Put appveyor dependency versions to one place + * [THRIFT-3788] - Compatibility improvements and Win64 support + * [THRIFT-3792] - Timeouts for anonymous pipes should be configurable + * [THRIFT-3794] - Split Delphi application, protocol and transport exception subtypes into separate exceptions + * [THRIFT-3774] - The generated code should have exception_names meta info + * [THRIFT-3762] - Fix build warnings for deprecated Thrift "byte" fields + * [THRIFT-3756] - Improve requiredness documentation + * [THRIFT-3761] - Add debian package for Python3 + * [THRIFT-3742] - haxe php cli support + * [THRIFT-3733] - Socket timeout improvements + * [THRIFT-3728] - http transport for thrift-lua + * [THRIFT-3905] - Dart compiler does not initialize bool, int, and double properties + * [THRIFT-3911] - Loosen Ruby dev dependency version requirements + * [THRIFT-3906] - Run C# tests with make check + * [THRIFT-3900] - Add Python SSL flags + * [THRIFT-3897] - Provide meaningful exception type based on WebExceptionStatus in case of timeout + * [THRIFT-3808] - Missing `DOUBLE` in thrift type enumeration + * [THRIFT-3803] - Remove "file" attribute from XML generator + * [THRIFT-3660] - Add V4 mapped address to test client cert's altname + * [THRIFT-3661] - Use https to download meck in erlang test build + * [THRIFT-3659] - Check configure result of CMake on CI + * [THRIFT-3667] - Add TLS SNI support to clients + * [THRIFT-3651] - Make backports.match_hostname and ipaddress optional + * [THRIFT-3666] - Build D tutorial as part of Autotools build + * [THRIFT-3665] - Add D libevent and OpenSSL to docker images + * [THRIFT-3664] - Remove md5.c + * [THRIFT-3662] - Add Haskell to debian docker image + * [THRIFT-3711] - Add D to cross language test + * [THRIFT-3691] - Run flake8 Python style check on Travis-CI + * [THRIFT-3692] - (Re)enable Appveyor C++ and Python build + * [THRIFT-3677] - Improve CMake Java build + * [THRIFT-3679] - Add stdout log to testBinary in Java test server + * [THRIFT-3718] - Reduce size of docker image for build environment + * [THRIFT-3698] - [Travis-CI] Introduce retry to apt commands + * [THRIFT-3127] - switch -recurse to --recurse and reserve -r + * [THRIFT-3087] - Pass on errors like "connection closed" + * [THRIFT-3240] - Thrift Python client should support subjectAltName and wildcard certs in TSSLSocket + * [THRIFT-3213] - make cross should indicate when it skips a known failing test + * [THRIFT-3208] - Fix Visual Studio solution build failure due to missing source + * [THRIFT-3186] - Add TServerHTTP to Go library + * [THRIFT-2342] - Add __FILE__ and __LINE__ to Thrift C++ excpetions + * [THRIFT-3372] - Add dart generator to Visual Studio project + * [THRIFT-3366] - ThriftTest to implement standard return values + * [THRIFT-3402] - Provide a perl Unix Socket implementation + * [THRIFT-3361] - Improve C# library + * [THRIFT-3393] - Introduce i8 to provide consistent set of Thrift IDL integer types + * [THRIFT-3339] - Support for database/sql + * [THRIFT-3565] - C++: T[Async]Processor::getEventHandler() should be declared as const member functions + * [THRIFT-3563] - C++/Qt: removed usage of macro QT_PREPEND_NAMESPACE as it isn't consequently used for all references to Qt types. + * [THRIFT-3562] - Removed unused TAsyncProcessor::getAsyncServer() + * [THRIFT-3561] - C++/Qt: make use of Q_DISABLE_COPY() to get rid of copy ctor and assignment operator + * [THRIFT-3556] - c_glib file descriptor transport + * [THRIFT-3544] - Make cross test fail when server process died unexpectedly + * [THRIFT-3540] - Make python tutorial more in line with PEP8 + * [THRIFT-3535] - Dart generator argument to produce a file structure usable in parent library + * [THRIFT-3505] - Enhance Python TSSLSocket + * [THRIFT-3506] - Eliminate old style classes from library code + * [THRIFT-3503] - Enable py:utf8string by default + * [THRIFT-3499] - Add package_prefix to python generator + * [THRIFT-3495] - Minor enhancements and fixes for cross test + * [THRIFT-3486] - Java generated `getFieldValue` is incompatible with `setFieldValue` for binary values. + * [THRIFT-3484] - Consolidate temporary buffers in Java's TCompactProtocol + * [THRIFT-3516] - Add feature test for THeader TBinaryProtocol interop + * [THRIFT-3515] - Python 2.6 compatibility and test on CI + * [THRIFT-3514] - PHP 7 compatible version of binary protocol + * [THRIFT-3469] - Docker: Debian support + * [THRIFT-3416] - Retire old "xxx_namespace" declarations from the IDL + * [THRIFT-3426] - Align autogen comment in XSD + * [THRIFT-3424] - Add CMake android build option + * [THRIFT-3439] - Run make cross using Python3 when available + * [THRIFT-3440] - Python make check takes too much time + * [THRIFT-3441] - Stabilize Travis-CI builds + * [THRIFT-3431] - Avoid "schemes" HashMap lookups during struct reads/writes + * [THRIFT-3432] - Add a TByteBuffer transport to the Java library + * [THRIFT-3438] - Enable py:new_style by default + * [THRIFT-3405] - Go THttpClient misuses http.Client objects + * [THRIFT-3614] - Improve logging of test_sslsocket.py + * [THRIFT-3647] - Fix php extension build warnings + * [THRIFT-3642] - Speed up cross test runner + * [THRIFT-3637] - Implement compact protocol for dart + * [THRIFT-3613] - Port Python C extension to Python 3 + * [THRIFT-3612] - Add Python C extension for compact protocol + * [THRIFT-3611] - Add --regex filter to cross test runner + * [THRIFT-3631] - JSON protocol implementation for Lua + * [THRIFT-3609] - Remove or replace TestPortFixture.h + * [THRIFT-3605] - Have the compiler complain about invalid arguments and options + * [THRIFT-3596] - Better conformance to PEP8 + * [THRIFT-3585] - Compact protocol implementation for Lua + * [THRIFT-3582] - Erlang libraries should have service metadata + * [THRIFT-3579] - Introduce retry to make cross + * [THRIFT-3306] - Java: TBinaryProtocol: Use 1 temp buffer instead of allocating 8 + * [THRIFT-3910] - Do not invoke pip as part of build process + * [THRIFT-1857] - Python 3.X Support + * [THRIFT-1944] - Binding to zero port + * [THRIFT-3954] - Enable the usage of structs called "Object" in Java + * [THRIFT-3981] - Enable analyzer strong mode in Dart library + * [THRIFT-3998] - Document ability to add custom tags to thrift structs + * [THRIFT-4006] - Add a removeEventListener method on TSocket + +## New Feature + * [THRIFT-640] - Support deprecation + * [THRIFT-948] - SSL socket support for PHP + * [THRIFT-764] - add Support for Vala language + * [THRIFT-3046] - Allow PSR4 class loading for generated classes (PHP) + * [THRIFT-2113] - Erlang SSL Socket Support + * [THRIFT-1482] - Unix domain socket support under PHP + * [THRIFT-519] - Support collections of types without having to explicitly define it + * [THRIFT-468] - Rack Middleware Application for Rails + * [THRIFT-1708] - Add event handlers for processor events + * [THRIFT-3834] - Erlang namespacing and exception metadata + * [THRIFT-2510] - Implement TNonblockingServer's ability to listen on unix domain sockets + * [THRIFT-3397] - Implement TProcessorFactory in C# to enable per-client processors + * [THRIFT-3523] - XML Generator + * [THRIFT-3510] - Add HttpTaskAsyncHandler implementation + * [THRIFT-3318] - PHP: SimpleJSONProtocol Implementation + * [THRIFT-3299] - Dart language bindings in Thrift + * [THRIFT-2835] - Add possibility to distribute generators separately from thrift core, and load them dynamically + * [THRIFT-184] - Add OSGi Manifest headers to the libthrift java library to be able to use Thrift in the OSGi runtime + * [THRIFT-141] - If a required field is not present on serialization, throw an exception + * [THRIFT-1891] - Add Windows ALPC transport which is right counterpart of Unix domain sockets + +## Question + * [THRIFT-1808] - The Thrift struct should be considered self-contained? + * [THRIFT-2895] - Tutorial cpp + * [THRIFT-3860] - Elephant-bird application Test fails for Thrift + * [THRIFT-3811] - HTTPS Support for C++ applications + * [THRIFT-3509] - "make check" error + +## Story + * [THRIFT-3452] - .travis.yml: Migrating from legacy to container-based infrastructure + +## Sub-task + * [THRIFT-1811] - ruby tutorial as part of the regular build + * [THRIFT-2779] - PHP TJSONProtocol encode unicode into UCS-4LE which can't be parsed by other language bindings + * [THRIFT-2110] - Erlang: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-3852] - A Travis-CI job fails with "write error" + * [THRIFT-3740] - Fix haxelib.json classpath + * [THRIFT-3653] - incorrect union serialization + * [THRIFT-3652] - incorrect serialization of optionals + * [THRIFT-3655] - incorrect union serialization + * [THRIFT-3654] - incorrect serialization of optionals + * [THRIFT-3656] - incorrect serialization of optionals + * [THRIFT-3699] - Fix integer limit symbol includes in Python C extension + * [THRIFT-3693] - Fix include issue in C++ TSSLSocketInterruptTest on Windows + * [THRIFT-3694] - [Windows] Disable tests of a few servers that are not supported + * [THRIFT-3696] - Install pip to CentOS Docker images to fix Python builds + * [THRIFT-3638] - Fix haxelib.json + * [THRIFT-3251] - Add http transport for server to Go lib + * [THRIFT-2424] - Recursive Types + * [THRIFT-2423] - THeader + * [THRIFT-2413] - Python: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2409] - Java: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2412] - D: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2411] - C++: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2410] - JavaMe: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2668] - TestSuite: detailed result on passed tests by feature + * [THRIFT-2659] - python Test Server fails when throwing TException + * [THRIFT-3398] - Add CMake build for Haskell library and tests + * [THRIFT-3396] - DART: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-3364] - Fix ruby binary field encoding in TJSONProtocol + * [THRIFT-3381] - Fix for misc. codegen issues with THRIFT-2905 + * [THRIFT-3573] - No rule to make target `../../../test/c_glib/src/.deps/testthrifttest-thrift_test_handler.Po'. + * [THRIFT-3572] - "Unable to determine the behavior of a signed right shift" + * [THRIFT-3542] - Add length limit support to Java test server + * [THRIFT-3537] - Remove the (now obsolete) csharp:asyncctp flag + * [THRIFT-3532] - Add configurable string and container read size limit to Python protocols + * [THRIFT-3531] - Create cross lang feature test for string and container read length limit + * [THRIFT-3482] - Haskell JSON protocol does not encode binary field as Base64 + * [THRIFT-3425] - Minor fixes + simplification for CentOS Dockerfile + * [THRIFT-3442] - Run CMake tests on Appveyor + * [THRIFT-3409] - NodeJS binary field issues + * [THRIFT-3621] - Fix lib/cpp/test/SecurityTest.cpp to use ephemeral ports + * [THRIFT-3628] - Fix lib/cpp/test/TServerIntegrationTest.cpp to use ephemeral ports + * [THRIFT-3625] - Kill unused #include "TestPortFixture.h" in lib/cpp/test/TServerTransportTest.cpp. + * [THRIFT-3646] - Fix Python extension build warnings + * [THRIFT-3626] - Fix lib/cpp/test/TSocketInterruptTest.cpp to use ephemeral ports. + * [THRIFT-3624] - Fix lib/cpp/test/TServerSocketTest.cpp to use ephemeral ports + * [THRIFT-3623] - Fix Fix cpp/lib/test/TSSLSocketInterruptTest.cpp to use ephemeral ports + * [THRIFT-3592] - Add basic test client + * [THRIFT-3980] - add TExtendedBinaryProtocol.java + +## Task + * [THRIFT-1801] - Sync up TApplicationException codes across languages and thrift implementations + * [THRIFT-1259] - Automate versioning + +## Test + * [THRIFT-3400] - Add Erlang to cross test + * [THRIFT-3504] - Fix FastbinaryTest.py + +## Wish + * [THRIFT-3923] - Maybe remove Aereo from the "Powered by" list + * [THRIFT-2149] - Add an option to disable the generation of default operators + + + +Thrift 0.9.3 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-2441] - Cannot shutdown TThreadedServer when clients are still connected + * [THRIFT-2465] - TBinaryProtocolT breaks if copied/moved + * [THRIFT-2474] - thrift.h causes a compile failure + * [THRIFT-2540] - Running configure from outside the source directory fails + * [THRIFT-2598] - Add check for minimum Go version to configure.ac + * [THRIFT-2647] - compiler-hs: don't decapitalize field names, do decapitalize argument bindings + * [THRIFT-2773] - Generated Java code for 'oneway' methods is incorrect. + * [THRIFT-2789] - TNonblockingServer leaks socket FD's under load + * [THRIFT-2682] - TThreadedServer leaks per-thread memory + * [THRIFT-2674] - JavaScript: declare Accept: and Content-Type: in request + * [THRIFT-3078] - TNonblockingServerSocket's logger is not named after TNonblockingServerSocket + * [THRIFT-3077] - C++ TFileTransport ignores return code from ftruncate + * [THRIFT-3067] - C++ cppcheck performance related warnings + * [THRIFT-3066] - C++ TDenseProtocol assert modifies instead of checks + * [THRIFT-3071] - bootstrap.sh on Ubuntu 12.04 (Precise) automake error + * [THRIFT-3069] - C++ TServerSocket leaks socket on fcntl get or set flags error + * [THRIFT-3079] - TNonblockingServerSocket's logger is not named after TNonblockingServerSocket + * [THRIFT-3080] - C++ TNonblockingServer connection leak while accept huge number connections. + * [THRIFT-3086] - C++ Valgrind Error Cleanup + * [THRIFT-3085] - thrift_reconnecting_client never try to reconnect + * [THRIFT-3123] - Missing include in compiler/cpp/src/main.h breaks build in some environments + * [THRIFT-3125] - Fix the list of exported headers in automake input + * [THRIFT-3126] - PHP JSON serializer converts empty or int-indexed maps to lists + * [THRIFT-3132] - Properly format date in Java @Generated annotations + * [THRIFT-3137] - Travis build hangs after failure + * [THRIFT-3138] - "make check" parallel execution is underministic + * [THRIFT-3139] - JS library test is flaky + * [THRIFT-3140] - ConcurrentModificationException is thrown by JavaScript test server + * [THRIFT-3124] - Some signed/unsigned warnings while building compiler + * [THRIFT-3128] - Go generated code produces name collisions between services + * [THRIFT-3146] - Graphviz generates function name collisions between services + * [THRIFT-3147] - Segfault while receiving data + * [THRIFT-3148] - Markdown links to coding_standards are dead + * [THRIFT-3090] - cmake build is broken on MacOSX + * [THRIFT-3097] - cmake targets unconditionally depend on optional libraries + * [THRIFT-3094] - master as of 2015-APR-13 fails -DBOOST_THREADS cmake build + * [THRIFT-3099] - cmake build is broken on FreeBSD + * [THRIFT-3089] - Assigning default ENUM values results in non-compilable java code if java namespace is not defined + * [THRIFT-3093] - mingw compile fixes for c++ library 0.9.2 + * [THRIFT-3098] - Thrift does not pretty print binary typedefs the way it does binary fields + * [THRIFT-3091] - c_glib service method should return result from handler method + * [THRIFT-3088] - TThreadPoolServer with Sasl auth may leak CLOSE_WAIT socket + * [THRIFT-3109] - Cross test log file cannot be browsed when served in HTTP server + * [THRIFT-3113] - m4 C++11 macro issue + * [THRIFT-3105] - C++ libthriftnb library on Windows build failure + * [THRIFT-3115] - Uncompileable code due to name collision with predefined used types + * [THRIFT-3117] - Java TSSLTransportFactory can't load certificates within JAR archive + * [THRIFT-3102] - could not make check for Go Library + * [THRIFT-3120] - Minor spelling errors and an outdated URL + * [THRIFT-3121] - Librt does not exist on OS X + * [THRIFT-3152] - Compiler error on Mac OSX (missing #include ) + * [THRIFT-3162] - make fails for dmd 2.067 + * [THRIFT-3164] - Thrift C++ library SSL socket by default allows for unsecure SSLv3 negotiation + * [THRIFT-3168] - Fix Maven POM + * [THRIFT-3170] - Initialism code in the Go compiler causes chaos + * [THRIFT-3169] - Do not export thrift.TestStruct and thrift.TestEnum in thrift Go library + * [THRIFT-3191] - Perl compiler does not add support for unexpected exception handling + * [THRIFT-3178] - glib C does not compile + * [THRIFT-3189] - Perl ServerSocket should allow a specific interface to be listened to + * [THRIFT-3252] - Missing TConcurrentClientSyncInfo.h in cpp Makefile, so doesn't install + * [THRIFT-3255] - Thrift generator doesn't exclude 'package' keyword for thrift property names breaking java builds + * [THRIFT-3260] - multiple warnings in c_glib tutorial + * [THRIFT-3256] - Some D test timings are too aggressive for slow machines + * [THRIFT-3257] - warning: extra tokens at end of #endif directive + * [THRIFT-3184] - Thrift Go leaves file descriptors open + * [THRIFT-3203] - DOAP - please fix "Ocaml" => "OCaml" + * [THRIFT-3210] - (uncompileable) code generated for server events while are events not enabled + * [THRIFT-3215] - TJSONProtocol '(c++) uses "throw new" to throw exceptions instead of "throw" + * [THRIFT-3202] - Allow HSHAServer to configure min and max worker threads separately. + * [THRIFT-3205] - TCompactProtocol return a wrong error when the io.EOF happens + * [THRIFT-3209] - LGPL mentioned in license file + * [THRIFT-3197] - keepAliveTime is hard coded as 60 sec in TThreadPoolServer + * [THRIFT-3196] - Misspelling in lua TBinaryProtocol (stirctWrite => strictWrite) + * [THRIFT-3198] - Allow construction of TTransportFactory with a specified maxLength + * [THRIFT-3192] - Go import paths changed in 1.4, and expired June 1 + * [THRIFT-3271] - Could not find or load main class configtest_ax_javac_and_java on some non-english systems + * [THRIFT-3273] - c_glib: Generated code tries to convert between function and void pointers + * [THRIFT-3264] - Fix Erlang 16 namespaced types + * [THRIFT-3270] - reusing TNonblockingServer::TConnection cause dirty TSocket + * [THRIFT-3267] - c_glib: "Critical" failure during unit tests + * [THRIFT-3277] - THttpClient leaks connections if it's used for multiple requests + * [THRIFT-3278] - NodeJS: Fix exception stack traces and names + * [THRIFT-3279] - Fix a bug in retry_max_delay (NodeJS) + * [THRIFT-3280] - Initialize retry variables on construction + * [THRIFT-3283] - c_glib: Tutorial server always exits with warning + * [THRIFT-3284] - c_glib: Empty service produces unused-variable warning + * [THRIFT-1925] - c_glib generated code does not compile + * [THRIFT-1849] - after transport->open() opens isOpen returns true and next open() goes thru when it shall not + * [THRIFT-1866] - java compiler generates non-compiling code with const's defined in a thrift when name includes non-identifier chars + * [THRIFT-1938] - FunctionRunner.h -- uses wrong path for Thread.h when installed + * [THRIFT-1844] - Password string not cleared + * [THRIFT-2004] - Thrift::Union violates :== method contract and crashes + * [THRIFT-2073] - Thrift C++ THttpClient error: cannot refill buffer + * [THRIFT-2127] - Autoconf scripting does not properly account for cross-compile + * [THRIFT-2180] - Integer types issues in Cocoa lib on ARM64 + * [THRIFT-2189] - Go needs "isset" to fully support "union" type (and optionals) + * [THRIFT-2192] - autotools on Redhat based systems + * [THRIFT-2546] - cross language tests fails at 'TestMultiException' when using nodejs server + * [THRIFT-2547] - nodejs servers and clients fails to connect with cpp using compact protocol + * [THRIFT-2548] - Nodejs servers and clients does not work properly with -ssl + * [THRIFT-1471] - toString() does not print ByteBuffer values when nested in a List + * [THRIFT-1201] - getaddrinfo resource leak + * [THRIFT-615] - TThreadPoolServer doesn't call task_done after pulling tasks from it's clients queue + * [THRIFT-162] - Thrift structures are unhashable, preventing them from being used as set elements + * [THRIFT-810] - Crashed client on TSocket::close under loads + * [THRIFT-557] - charset problem with file Autogenerated by Thrift + * [THRIFT-233] - IDL doesn't support negative hex literals + * [THRIFT-1649] - contrib/zeromq does not build in 0.8.0 + * [THRIFT-1642] - Miscalculation lead to throw unexpected "TTransportException::TIMED_OUT"(or called "EAGAIN (timed out)") exception + * [THRIFT-1587] - TSocket::setRecvTimeout error + * [THRIFT-1248] - pointer subtraction in TMemoryBuffer relies on undefined behavior + * [THRIFT-1774] - Sasl Transport client would hang when trying to connect non-sasl transport server + * [THRIFT-1754] - RangeError in buffer handling + * [THRIFT-1618] - static structMap in FieldMetaData is not thread safe and can lead to deadlocks + * [THRIFT-2335] - thrift incompatibility with py:tornado as server, java as client + * [THRIFT-2803] - TCP_DEFER_ACCEPT not supported with domain sockets + * [THRIFT-2799] - Build Problem(s): ld: library not found for -l:libboost_unit_test_framework.a + * [THRIFT-2801] - C++ test suite compilation warnings + * [THRIFT-2802] - C++ tutorial compilation warnings + * [THRIFT-2795] - thrift_binary_protocol.c: 'dereferencing type-punned pointer will break strict-aliasing rules' + * [THRIFT-2817] - TSimpleJSONProtocol reads beyond end of message + * [THRIFT-2826] - html:standalone sometimes ignored + * [THRIFT-2829] - Support haxelib installation via github + * [THRIFT-2828] - slightly wrong help screen indent + * [THRIFT-2831] - Removes dead code in web_server.js introduced in THRIFT-2819 + * [THRIFT-2823] - All JS-tests are failing when run with grunt test + * [THRIFT-2827] - Thrift 0.9.2 fails to compile on Yosemite due to tr1/functional include in ProcessorTest.cpp + * [THRIFT-2843] - Automake configure.ac has possible typo related to Java + * [THRIFT-2813] - multiple haxe library fixes/improvements + * [THRIFT-2825] - Supplying unicode to python Thrift client can cause next request arguments to get overwritten + * [THRIFT-2840] - Cabal file points to LICENSE file outside the path of the Haskell project. + * [THRIFT-2818] - Trailing commas in array + * [THRIFT-2830] - Clean up ant warnings in tutorial dir + * [THRIFT-2842] - Erlang thrift client has infinite timeout + * [THRIFT-2810] - Do not leave the underlying ServerSocket open if construction of TServerSocket fails + * [THRIFT-2812] - Go server adding redundant buffering layer + * [THRIFT-2839] - TFramedTransport read bug + * [THRIFT-2844] - Nodejs support broken when running under Browserify + * [THRIFT-2814] - args/result classes not found when no namespace is set + * [THRIFT-2847] - function IfValue() is a duplicate of System.StrUtils.IfThen + * [THRIFT-2848] - certain Delphi tests do not build if TypeRegistry is used + * [THRIFT-2854] - Go Struct writer and reader looses important error information + * [THRIFT-2858] - Enable header field case insensitive match in THttpServer + * [THRIFT-2857] - C# generator creates uncompilable code for struct constants + * [THRIFT-2860] - Delphi server closes connection on unexpected exceptions + * [THRIFT-2868] - Enhance error handling in the Go client + * [THRIFT-2879] - TMemoryBuffer: using lua string in wrong way + * [THRIFT-2851] - Remove strange public Peek() from Go transports + * [THRIFT-2852] - Better Open/IsOpen/Close behavior for StreamTransport. + * [THRIFT-2871] - Missing semicolon in thrift.js + * [THRIFT-2872] - ThreadManager deadlock for task expiration + * [THRIFT-2881] - Handle errors from Accept() correctly + * [THRIFT-2849] - Spell errors reported by codespell tool + * [THRIFT-2870] - C++ TJSONProtocol using locale dependent formatting + * [THRIFT-2882] - Lua Generator: using string.len funtion to get struct(map,list,set) size + * [THRIFT-2864] - JSON generator missing from Visual Studio build project + * [THRIFT-2878] - Go validation support of required fields + * [THRIFT-2873] - TPipe and TPipeServer don't compile on Windows with UNICODE enabled + * [THRIFT-2888] - import of is missing in JSON generator + * [THRIFT-2900] - Python THttpClient does not reset socket timeout on exception + * [THRIFT-2907] - 'ntohll' macro redefined + * [THRIFT-2884] - Map does not serialize correctly for JSON protocol in Go library + * [THRIFT-2887] - --with-openssl configure flag is ignored + * [THRIFT-2894] - PHP json serializer skips maps with int/bool keys + * [THRIFT-2904] - json_protocol_test.go fails + * [THRIFT-2906] - library not found for -l:libboost_unit_test_framework.a + * [THRIFT-2890] - binary data may lose bytes with JSON transport under specific circumstances + * [THRIFT-2891] - binary data may cause a failure with JSON transport under specific circumstances + * [THRIFT-2901] - Fix for generated TypeScript functions + indentation of JavaScript maps + * [THRIFT-2916] - make check fails for D language + * [THRIFT-2918] - Race condition in Python TProcessPoolServer test + * [THRIFT-2920] - Erlang Thrift test uses wrong IDL file + * [THRIFT-2922] - $TRIAL is used with Python tests but not tested accordingly + * [THRIFT-2912] - Autotool build for C++ Qt library is invalid + * [THRIFT-2914] - explicit dependency to Lua5.2 fails on some systems + * [THRIFT-2910] - libevent is not really optional + * [THRIFT-2911] - fix c++ version zeromq transport, the old version cannot work + * [THRIFT-2915] - Lua generator missing from Visual Studio build project + * [THRIFT-2917] - "make clean" breaks test/c_glib + * [THRIFT-2919] - Haxe test server timeout too large + * [THRIFT-2923] - JavaScript client assumes a message being written + * [THRIFT-2924] - TNonblockingServer crashes when user-provided event_base is used + * [THRIFT-2925] - CMake build does not work with OpenSSL nor anything installed in non-system location + * [THRIFT-2931] - Access to undeclared static property: Thrift\Protocol\TProtocol::$TBINARYPROTOCOLACCELERATED + * [THRIFT-2893] - CMake build fails with boost thread or std thread + * [THRIFT-2902] - Generated c_glib code does not compile with clang + * [THRIFT-2903] - Qt4 library built with CMake does not work + * [THRIFT-2942] - CSharp generate invalid code for property named read or write + * [THRIFT-2932] - Node.js Thrift connection libraries throw Exceptions into event emitter + * [THRIFT-2933] - v0.9.2: doubles encoded in node with compact protocol cannot be decoded by python + * [THRIFT-2934] - createServer signature mismatch + * [THRIFT-2981] - IDL with no namespace produces unparsable PHP + * [THRIFT-2999] - Addition of .gitattributes text auto in THRIFT-2724 causes modified files on checkout + * [THRIFT-2949] - typo in compiler/cpp/README.md + * [THRIFT-2957] - warning: source file %s is in a subdirectory, but option 'subdir-objects' is disabled + * [THRIFT-2953] - TNamedPipeServerTransport is not Stop()able + * [THRIFT-2962] - Docker Thrift env for development and testing + * [THRIFT-2971] - C++ test and tutorial parallel build is unstable + * [THRIFT-2972] - Missing backslash in lib/cpp/test/Makefile.am + * [THRIFT-2951] - Fix Erlang name conflict test + * [THRIFT-2955] - Using list of typedefs does not compile on Go + * [THRIFT-2960] - namespace regression for Ruby + * [THRIFT-2959] - nodejs: fix binary unit tests + * [THRIFT-2966] - nodejs: Fix bad references to TProtocolException and TProtocolExceptionType + * [THRIFT-2970] - grunt-jsdoc fails due to dependency issues + * [THRIFT-3001] - C# Equals fails for binary fields (byte[]) + * [THRIFT-3003] - Missing LICENSE file prevents package from being installed + * [THRIFT-3008] - Node.js server does not fully support exception + * [THRIFT-3007] - Travis build is broken because of directory conflict + * [THRIFT-3009] - TSSLSocket does not use the correct hostname (breaks certificate checks) + * [THRIFT-3011] - C# test server testException() not implemented according to specs + * [THRIFT-3012] - Timing problems in NamedPipe implementation due to unnecessary open/close + * [THRIFT-3019] - Golang generator missing docstring for structs + * [THRIFT-3021] - Service remote tool does not import stub package with package prefix + * [THRIFT-3026] - TMultiplexedProcessor does not have a constructor + * [THRIFT-3028] - Regression caused by THRIFT-2180 + * [THRIFT-3017] - order of map key/value types incorrect for one CTOR + * [THRIFT-3020] - Cannot compile thrift as C++03 + * [THRIFT-3024] - User-Agent "BattleNet" used in some Thrift library files + * [THRIFT-3047] - Uneven calls to indent_up and indent_down in Cocoa generator + * [THRIFT-3048] - NodeJS decoding of I64 is inconsistent across protocols + * [THRIFT-3043] - go compiler generator uses non C++98 code + * [THRIFT-3044] - Docker README.md paths to Dockerfiles are incorrect + * [THRIFT-3040] - bower.json wrong "main" path + * [THRIFT-3051] - Go Thrift generator creates bad go code + * [THRIFT-3057] - Java compiler build is broken + * [THRIFT-3061] - C++ TSSLSocket shutdown delay/vulnerability + * [THRIFT-3062] - C++ TServerSocket invalid port number (over 999999) causes stack corruption + * [THRIFT-3065] - Update libthrift dependencies (slf4j, httpcore, httpclient) + * [THRIFT-3244] - TypeScript: fix namespace of included types + * [THRIFT-3246] - Reduce the number of trivial warnings in Windows C++ CMake builds + * [THRIFT-3224] - Fix TNamedPipeServer unpredictable behavior on accept + * [THRIFT-3230] - Python compiler generates wrong code if there is function throwing a typedef of exception with another namespace + * [THRIFT-3236] - MaxSkipDepth never checked + * [THRIFT-3239] - Limit recursion depth + * [THRIFT-3241] - fatal error: runtime: cannot map pages in arena address space + * [THRIFT-3242] - OSGi Import-Package directive is missing the Apache HTTP packages + * [THRIFT-3234] - Limit recursion depth + * [THRIFT-3222] - TypeScript: Generated Enums are quoted + * [THRIFT-3229] - unexpected Timeout exception when desired bytes are only partially available + * [THRIFT-3231] - CPP: Limit recursion depth to 64 + * [THRIFT-3235] - Limit recursion depth + * [THRIFT-3175] - fastbinary.c python deserialize can cause huge allocations from garbage + * [THRIFT-3176] - Union incorrectly implements == + * [THRIFT-3177] - Fails to run rake test + * [THRIFT-3180] - lua plugin: framed transport do not work + * [THRIFT-3179] - lua plugin cant connect to remote server because function l_socket_create_and_connect always bind socket to localhost + * [THRIFT-3248] - TypeScript: additional comma in method signature without parameters + * [THRIFT-3302] - Go JSON protocol should encode Thrift byte type as signed integer string + * [THRIFT-3297] - c_glib: an abstract base class is not generated + * [THRIFT-3294] - TZlibTransport for Java does not write data correctly + * [THRIFT-3296] - Go cross test does not conform to spec + * [THRIFT-3295] - C# library does not build on Mono 4.0.2.5 or later + * [THRIFT-3293] - JavaScript: null values turn into empty structs in constructor + * [THRIFT-3310] - lib/erl/README.md has incorrect formatting + * [THRIFT-3319] - CSharp tutorial will not build using the *.sln + * [THRIFT-3335] - Ruby server does not handle processor exception + * [THRIFT-3338] - Stray underscore in generated go when service name starts with "New" + * [THRIFT-3324] - Update Go Docs for pulling all packages + * [THRIFT-3345] - Clients blocked indefinitely when a java.lang.Error is thrown + * [THRIFT-3332] - make dist fails on clean build + * [THRIFT-3326] - Tests do not compile under *BSD + * [THRIFT-3334] - Markdown notation of protocol spec is malformed + * [THRIFT-3331] - warning: ‘etype’ may be used uninitialized in this function + * [THRIFT-3349] - Python server does not handle processor exception + * [THRIFT-3343] - Fix haskell README + * [THRIFT-3340] - Python: enable json tests again + * [THRIFT-3311] - Top level README.md has incorrect formmating + * [THRIFT-2936] - Minor memory leak in SSL + * [THRIFT-3290] - Using from in variable names causes the generated Python code to have errors + * [THRIFT-3225] - Fix TPipeServer unpredictable behavior on interrupt() + * [THRIFT-3354] - Fix word-extraction substr bug in initialism code + * [THRIFT-2006] - TBinaryProtocol message header call name length is not validated and can be used to core the server + * [THRIFT-3329] - C++ library unit tests don't compile against the new boost-1.59 unit test framework + * [THRIFT-2630] - windows7 64bit pc. ipv4 and ipv6 pc.can't use + * [THRIFT-3336] - Thrift generated streaming operators added in 0.9.2 cannot be overridden + * [THRIFT-2681] - Core of unwind_cleanup + * [THRIFT-3317] - cpp namespace org.apache issue appears in 0.9 + +## Documentation + * [THRIFT-3286] - Apache Ant is a necessary dependency + +## Improvement + * [THRIFT-227] - Byte[] in collections aren't pretty printed like regular binary fields + * [THRIFT-2744] - Vagrantfile for Centos 6.5 + * [THRIFT-2644] - Haxe support + * [THRIFT-2756] - register Media Type @ IANA + * [THRIFT-3076] - Compatibility with Haxe 3.2.0 + * [THRIFT-3081] - C++ Consolidate client processing loops in TServers + * [THRIFT-3083] - C++ Consolidate server processing loops in TSimpleServer, TThreadedServer, TThreadPoolServer + * [THRIFT-3084] - C++ add concurrent client limit to threaded servers + * [THRIFT-3074] - Add compiler/cpp/lex.yythriftl.cc to gitignore. + * [THRIFT-3134] - Remove use of deprecated "phantom.args" + * [THRIFT-3133] - Allow "make cross" and "make precross" to run without building all languages + * [THRIFT-3142] - Make JavaScript use downloaded libraries + * [THRIFT-3141] - Improve logging of JavaScript test + * [THRIFT-3144] - Proposal: make String representation of enums in generated go code less verbose + * [THRIFT-3130] - Remove the last vestiges of THRIFT_OVERLOAD_IF from THRIFT-1316 + * [THRIFT-3131] - Consolidate suggested import path for go thrift library to git.apache.org in docs and code + * [THRIFT-3092] - Generated Haskell types should derive Generic + * [THRIFT-3110] - Print error log after cross test failures on Travis + * [THRIFT-3114] - Using local temp variables to not pollute the global table + * [THRIFT-3106] - CMake summary should give more information why a library is set to off + * [THRIFT-3119] - Java's TThreadedSelectorServer has indistinguishable log messages in run() + * [THRIFT-3122] - Javascript struct constructor should properly initialize struct and container members from plain js arguments + * [THRIFT-3151] - Fix links to git-wip* - should be git.apache.org + * [THRIFT-3167] - Windows build from source instructions need to be revised + * [THRIFT-3155] - move contrib/mingw32-toolchain.cmake to build/cmake/ + * [THRIFT-3160] - Make generated go enums implement TextMarshaller and TextUnmarshaller interfaces + * [THRIFT-3150] - Add an option to thrift go generator to make Read and Write methods private + * [THRIFT-3149] - Make ReadFieldN methods in generated Go code private + * [THRIFT-3172] - Add tutorial to Thrift web site + * [THRIFT-3214] - Add Erlang option for using maps instead of dicts + * [THRIFT-3201] - Capture github test artifacts for failed builds + * [THRIFT-3266] - c_glib: Multiple compiler warnings building unit tests + * [THRIFT-3285] - c_glib: Build library with all warnings enabled, no warnings generated + * [THRIFT-1954] - Allow for a separate connection timeout value + * [THRIFT-2098] - Add support for Qt5+ + * [THRIFT-2199] - Remove Dense protocol (was: move to Contrib) + * [THRIFT-406] - C++ Test suite cleanup + * [THRIFT-902] - socket and connect timeout in TSocket should be distinguished + * [THRIFT-388] - Use a separate wire format for async calls + * [THRIFT-727] - support native C++ language specific exception message + * [THRIFT-1784] - pep-3110 compliance for exception handling + * [THRIFT-1025] - C++ ServerSocket should inherit from Socket with the necessary Ctor to listen on connections from a specific host + * [THRIFT-2269] - Can deploy libthrift-source.jar to maven center repository + * [THRIFT-2804] - Pull an interface out of TBaseAsyncProcessor + * [THRIFT-2806] - more whitespace fixups + * [THRIFT-2811] - Make remote socket address accessible + * [THRIFT-2809] - .gitignore update for compiler's visual project + * [THRIFT-2846] - Expose ciphers parameter from ssl.wrap_socket() + * [THRIFT-2859] - JSON generator: output complete descriptors + * [THRIFT-2861] - add buffered transport + * [THRIFT-2865] - Test case for Go: SeqId out of sequence + * [THRIFT-2866] - Go generator source code is hard to read and maintain + * [THRIFT-2880] - Read the network address from the listener if available. + * [THRIFT-2875] - Typo in TDenseProtocol.h comment + * [THRIFT-2874] - TBinaryProtocol member variable "string_buf_" is never used. + * [THRIFT-2855] - Move contributing.md to the root of the repository + * [THRIFT-2862] - Enable RTTI and/or build macros for generated code + * [THRIFT-2876] - Add test for THRIFT-2526 Assignment operators and copy constructors in c++ don't copy the __isset struct + * [THRIFT-2897] - Generate -isEqual: and -hash methods + * [THRIFT-2909] - Improve travis build + * [THRIFT-2921] - Make Erlang impl ready for OTP 18 release (dict/0 and set/0 are deprecated) + * [THRIFT-2928] - Rename the erlang test_server module + * [THRIFT-2940] - Allow installing Thrift from git as NPM module by providing package.json in top level directory + * [THRIFT-2937] - Allow setting a maximum frame size in TFramedTransport + * [THRIFT-2976] - nodejs: xhr and websocket support for browserify + * [THRIFT-2996] - Test for Haxe 3.1.3 or better + * [THRIFT-2969] - nodejs: DRY up library tests + * [THRIFT-2973] - Update Haxe lib readme regarding Haxe 3.1.3 + * [THRIFT-2952] - Improve handling of Server.Stop() + * [THRIFT-2964] - nodejs: move protocols and transports into separate files + * [THRIFT-2963] - nodejs - add test coverage + * [THRIFT-3006] - Attach 'omitempty' json tag for optional fields in Go + * [THRIFT-3027] - Go compiler does not ensure common initialisms have consistent case + * [THRIFT-3030] - TThreadedServer: Property for number of clientThreads + * [THRIFT-3023] - Go compiler is a little overly conservative with names of attributes + * [THRIFT-3018] - Compact protocol for Delphi + * [THRIFT-3025] - Change pure Int constants into @enums (where possible) + * [THRIFT-3031] - migrate "shouldStop" flag to TServer + * [THRIFT-3022] - Compact protocol for Haxe + * [THRIFT-3041] - Generate asynchronous clients for Cocoa + * [THRIFT-3053] - Perl SSL Socket Support (Encryption) + * [THRIFT-3247] - Generate a C++ thread-safe client + * [THRIFT-3217] - Provide a little endian variant of the binary protocol in C++ + * [THRIFT-3223] - TypeScript: Add initial support for Enum Maps + * [THRIFT-3220] - Option to suppress @Generated Annotation entirely + * [THRIFT-3300] - Reimplement TZlibTransport in Java using streams + * [THRIFT-3288] - c_glib: Build unit tests with all warnings enabled, no warnings generated + * [THRIFT-3347] - Improve cross test servers and clients + * [THRIFT-3342] - Improve ruby cross test client and server compatibility + * [THRIFT-2296] - Add C++ Base class for service + * [THRIFT-3337] - Add testBool method to cross tests + * [THRIFT-3303] - Disable concurrent cabal jobs on Travis to avoid GHC crash + * [THRIFT-2623] - Docker container for Thrift + * [THRIFT-3298] - thrift endian converters may conflict with other libraries + * [THRIFT-1559] - Provide memory pool for TBinaryProtocol to eliminate memory fragmentation + * [THRIFT-424] - Steal ProtocolBuffers' VarInt implementation for C++ + +## New Feature + * [THRIFT-3070] - Add ability to set the LocalCertificateSelectionCallback + * [THRIFT-1909] - Java: Add compiler flag to use the "option pattern" for optional fields + * [THRIFT-2099] - Stop TThreadPoolServer with alive connections. + * [THRIFT-123] - implement TZlibTransport in Java + * [THRIFT-2368] - New option: reuse-objects for Java generator + * [THRIFT-2836] - Optionally generate C++11 MoveConstructible types + * [THRIFT-2824] - Flag to disable html escaping doctext + * [THRIFT-2819] - Add WebsSocket client to node.js + * [THRIFT-3050] - Client certificate authentication for non-http TLS in C# + * [THRIFT-3292] - Implement TZlibTransport in Go + +## Question + * [THRIFT-2583] - Thrift on xPC target (SpeedGoat) + * [THRIFT-2592] - thrift server using c_glib + * [THRIFT-2832] - c_glib: Handle string lists correctly + * [THRIFT-3136] - thrift installation problem on mac + * [THRIFT-3346] - c_glib: Tutorials example crashes saying Calculator.ping implementation returned FALSE but did not set an error + +## Sub-task + * [THRIFT-2578] - Moving 'make cross' from test.sh to test.py + * [THRIFT-2734] - Go coding standards + * [THRIFT-2748] - Add Vagrantfile for Centos 6.5 + * [THRIFT-2753] - Misc. Haxe improvements + * [THRIFT-2640] - Compact Protocol in Cocoa + * [THRIFT-3262] - warning: overflow in implicit constant conversion in DenseProtoTest.cpp + * [THRIFT-3194] - Can't build with go enabled. gomock SCC path incorrect. + * [THRIFT-3275] - c_glib tutorial warnings in generated code + * [THRIFT-1125] - Multiplexing support for the Ruby Library + * [THRIFT-2807] - PHP Code Style + * [THRIFT-2841] - Add comprehensive integration tests for the whole Go stack + * [THRIFT-2815] - Haxe: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-2886] - Integrate binary type in standard Thrift cross test + * [THRIFT-2946] - Enhance usability of cross test framework + * [THRIFT-2967] - Add .editorconfig to root + * [THRIFT-3033] - Perl: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-3174] - Initialism code in the Go compiler doesn't check first word + * [THRIFT-3193] - Option to supress date value in @Generated annotation + * [THRIFT-3305] - Missing dist files for 0.9.3 release candidate + * [THRIFT-3341] - Add testBool methods + * [THRIFT-3308] - Fix broken test cases for 0.9.3 release candidate + +## Task + * [THRIFT-2834] - Remove semi-colons from python code generator + * [THRIFT-2853] - Adjust comments not applying anymore after THRIFT-2852 + +## Test + * [THRIFT-3211] - Add make cross support for php TCompactProtocol + +## Wish + * [THRIFT-2838] - TNonblockingServer can bind to port 0 (i.e., get an OS-assigned port) but there is no way to get the port number + + + +Thrift 0.9.2 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-2793] - Go compiler produces uncompilable code + * [THRIFT-1481] - Unix domain sockets in C++ do not support the abstract namespace + * [THRIFT-1455] - TBinaryProtocolT::writeString casts from size_t to uint32_t, which is not safe on 64-bit platforms + * [THRIFT-1579] - PHP Extention - function thrift_protocol_read_binary not working from TBinarySerializer::deserialize + * [THRIFT-1584] - Error: could not SetMinThreads in ThreadPool on single-core machines + * [THRIFT-1614] - Thrift build from svn repo sources fails with automake-1.12 + * [THRIFT-1047] - rb_thrift_memory_buffer_write treats arg as string without check, segfaults if you pass non-string + * [THRIFT-1639] - Java/Python: Serialization/Deserialization of double type using CompactProtocol + * [THRIFT-1647] - NodeJS BufferedTransport does not work beyond the hello-world example + * [THRIFT-2130] - Thrift's D library/test: parts of "make check" code do not compile with recent dmd-2.062 through dmd-2.064alpha + * [THRIFT-2140] - Error compiling cpp tutorials + * [THRIFT-2139] - MSVC 2012 Error - Cannot compile due to BoostThreadFactory + * [THRIFT-2138] - pkgconfig file created with wrong include path + * [THRIFT-2160] - Warning in thrift.h when compiling with -Wunused and NDEBUG + * [THRIFT-2158] - Compact, JSON, and SimpleJSON protocols are not working correctly + * [THRIFT-2167] - nodejs lib throws error if options argument isn't passed + * [THRIFT-2288] - Go impl of Thrift JSON protocol wrongly writes/expects true/false for bools + * [THRIFT-2147] - Thrift IDL grammar allows for dotted identifier names + * [THRIFT-2145] - Rack and Thin are not just development dependencies + * [THRIFT-2267] - Should be able to choose socket family in Python TSocket + * [THRIFT-2276] - java path in spec file needs updating + * [THRIFT-2281] - Generated send/recv code ignores errors returned by the underlying protocol + * [THRIFT-2280] - TJSONProtocol.Flush() does not really flush the transport + * [THRIFT-2274] - TNonblockingServer and TThreadedSelectorServer do not close their channel selectors on exit and leak file descriptors + * [THRIFT-2265] - php library doesn't build + * [THRIFT-2232] - IsSet* broken in Go + * [THRIFT-2246] - Unset enum value is printed by ToString() + * [THRIFT-2240] - thrift.vim (contrib) does not correctly handle 'union' + * [THRIFT-2243] - TNonblockingServer in thrift crashes when TFramedTransport opens + * [THRIFT-2230] - Cannot Build on RHEL/Centos/Amazon Linux 6.x + * [THRIFT-2247] - Go generator doesn't deal well with map keys of type binary + * [THRIFT-2253] - Python Tornado TTornadoServer base class change + * [THRIFT-2261] - java: error: unmappable character for encoding ASCII + * [THRIFT-2259] - C#: unexpected null logDelegate() pointer causes AV in TServer.serve() + * [THRIFT-2225] - SSLContext destroy before cleanupOpenSSL + * [THRIFT-2224] - TSSLSocket.h and TSSLServerSocket.h should use the platfromsocket too + * [THRIFT-2229] - thrift failed to build on OSX 10.9 GM + * [THRIFT-2227] - Thrift compiler generates spurious warnings with Xlint + * [THRIFT-2219] - Thrift gem fails to build on OS X Mavericks with 1.9.3 rubies + * [THRIFT-2226] - TServerSocket - keepAlive wrong initialization order + * [THRIFT-2285] - TJsonProtocol implementation for Java doesn't allow a slash (/) to be escaped (\/) + * [THRIFT-2216] - Extraneous semicolon in TProtocolUtil.h makes clang mad + * [THRIFT-2215] - Generated HTML/Graphviz lists referenced enum identifiers as UNKNOWN. + * [THRIFT-2211] - Exception constructor does not contain namespace prefix. + * [THRIFT-2210] - lib/java TSimpleJSONProtocol can emit invalid JSON + * [THRIFT-2209] - Ruby generator -- please namespace classes + * [THRIFT-2202] - Delphi TServerImpl.DefaultLogDelegate may stop the server with I/O-Error 105 + * [THRIFT-2201] - Ternary operator returns different types (build error for some compilers) + * [THRIFT-2200] - nested structs cause generate_fingerprint() to slow down at excessive CPU load + * [THRIFT-2197] - fix jar output directory in rpm spec file + * [THRIFT-2196] - Fix invalid dependency in Makefile.am + * [THRIFT-2194] - Node: Not actually prepending residual data in TFramedTransport.receiver + * [THRIFT-2193] - Java code generator emits spurious semicolon when deep copying binary data + * [THRIFT-2191] - Fix charp JSONProtocol.ReadJSONDouble (specify InvariantCulture) + * [THRIFT-2214] - System header sys/param.h is included inside the Thrift namespace + * [THRIFT-2178] - Thrift generator returns error exit code on --version + * [THRIFT-2171] - NodeJS implementation has extremely low test coverage + * [THRIFT-2183] - gem install fails on zsh + * [THRIFT-2182] - segfault in regression tests (GC bug in rb_thrift_memory_buffer_write) + * [THRIFT-2181] - oneway calls don't work in NodeJS + * [THRIFT-2169] - JavaME Thrift Library causes "java.io.IOException: No Response Entries Available" after using the Thrift client for some time + * [THRIFT-2168] - Node.js appears broken (at least, examples don't work as intended) + * [THRIFT-2293] - TSSLTransportFactory.createSSLContext() leaves files open + * [THRIFT-2279] - TSerializer only returns the first 1024 bytes serialized + * [THRIFT-2278] - Buffered transport doesn't support writes > buffer size + * [THRIFT-2275] - Fix memory leak in golang compact_protocol. + * [THRIFT-2282] - Incorect code generated for some typedefs + * [THRIFT-2009] - Go redeclaration error + * [THRIFT-1964] - 'Isset' causes problems with C#/.NET serializers + * [THRIFT-2026] - Fix TCompactProtocol 64 bit builds + * [THRIFT-2108] - Fix TAsyncClientManager timeout race + * [THRIFT-2068] - Multiple calls from same connection are not processed in node + * [THRIFT-1750] - Make compiler build cleanly under visual studio 10 + * [THRIFT-1755] - Comment parsing bug + * [THRIFT-1771] - "make check" fails on x64 for libboost_unit_test_framework.a + * [THRIFT-1841] - NodeJS Thrift incorrectly parses non-UTF8-string types + * [THRIFT-1908] - Using php thrift_protocol accelerated transfer causes core dump + * [THRIFT-1892] - Socket timeouts are declared in milli-seconds, but are actually set in micro-seconds + * [THRIFT-2303] - TBufferredTransport not properly closing underlying transport + * [THRIFT-2313] - nodejs server crash after processing the first request when using MultiplexedProcessor/FramedBuffer/BinaryProtocol + * [THRIFT-2311] - Go: invalid code generated when exception name is a go keyword + * [THRIFT-2308] - node: TJSONProtocol parse error when reading from buffered message + * [THRIFT-2316] - ccp: TFileTransportTest + * [THRIFT-2352] - msvc failed to compile thrift tests + * [THRIFT-2337] - Golang does not report TIMED_OUT exceptions + * [THRIFT-2340] - Generated server implementation does not send response type EXCEPTION on the Thrift.TApplicationExceptionType.UNKNOWN_METHOD exception + * [THRIFT-2354] - Connection errors can lead to case_clause exceptions + * [THRIFT-2339] - Uncaught exception in thrift c# driver + * [THRIFT-2356] - c++ thrift client not working with ssl (SSL_connect hangs) + * [THRIFT-2331] - Missing call to ReadStructBegin() in TApplicationException.Read() + * [THRIFT-2323] - Uncompileable Delphi code generated for typedef'd structs + * [THRIFT-2322] - Correctly show the number of times ExecutorService (java) has rejected the client. + * [THRIFT-2389] - namespaces handled wrongly in acrionscript 3.0 implementation + * [THRIFT-2388] - GoLang - Fix data races in simple_server and server_socket + * [THRIFT-2386] - Thrift refuses to link yylex + * [THRIFT-2375] - Excessive
's in generated HTML + * [THRIFT-2373] - warning CS0414 in THttpClient.cs: private field 'Thrift.Transport.THttpClient.connection' assigned but never used + * [THRIFT-2372] - thrift/json_protocol.go:160: function ends without a return statement + * [THRIFT-2371] - ruby bundler version fails on ~1.3.1, remove and take latest avail + * [THRIFT-2370] - Compiler SEGFAULTs generating HTML documentation for complex strucre + * [THRIFT-2384] - Binary map keys produce uncompilable code in go + * [THRIFT-2380] - unreachable code (CID 1174546, CID 1174679) + * [THRIFT-2378] - service method arguments of binary type lead to uncompileable Go code + * [THRIFT-2363] - Issue with character encoding of Success returned from Login using Thrift Proxy and NodeJS + * [THRIFT-2359] - TBufferedTransport doesn't clear it's buffer on a failed flush call + * [THRIFT-2428] - Python 3 setup.py support + * [THRIFT-2367] - Build failure: stdlib and boost both define uint64_t + * [THRIFT-2365] - C# decodes too many binary bytes from JSON + * [THRIFT-2402] - byte count of FrameBuffer in AWAITING_CLOSE state is not subtracted from readBufferBytesAllocated + * [THRIFT-2396] - Build Error on MacOSX + * [THRIFT-2395] - thrift Ruby gem requires development dependency 'thin' regardless of environment + * [THRIFT-2414] - c_glib fix several bug. + * [THRIFT-2420] - Go argument parser for methods without arguments does not skip fields + * [THRIFT-2439] - Bug in TProtocolDecorator Class causes parsing errors + * [THRIFT-2419] - golang - Fix fmt.Errorf in generated code + * [THRIFT-2418] - Go handler function panics on internal error + * [THRIFT-2405] - Node.js Multiplexer tests fail (silently) + * [THRIFT-2581] - TFDTransport destructor should not throw + * [THRIFT-2575] - Thrift includes siginfo_t within apache::thrift::protocol namespace + * [THRIFT-2577] - TFileTransport missuse of closesocket on windows platform + * [THRIFT-2576] - Implement Thrift.Protocol.prototype.skip method in JavaScript library + * [THRIFT-2588] - Thrift compiler is not buildable in Visual Studio 2010 + * [THRIFT-2594] - JS Compiler: Single quotes are not being escaped in constants. + * [THRIFT-2591] - TFramedTransport does not handle payloads split across packets correctly + * [THRIFT-2599] - Uncompileable Delphi code due to naming conflicts with IDL + * [THRIFT-2590] - C++ Visual Studio solution doesn't include Multiplexing support + * [THRIFT-2595] - Node.js: Fix global leaks and copy-paste errors + * [THRIFT-2565] - autoconf fails to find mingw-g++ cross compiler on travis CI + * [THRIFT-2555] - excessive "unused field" comments + * [THRIFT-2554] - double initialization in generated Read() method + * [THRIFT-2551] - OutOfMemoryError "unable to create new native thread" kills serve thread + * [THRIFT-2543] - Generated enum type in haskell should be qualified + * [THRIFT-2560] - Thrift compiler generator tries to concat ints with strings using + + * [THRIFT-2559] - Centos 6.5 unable to "make" with Thrift 0.9.1 + * [THRIFT-2526] - Assignment operators and copy constructors in c++ don't copy the __isset struct + * [THRIFT-2454] - c_glib: There is no gethostbyname_r() in some OS. + * [THRIFT-2451] - Do not use pointers for optional fields with defaults. Do not write such fields if its value set to default. Also, do not use pointers for any optional fields mapped to go map or slice. generate Get accessors + * [THRIFT-2450] - include HowToContribute in the src repo + * [THRIFT-2448] - thrift/test/test.sh has incorrect Node.js test path + * [THRIFT-2460] - unopened socket fd must be less than zero. + * [THRIFT-2459] - --version should not exit 1 + * [THRIFT-2468] - Timestamp handling + * [THRIFT-2467] - Unable to build contrib/fb303 on OSX 10.9.2 + * [THRIFT-2466] - Improper error handling for SSL/TLS connections that don't complete a handshake + * [THRIFT-2463] - test/py/RunClientServer.py fails sometimes + * [THRIFT-2458] - Generated golang server code for "oneway" methods is incorrect + * [THRIFT-2456] - THttpClient fails when using async support outside Silverlight + * [THRIFT-2524] - Visual Studio project is missing TThreadedServer files + * [THRIFT-2523] - Visual Studio project is missing OverlappedSubmissionThread files + * [THRIFT-2520] - cpp:cob_style generates incorrect .tcc file + * [THRIFT-2508] - Uncompileable C# code due to language keywords in IDL + * [THRIFT-2506] - Update TProtocolException error codes to be used consistently throughout the library + * [THRIFT-2505] - go: struct should always be a pointer to avoid copying of potentially size-unbounded structs + * [THRIFT-2515] - TLS Method error during make + * [THRIFT-2503] - C++: Fix name collision when a struct has a member named "val" + * [THRIFT-2477] - thrift --help text with misplaced comma + * [THRIFT-2492] - test/cpp does not compile on mac + * [THRIFT-2500] - sending random data crashes thrift(golang) service + * [THRIFT-2475] - c_glib: buffered_transport_write function return always TRUE. + * [THRIFT-2495] - JavaScript/Node string constants lack proper escaping + * [THRIFT-2491] - unable to import generated ThriftTest service + * [THRIFT-2490] - c_glib: if fail to read a exception from server, client may be occurred double free + * [THRIFT-2470] - THttpHandler swallows exceptions from processor + * [THRIFT-2533] - Boost version in requirements should be updated + * [THRIFT-2532] - Java version in installation requirements should be updated + * [THRIFT-2529] - TBufferedTransport split Tcp data bug in nodeJs + * [THRIFT-2537] - Path for "go get" does not work (pull request 115) + * [THRIFT-2443] - Node fails cross lang tests + * [THRIFT-2437] - Author fields in Python setup.py must be strings not lists. + * [THRIFT-2435] - Java compiler doesn't like struct member names that are identical to an existing enum or struct type + * [THRIFT-2434] - Missing namespace import for php TMultiplexedProcessor implementation + * [THRIFT-2432] - Flaky parallel build + * [THRIFT-2430] - Crash during TThreadPoolServer shutdown + * [THRIFT-667] - Period should not be allowed in identifier names + * [THRIFT-1212] - Members capital case conflict + * [THRIFT-2584] - Error handler not listened on javascript client + * [THRIFT-2294] - Incorrect Makefile generation + * [THRIFT-2601] - Fix vagrant to work again for builds again + * [THRIFT-2092] - TNonblocking server should release handler as soon as connection closes + * [THRIFT-2557] - CS0542 member names cannot be the same as their enclosing type + * [THRIFT-2605] - TSocket warning on gcc 4.8.3 + * [THRIFT-2607] - ThreadManager.cpp warning on clang++ 3.4 + * [THRIFT-1998] - TCompactProtocol.tcc - one more warning on Visual 2010 + * [THRIFT-2610] - MSVC warning in TSocket.cpp + * [THRIFT-2614] - TNonblockingServer.cpp warnings on MSVC + * [THRIFT-2608] - TNonblockingServer.cpp warnings on clang 3.4 + * [THRIFT-2606] - ThreadManager.h warning in clang++ 3.4 + * [THRIFT-2609] - TFileTransport.h unused field warning (clang 3.4) + * [THRIFT-2416] - Cannot use TCompactProtocol with MSVC + * [THRIFT-1803] - Ruby Thrift 0.9.0 tries to encode UUID to UTF8 and crashes + * [THRIFT-2385] - Problem with gethostbyname2 during make check + * [THRIFT-2262] - thrift server 'MutateRow' operation gives no indication of success / failure + * [THRIFT-2048] - Prefer boolean context to nullptr_t conversion + * [THRIFT-2528] - Thrift Erlang Library: Multiple thrift applications in one bundle + * [THRIFT-1999] - warning on gcc 4.7 while compiling BoostMutex.cpp + * [THRIFT-2104] - Structs lose binary data when transferred from server to client in Java + * [THRIFT-2184] - undefined method rspec_verify for Thrift::MemoryBufferTransport + * [THRIFT-2351] - PHP TCompactProtocol has fails to decode messages + * [THRIFT-2016] - Resource Leak in thrift struct under compiler/cpp/src/parse/t_function.h + * [THRIFT-2273] - Please delete old releases from mirroring system + * [THRIFT-2270] - Faulty library version numbering at build or documentation + * [THRIFT-2203] - Tests keeping failing on Jenkins and Travis CI + * [THRIFT-2399] - thrift.el: recognize "//"-style comments in emacs thrift-mode + * [THRIFT-2582] - "FileTransport error" exception is raised when trying to use Java's TFileTransport + * [THRIFT-1682] - Multiple thread calling a Service function unsafely causes message corruption and terminates with Broken Pipe + * [THRIFT-2357] - recurse option has no effect when generating php + * [THRIFT-2248] - Go generator doesn't deal well with map keys of type binary + * [THRIFT-2426] - clarify IP rights and contributions from fbthrift + * [THRIFT-2041] - TNonblocking server compilation on windows (ARITHMETIC_RIGHT_SHIFT) + * [THRIFT-2400] - thrift.el: recognize "//"-style comments in emacs thrift-mode + * [THRIFT-1717] - Fix deb build in jenkins + * [THRIFT-2266] - ThreadManager.h:24:10: fatal error: 'tr1/functional' file not found on Mac 10.9 (Mavericks) + * [THRIFT-1300] - Test failures with parallel builds (make -j) + * [THRIFT-2487] - Tutorial requires two IDL files but only one is linked from the Thrift web site + * [THRIFT-2329] - missing release tags within git + * [THRIFT-2306] - concurent client calls with nodejs + * [THRIFT-2222] - ruby gem cannot be compiled on OS X mavericks + * [THRIFT-2381] - code which generated by thrift2/hbase.thrift compile error + * [THRIFT-2390] - no close event when connection lost + * [THRIFT-2146] - Unable to pass multiple "--gen" options to the thrift compiler + * [THRIFT-2438] - Unexpected readFieldEnd call causes JSON Parsing errors + * [THRIFT-2498] - Error message "Invalid method name" while trying to call HBase Thrift API + * [THRIFT-841] - Build cruft + * [THRIFT-2570] - Wrong URL given in http://thrift.apache.org/developers + * [THRIFT-2604] - Fix debian packaging + * [THRIFT-2618] - Unignore /aclocal files required for build + * [THRIFT-2562] - ./configure create MakeFile in lib/d with errors + * [THRIFT-2593] - Unable to build thrift on ubuntu-12.04 (Precise) + * [THRIFT-2461] - Can't install thrift-0.8.0 on OS X 10.9.2 + * [THRIFT-2602] - Fix missing dist files + * [THRIFT-2620] - Fix python packaging + * [THRIFT-2545] - Test CPP fails to build (possibly typo) + +## Documentation + * [THRIFT-2155] - Adding one liner guide to rename the version.h.in and rename thrifty.cc.h + * [THRIFT-1991] - Add exceptions to examples + * [THRIFT-2334] - add a tutorial for node JS + * [THRIFT-2392] - Actionscript tutorial + * [THRIFT-2383] - contrib: sample for connecting Thrift with Rebus + * [THRIFT-2382] - contrib: sample for connecting Thrift with STOMP + +## Improvement + * [THRIFT-1457] - Capacity of TframedTransport write buffer is never reset + * [THRIFT-1135] - Node.js tutorial + * [THRIFT-1371] - Socket timeouts (SO_RCVTIMEO and SO_SNDTIMEO) not supported on Solaris + * [THRIFT-2142] - Minor tweaks to thrift.el for better emacs package compatibility + * [THRIFT-2268] - Modify TSaslTransport to ignore TCP health checks from loadbalancers + * [THRIFT-2264] - GitHub page incorrectly states that Thrift is still incubating + * [THRIFT-2263] - Always generate good hashCode for Java + * [THRIFT-2233] - Java compiler should defensively copy its binary inputs + * [THRIFT-2239] - Address FindBugs errors + * [THRIFT-2249] - Add SMP Build option to thrift.spec (and three config defines) + * [THRIFT-2254] - Exceptions generated by Go compiler should implement error interface + * [THRIFT-2260] - Thrift imposes unneeded dependency on commons-lang3 + * [THRIFT-2258] - Add TLS v1.1/1.2 support to TSSLSocket.cpp + * [THRIFT-2205] - Node.js Test Server to support test.js JavaScript Browser test and sundry fixes + * [THRIFT-2204] - SSL client for the cocoa client + * [THRIFT-2172] - Java compiler allocates optionals array for every struct with an optional field + * [THRIFT-2185] - use cabal instead of runhaskell in haskell library + * [THRIFT-1926] - PHP Constant Generation Refactoring + * [THRIFT-2029] - Port C++ tests to Windows + * [THRIFT-2054] - TSimpleFileTransport - Java Lib has no straight forward TTransport based file transport + * [THRIFT-2040] - "uninitialized variable" warnings on MSVC/windows + * [THRIFT-2034] - Give developers' C++ code direct access to socket FDs on server side + * [THRIFT-2095] - Use print function for Python 3 compatiblity + * [THRIFT-1868] - Make the TPC backlog configurable in the Java servers + * [THRIFT-1813] - Add @Generated annotation to generated classes + * [THRIFT-1815] - Code generators line buffer output + * [THRIFT-2305] - TFramedTransport empty constructor should probably be private + * [THRIFT-2304] - Move client assignments from construtor in method + * [THRIFT-2309] - Ruby (gem) & PHP RPM subpackages + * [THRIFT-2318] - perl: dependency Class::Accessor not checked + * [THRIFT-2317] - exclude tutorial from build + * [THRIFT-2320] - Program level doctext does not get attached by parser + * [THRIFT-2349] - Golang - improve tutorial + * [THRIFT-2348] - PHP Generator: add array typehint to functions + * [THRIFT-2344] - configure.ac: compiler-only option + * [THRIFT-2343] - Golang - Return a single error for all exceptions instead of multiple return values + * [THRIFT-2341] - Enable generation of Delphi XMLDoc comments (a.k.a. "Help Insight") + * [THRIFT-2355] - Add SSL and Web Socket Support to Node and JavaScript + * [THRIFT-2350] - Add async calls to normal JavaScript + * [THRIFT-2330] - Generate PHPDoc comments + * [THRIFT-2332] - RPMBUILD: run bootstrap (if needed) + * [THRIFT-2391] - simple socket transport for actionscript 3.0 + * [THRIFT-2376] - nodejs: allow Promise style calls for client and server + * [THRIFT-2369] - Add ssl support for nodejs implementation + * [THRIFT-2401] - Haskell tutorial compiles + * [THRIFT-2417] - C# Union classes are not partial + * [THRIFT-2415] - Named pipes server performance & message mode + * [THRIFT-2404] - emit warning on (typically inefficient) list + * [THRIFT-2398] - Improve Node Server Library + * [THRIFT-2397] - Add CORS and CSP support for JavaScript and Node.js libraries + * [THRIFT-2407] - use markdown (rename README => README.md) + * [THRIFT-2300] - D configure info output should follow same format as other languages + * [THRIFT-2579] - Windows CE support + * [THRIFT-2574] - Compiler option to generate namespace directories for Ruby + * [THRIFT-2571] - Simplify cross compilation using CMake + * [THRIFT-2569] - Introduce file to specify third party library locations on Windows + * [THRIFT-2568] - Implement own certificate handler + * [THRIFT-2552] - eliminate warning from configure.ac + * [THRIFT-2549] - Generate json tag for struct members. use go.tag annotation to override the default generated tag. + * [THRIFT-2544] - Add support for socket transport for c# library when using Windows Phone projects + * [THRIFT-2453] - haskell tutorial: fix up division by 0 example + * [THRIFT-2449] - Enhance typedef structure to distinguish between forwards and real typedefs + * [THRIFT-2446] - There is no way to handle server stream errors + * [THRIFT-2455] - Allow client certificates to be used with THttpClient + * [THRIFT-2511] - Node.js needs the compact protocol + * [THRIFT-2493] - Node.js lib needs HTTP client + * [THRIFT-2502] - Optimize go implementations of binary and compact protocols for speed + * [THRIFT-2494] - Add enum toString helper function in c_glib + * [THRIFT-2471] - Make cpp.ref annotation language agnostic + * [THRIFT-2497] - server and client for test/go, also several fixes and improvements + * [THRIFT-2535] - TJSONProtocol when serialized yields TField ids rather than names + * [THRIFT-2220] - Add a new struct structv? + * [THRIFT-1352] - Thrift server + * [THRIFT-989] - Push boost m4 macros upstream + * [THRIFT-1349] - Remove unnecessary print outs + * [THRIFT-2496] - server and client for test/go, also several fixes and improvements + * [THRIFT-1114] - Maven publish shouldn't require passwords hardcoded in settings.xml + * [THRIFT-2043] - visual 2010 warnings - unreachable code + * [THRIFT-1683] - Implement alternatives to Javascript Client side Transport protocol, just as NPAPI and WebSocket. + * [THRIFT-1746] - provide a SPDX file + * [THRIFT-1772] - Serialization does not check types of embedded structures. + * [THRIFT-2387] - nodejs: external imports should be centralized in index.js + * [THRIFT-2037] - More general macro THRIFT_UNUSED_VARIABLE + +## New Feature + * [THRIFT-1012] - Transport for DataInput DataOutput interface + * [THRIFT-2256] - Using c++11/c++0x std library replace boost library + * [THRIFT-2250] - JSON and MemoryBuffer for JavaME + * [THRIFT-2114] - Python Service Remote SSL Option + * [THRIFT-1719] - SASL client support for Python + * [THRIFT-1894] - Thrift multi-threaded async Java Server using Java 7 AsynchronousChannelGroup + * [THRIFT-1893] - HTTP/JSON server/client for node js + * [THRIFT-2347] - C# TLS Transport based on THRIFT-181 + * [THRIFT-2377] - Allow addition of custom HTTP Headers to an HTTP Transport + * [THRIFT-2408] - Named Pipe Transport Option for C# + * [THRIFT-2572] - Add string/collection length limit checks (from C++) to java protocol readers + * [THRIFT-2469] - "java:fullcamel" option to automatically camel-case underscored attribute names + * [THRIFT-795] - Importing service functions (simulation multiple inheritance) + * [THRIFT-2164] - Add a Get/Post Http Server to Node along with examples + * [THRIFT-2255] - add Parent Class for generated Struct class + +## Question + * [THRIFT-2539] - Tsocket.cpp addrinfo ai_flags = AI_ADDRCONFIG + * [THRIFT-2440] - how to connect as3 to java by thrift , + * [THRIFT-2379] - Memmory leaking while using multithreading in C++ server. + * [THRIFT-2277] - Thrift: installing fb303 error + * [THRIFT-2567] - Csharp slow ? + * [THRIFT-2573] - thrift 0.9.2 release + +## Sub-task + * [THRIFT-981] - cocoa: add version Info to the library + * [THRIFT-2132] - Go: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-2299] - TJsonProtocol implementation for Ruby does not allow for both possible slash (solidus) encodings + * [THRIFT-2298] - TJsonProtocol implementation for C# does not allow for both possible slash (solidus) encodings + * [THRIFT-2297] - TJsonProtocol implementation for Delphi does not allow for both possible slash (solidus) encodings + * [THRIFT-2271] - JavaScript: Support for Multiplexing Services + * [THRIFT-2251] - go test for compact protocol is not running + * [THRIFT-2195] - Delphi: Add event handlers for server and processing events + * [THRIFT-2176] - TSimpleJSONProtocol.ReadFieldBegin() does not return field type and ID + * [THRIFT-2175] - Wrong field type set for binary + * [THRIFT-2174] - Deserializing JSON fails in specific cases + * [THRIFT-2053] - NodeJS: Support for Multiplexing Services + * [THRIFT-1914] - Python: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-1810] - add ruby to test/test.sh + * [THRIFT-2310] - PHP: Client-side support for Multiplexing Services + * [THRIFT-2346] - C#: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2345] - Delphi: UTF-8 sent by PHP as JSON is not understood by TJsonProtocol + * [THRIFT-2338] - First doctext wrongly interpreted as program doctext in some cases + * [THRIFT-2325] - SSL test certificates + * [THRIFT-2358] - C++: add compact protocol to cross language test suite + * [THRIFT-2425] - PHP: Server-side support for Multiplexing Services + * [THRIFT-2421] - Tree/Recursive struct support in thrift + * [THRIFT-2290] - Update Go tutorial to align with THRIFT-2232 + * [THRIFT-2558] - CSharp compiler generator tries to concat ints with strings using + + * [THRIFT-2507] - Additional LUA TProtocolException error code needed? + * [THRIFT-2499] - Compiler: allow annotations without "= value" + * [THRIFT-2534] - Cross language test results should recorded to a status.md or status.html file automatically + * [THRIFT-66] - Java: Allow multiplexing multiple services over a single TCP connection + * [THRIFT-1681] - Add Lua Support + * [THRIFT-1727] - Ruby-1.9: data loss: "binary" fields are re-encoded + * [THRIFT-1726] - Ruby-1.9: "binary" fields are represented by string whose encoding is "UTF-8" + * [THRIFT-988] - perl: add version Info to the library via configure + * [THRIFT-334] - Compact Protocol for PHP + * [THRIFT-2444] - pull request 88: thrift: clean up enum value assignment + +## Task + * [THRIFT-2223] - Spam links on wiki + * [THRIFT-2566] - Please create a DOAP file for your TLP + * [THRIFT-2237] - Update archive to contain all versions + * [THRIFT-962] - Tutorial page on our website is really unhelpful + +## Test + * [THRIFT-2327] - nodejs: nodejs test suite should be bundled with the library + * [THRIFT-2445] - THRIFT-2384 (code generation for go maps with binary keys) should be tested + * [THRIFT-2501] - C# The test parameters from the TestServer and TestClient are different from the http://thrift.apache.org/test/ + +## Wish + * [THRIFT-2190] - Add the JavaScript thrift.js lib to the Bower registry + * [THRIFT-2076] - boost::optional instead of __isset + + + +Thrift 0.9.1 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1440] - debian packaging: minor-ish policy problems + * [THRIFT-1402] - Generated Y_types.js does not require() X_types.js when an include in the IDL file was used + * [THRIFT-1551] - 2 thrift file define only struct (no service), one include another, the gen nodejs file didn't have "requires" at the top + * [THRIFT-1264] - TSocketClient is queried by run loop after deallocation in Cocoa + * [THRIFT-1600] - Thrift Go Compiler and Library out of date with Go 1 Release. + * [THRIFT-1603] - Thrift IDL allows for multiple exceptions, args or struct member names to be the same + * [THRIFT-1062] - Problems with python tutorials + * [THRIFT-864] - default value fails if identifier is a struct + * [THRIFT-930] - Ruby and Haskell bindings don't properly support DESTDIR (makes packaging painful) + * [THRIFT-820] - The readLength attribute of TBinaryProtocol is used as an instance variable and is decremented on each call of checkReadLength + * [THRIFT-1640] - None of the tutorials linked on the website contain content + * [THRIFT-1637] - NPM registry does not include version 0.8 + * [THRIFT-1648] - NodeJS clients always receive 0 for 'double' values. + * [THRIFT-1660] - Python Thrift library can be installed with pip but not easy_install + * [THRIFT-1657] - Chrome browser sending OPTIONS method before POST in xmlHttpRequest + * [THRIFT-2118] - Certificate error handling still incorrect + * [THRIFT-2137] - Ruby test lib fails jenkins build #864 + * [THRIFT-2136] - Vagrant build not compiling java, ruby, php, go libs due to missing dependencies + * [THRIFT-2135] - GO lib leaves behind test files that are auto generated + * [THRIFT-2134] - mingw-cross-compile script failing with strip errors + * [THRIFT-2133] - java TestTBinaryProtocol.java test failing + * [THRIFT-2126] - lib/cpp/src/thrift/concurrency/STD* files missing from DIST + * [THRIFT-2125] - debian missing from DIST + * [THRIFT-2124] - .o, .so, .la, .deps, .libs, gen-* files left tutorials, test and lib/cpp when making DIST + * [THRIFT-2123] - GO lib missing files in DIST build + * [THRIFT-2121] - Compilation bug for Node.js + * [THRIFT-2129] - php ext missing from dist + * [THRIFT-2128] - lib GO tests fail with funct ends without a return statement + * [THRIFT-2286] - Failed to compile Thrift0.9.1 with boost1.55 by VS2010 if select Debug-mt&x64 mode. + * [THRIFT-1973] - TCompactProtocol in C# lib does not serialize and deserialize negative int32 and int64 number correctly + * [THRIFT-1992] - casts in TCompactProtocol.tcc causing "dereferencing type-punned pointer will break strict-aliasing rules" warnings from gcc + * [THRIFT-1930] - C# generates unsigned byte for Thrift "byte" type + * [THRIFT-1929] - Update website to use Mirrors for downloads + * [THRIFT-1928] - Race may still exist in TFileTransport::flush() + * [THRIFT-1934] - Tabs in Example section on main page are not working + * [THRIFT-1933] - Delphi generator crashes when a typedef references another typedef from an included file + * [THRIFT-1942] - Binary accelerated cpp extension does not use Thrift namespaces for Exceptions + * [THRIFT-1959] - C#: Add Union TMemoryBuffer support + * [THRIFT-1958] - C#: Use static Object.Equals instead of .Equals() calls in equals + * [THRIFT-1957] - NodeJS TFramedTransport and TBufferedTransport read bytes as unsigned + * [THRIFT-1955] - Union Type writer generated in C# does not WriteStructBegin + * [THRIFT-1952] - Travis CI + * [THRIFT-1949] - WP7 build broken + * [THRIFT-1943] - docstrings for enum values are ignored + * [THRIFT-2070] - Improper `HexChar' and 'HexVal' implementation in TJSONProtocol.cs + * [THRIFT-2017] - Resource Leak in thrift struct under compiler/cpp/src/parse/t_program.h + * [THRIFT-2032] - C# client leaks sockets/handles + * [THRIFT-1996] - JavaME Constants generation is broken / inconsistent with regular Java generation + * [THRIFT-2002] - Haskell: Test use Data.Maybe instead of Maybe + * [THRIFT-2051] - Vagrant fails to build erlang + * [THRIFT-2050] - Vagrant C# lib compile fails with TException missing + * [THRIFT-1978] - Ruby: Thrift should allow for the SSL verify mode to be set + * [THRIFT-1984] - namespace collision in python bindings + * [THRIFT-1988] - When trying to build a debian package it fails as the file NEWS doesn't exist + * [THRIFT-1975] - TBinaryProtocol CheckLength can't be used for a client + * [THRIFT-1995] - '.' allowed at end of identifier generates non-compilable code + * [THRIFT-2112] - Error in Go generator when using typedefs in map keys + * [THRIFT-2088] - Typos in Thrift compiler help text + * [THRIFT-2080] - C# multiplex processor does not catch IOException + * [THRIFT-2082] - Executing "gmake clean" is broken + * [THRIFT-2102] - constants are not referencing to correct type when included from another thrift file + * [THRIFT-2100] - typedefs are not correctly referenced when including from other thrift files + * [THRIFT-2066] - 'make install' does not install two headers required for C++ bindings + * [THRIFT-2065] - Not valid constants filename in Java + * [THRIFT-2047] - Thrift.Protocol.TCompactProtocol, intToZigZag data lost (TCompactProtocol.cs) + * [THRIFT-2036] - Thrift gem warns about class variable access from top level + * [THRIFT-2057] - Vagrant fails on php tests + * [THRIFT-2105] - Generated code for default values of collections ignores t_field::T_REQUIRED + * [THRIFT-2091] - Unnecessary 'friend' declaration causes warning in TWinsockSingleton + * [THRIFT-2090] - Go generator, fix including of other thrift files + * [THRIFT-2106] - Fix support for namespaces in GO generator + * [THRIFT-1783] - C# doesn't handle required fields correctly + * [THRIFT-1782] - async only defined in silverlight + * [THRIFT-1779] - Missing process_XXXX method in generated TProcessor implementation for all 'oneway' service functions + * [THRIFT-1692] - SO_REUSEADDR allows for socket hijacking on Windows + * [THRIFT-1720] - JRuby times out on successful connection + * [THRIFT-1713] - Named and Anonymous Pipe transport (Delphi) + * [THRIFT-1699] - Native Union#read has extra read_field_end call + * [THRIFT-1749] - Python TSSLSocket error handling obscures actual error + * [THRIFT-1748] - Guard and RWGuard macros defined in global namespace + * [THRIFT-1734] - Front webpage is still advertising v0.8 as current release + * [THRIFT-1729] - C glib refactor left empty folders in svn + * [THRIFT-1767] - unions can't have required fields (Delphi) + * [THRIFT-1765] - Incorrect error message printed for null or negative keys + * [THRIFT-1778] - Configure requires manual intervention due to tar failure + * [THRIFT-1777] - TPipeServer is UNSTOPPABLE + * [THRIFT-1753] - Multiple C++ Windows, OSX, and iOS portability issues + * [THRIFT-1756] - 'make -j 8' fails with "unterminated #ifdef" error + * [THRIFT-1773] - Python library should run on python 2.4 + * [THRIFT-1769] - unions can't have required fields (C++) + * [THRIFT-1768] - unions can't have required fields (Compiler) + * [THRIFT-1666] - htonll usage in TBinaryProtocol.tcc generates warning with MSVC2010 + * [THRIFT-1919] - libthrift depends on httpcore-4.1.3 (directly) and httpcore-4.1.4 (transitively) + * [THRIFT-1864] - implement event handler for non-blocking server + * [THRIFT-1859] - Generated error c++ code with -out and include_prefix param + * [THRIFT-1869] - TThreadPoolServer (java) dies when threadpool is consumed + * [THRIFT-1842] - Memory leak with Pipes + * [THRIFT-1838] - Can't build compiler on OS X because of missing thrifty.h + * [THRIFT-1846] - Restore socket.h header to support builds with Android NDK + * [THRIFT-1850] - make check hangs on TSocket tests in TransportTest.cpp + * [THRIFT-1873] - Binary protocol factory ignores struct read/write flags + * [THRIFT-1872] - issues with TBufferedTransport buffer + * [THRIFT-1904] - Incorrect code is generated for typedefs which use included types + * [THRIFT-1903] - PHP namespaces cause binary protocols to not be used + * [THRIFT-1895] - Delphi: reserved variable name "result" not detected properly + * [THRIFT-1881] - TNonblockingServer does not release open connections or threads on shutdown + * [THRIFT-1888] - Java Thrift client can't connect to Python Thrift server on same host + * [THRIFT-1831] - Bug in list deserializer + * [THRIFT-1824] - many compile warning, becase Thread.h includes config.h + * [THRIFT-1823] - Missing parenthesis breaks "IS_..." macro in generated code + * [THRIFT-1806] - Python generation always truncates __init__.py files + * [THRIFT-1795] - Race condition in TThreadedServerPool java implementation + * [THRIFT-1794] - C# asyncctp broken + * [THRIFT-1804] - Binary+compact protocol single byte error in Ruby library (ARM architecture): caused by different char signedness + * [THRIFT-1800] - Documentation text not always escaped correctly when rendered to HTML + * [THRIFT-1788] - C#: Constants static constructor does not compile + * [THRIFT-1816] - Need "require" included thrift files in "xxx_types.js" + * [THRIFT-1907] - Compiling namespace and sub-namespace directives for unrecognized generators should only be a warning + * [THRIFT-1913] - skipping unknown fields in java unions + * [THRIFT-2553] - C++ linker error - transport/TSocket + * [THRIFT-274] - Towards a working release/versioning process + +## Documentation + * [THRIFT-1971] - [Graphviz] Adds tutorial/general description documentation + * [THRIFT-2001] - http://thrift.apache.org/ Example "C++ Server" tab is broken + +## Improvement + * [THRIFT-1574] - Apache project branding requirements: DOAP file [PATCH] + * [THRIFT-1347] - Unify the exceptions returned in generated Go code + * [THRIFT-1353] - Switch to performance branch, get rid of BinaryParser + * [THRIFT-1629] - Ruby 1.9 Compatibility during Thrift configure, make, install + * [THRIFT-991] - Refactor Haskell code and generator + * [THRIFT-990] - Sanify gettimeofday usage codebase-wide + * [THRIFT-791] - Let C++ TSimpleServer be driven by an external main loop + * [THRIFT-2117] - Cocoa TBinaryProtocol strictWrite should be set to true by default + * [THRIFT-2014] - Change C++ lib includes to use style throughout + * [THRIFT-1972] - Add support for async processors + * [THRIFT-1970] - [Graphviz] Adds option to render exceptions relationships + * [THRIFT-1966] - Support different files for SSL certificates and keys + * [THRIFT-1965] - Adds Graphviz (graph description language) generator + * [THRIFT-1956] - Switch to Apache Commons Lang 3 + * [THRIFT-1962] - Multiplex processor should send any TApplicationException back to client + * [THRIFT-1960] - main() declares 22 unused gen bools + * [THRIFT-1951] - libthrift.jar has source files in it + * [THRIFT-1997] - Add accept backlog configuration method to TServerSocket + * [THRIFT-2003] - Deprecate senum + * [THRIFT-2052] - Vagrant machine image defaults to only 384MB of RAM + * [THRIFT-1980] - Modernize Go tooling, fix go client libary. + * [THRIFT-1977] - C# compiler should generate constant files prefixed with thrift file name + * [THRIFT-1985] - add a Vagrantfile to build and test Apache Thrift fully reproducable + * [THRIFT-1994] - Deprecate slist + * [THRIFT-1993] - Factory to create instances from known (generated) interface types with Delphi + * [THRIFT-2081] - Specified timeout should be used in TSocket.Open() + * [THRIFT-2084] - Delphi: Ability to create entity Thrift-generated instances based on TypeInfo + * [THRIFT-2083] - Improve the go lib: buffered Transport, save memory allocation, handle concurrent request + * [THRIFT-2109] - Secure connections should be supported in Go + * [THRIFT-2107] - minor Go generator fixes + * [THRIFT-1695] - allow warning-free compilation in VS 2012 and GNU 4.6 + * [THRIFT-1735] - integrate tutorial into regular build + * [THRIFT-1716] - max allowed connections should be PIPE_UNLIMITED_INSTANCES + * [THRIFT-1715] - Allow excluding python parts when building contrib/fb303 + * [THRIFT-1733] - Fix RPM build issues on RHEL6/OL6 systems + * [THRIFT-1728] - Upgradation of httpcomponents + * [THRIFT-1876] - Use enum names instead of casted integers in assignments + * [THRIFT-1874] - timeout for the server-side end of a named pipe + * [THRIFT-1897] - Support validation of required fields + * [THRIFT-1896] - Add TBase protocol for Cocoa + * [THRIFT-1880] - Make named pipes server work asynchronously (overlapped) to allow for clean server stops + * [THRIFT-1878] - Add the possibility to send custom headers + * [THRIFT-1882] - Use single include + * [THRIFT-1793] - C#: Use static read instead of instance read + * [THRIFT-1799] - Option to generate HTML in "standalone mode" + * [THRIFT-1815] - Code generators line buffer output + * [THRIFT-1890] - C++: Make named pipes server work asynchronously + * [THRIFT-474] - Generating Ruby on Rails friendly code + +## New Feature + * [THRIFT-801] - Provide an interactive shell (irb) when generating ruby bindings + * [THRIFT-2292] - Android Library Project + * [THRIFT-2012] - Modernizing Go + * [THRIFT-1969] - C#: Tests not properly linked from the solution + * [THRIFT-1785] - C#: Add TMemoryBuffer serializer/deserializer + * [THRIFT-1780] - Add option to generate nullable values + * [THRIFT-1786] - C# Union Typing + * [THRIFT-591] - Make the C++ runtime library be compatible with Windows and Visual Studio + * [THRIFT-514] - Add option to configure compiler output directory + +## Question + * [THRIFT-1764] - how to get the context of client when on a rpc call in server side? + * [THRIFT-1791] - thrift's namespace directive when generating haskell code + +## Sub-task + * [THRIFT-1594] - Java test clients should have a return codes that reflect whether it succeeds or not. + * [THRIFT-1595] - Java test server should follow the documented behavior as of THRIFT-1590 + * [THRIFT-986] - st: add version Info to the library + * [THRIFT-985] - php: add version Info to the library + * [THRIFT-984] - ocaml: add version Info to the library + * [THRIFT-1924] - Delphi: Inconsistency in serialization of optional fields + * [THRIFT-1922] - C#: Inconsistency in serialization of optional fields + * [THRIFT-1961] - C# tests should be in lib/csharp/test/... + * [THRIFT-1822] - PHP unit test does not work + * [THRIFT-1902] - C++: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-1901] - C#: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-1899] - Delphi: Support for Multiplexing Services on any Transport, Protocol and Server + * [THRIFT-563] - Support for Multiplexing Services on any Transport, Protocol and Server + + + +Thrift 0.9 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1438] - lib/cpp/src/windows/config.h should read version from configure.ac rather than a #define + * [THRIFT-1446] - Compile error with Delphi 2009 in constant initializer + * [THRIFT-1450] - Problems building thrift 0.8.0 for Python and Ruby + * [THRIFT-1449] - Ruby client does not work on solaris (?) + * [THRIFT-1447] - NullpointerException in ProcessFunction.class :in "oneway" method + * [THRIFT-1433] - TServerSocket fix for MSVC + * [THRIFT-1429] - The nonblocking servers is supposed to use TransportFactory to read the data + * [THRIFT-1427] - PHP library uses non-multibyte safe functions with mbstring function overloading + * [THRIFT-1421] - Debian Packages can not be built + * [THRIFT-1394] - Treatment of optional fields is not consistent between C++ and Java + * [THRIFT-1511] - Server with oneway support ( JAVA ) + * [THRIFT-1496] - PHP compiler not namespacing enums + * [THRIFT-1495] - PHP TestClient fatals on missing class + * [THRIFT-1508] - TServerSocket does not allow for the user to specify the IP address to bind to + * [THRIFT-1504] - Cocoa Generator should use local file imports for base Thrift headers + * [THRIFT-1512] - Thrift socket support for Windows XP + * [THRIFT-1502] - TSimpleServer::serve(): Do not print out error message if server was stopped. + * [THRIFT-1501] - PHP old namespaces not generated for enums + * [THRIFT-1483] - java compiler does not generate type parameters for services in extended clauses + * [THRIFT-1479] - Compiled PHP process functions missing writeMessageEnd() + * [THRIFT-1492] - enabling c_glib render thrift unusable (even for C++ code) + * [THRIFT-1491] - Uninitialize processorFactory_ member in TServer.h + * [THRIFT-1475] - Incomplete records generation for Erlang + * [THRIFT-1486] - Javascript manual testserver not returning content types + * [THRIFT-1488] - src/concurrency/Thread.h:91:58: error: invalid conversion from 'pthread_t {aka _opaque_pthread_t*}' to 'apache::thrift::concurrency::Thread::id_t {aka long long unsigned int}' [-fpermissive] + * [THRIFT-1490] - Windows-specific header files - fixes & tweaks + * [THRIFT-1526] - Union TupleSchemeFactory returns StandardSchemes + * [THRIFT-1527] - Generated implementation of tupleReadStruct in unions return null when the setfield is unrecognized + * [THRIFT-1524] - TNonBlockingServer does not compile in Visual Studio 2010 + * [THRIFT-1529] - TupleProtocol can unintentionally include an extra byte in bit vectors when number of optional fields is an integral of 8 + * [THRIFT-1473] - JSON context stack may be left in an incorrect state when an exception is thrown during read or write operations + * [THRIFT-1456] - System.Net.HttpWebRequest' does not contain a definition for 'Proxy' + * [THRIFT-1468] - Memory leak in TSaslServerTransport + * [THRIFT-1461] - Recent TNonblockingServer changes broke --enable-boostthreads=yes, Windows + * [THRIFT-1460] - why not add unicode strings support to python directly? + * [THRIFT-1464] - AbstractNonblockingServer.FrameBuffer TNonblockingTransport accessor changed from public to private + * [THRIFT-1467] - Possible AV with empty strings when using JSON protocol + * [THRIFT-1523] - clientTimeout not worked as expected in TServerSocket created by TSSLTransportFactory + * [THRIFT-1537] - TFramedTransport issues + * [THRIFT-1519] - Thirft Build Failure referencing rb_intern2 symbol + * [THRIFT-1518] - Generated C++ code only sends the first optional field in the write() function for a struct. + * [THRIFT-1515] - NameError: global name 'TApplicationException' is not defined + * [THRIFT-1554] - Inherited service methods are not resolved in derived service implementations + * [THRIFT-1553] - thrift nodejs service side can't read map structure, key as enum, value as Object + * [THRIFT-1575] - Typo in server/TThreadPoolServer.h + * [THRIFT-1327] - Fix Spec Suite under Ruby-1.8.7 (works for MRI Ruby-1.9.2) + * [THRIFT-1326] - on some platforms, #include is necessary to be included in Thrift.h + * [THRIFT-1159] - THttpClient->Flush() issue (connection thru proxy) + * [THRIFT-1277] - Node.js serializes false booleans as null + * [THRIFT-1224] - Cannot insert UTF-8 text + * [THRIFT-1267] - Node.js can't throw exceptions. + * [THRIFT-1338] - Do not use an unpatched autoconf 2.65 to generate release tarball + * [THRIFT-1128] - MAC OS X: thrift.h incompatibility with Thrift.h + * [THRIFT-1631] - Fix C++ server constructor typos + * [THRIFT-1602] - PHP C Extension is not Compatible with PHP 5.4 + * [THRIFT-1610] - IWebProxy not available on WP7 platform + * [THRIFT-1606] - Race condition in BoostThreadFactory.cpp + * [THRIFT-1604] - Python exception handeling for changes from PEP 3110 + * [THRIFT-1607] - Incorrect file modes for several source files + * [THRIFT-1583] - c_glib leaks memory + * [THRIFT-1582] - Bad includes of nested thrift files in c_glib + * [THRIFT-1578] - C_GLib generated code does not compile + * [THRIFT-1597] - TJSONProtocol.php is missing from Makefile.am + * [THRIFT-1591] - Enable TCP_NODELAY for ruby gem + * [THRIFT-1624] - Isset Generated differently on different platforms + * [THRIFT-1622] - Incorrect size returned on read + * [THRIFT-1621] - Memory leaks + * [THRIFT-1612] - Base64 encoding is broken + * [THRIFT-1627] - compiler built using compilers.vcxproj cannot be used to build some test .thrift files + * [THRIFT-1571] - Update Ruby HTTP transport for recent Ruby versions + * [THRIFT-1023] - Thrift encoding (UTF-8) issue with Ruby 1.9.2 + * [THRIFT-1090] - Document the generation of a file called "Constants.java" + * [THRIFT-1082] - Thrift::FramedTransport sometimes calls close() on an undefined value + * [THRIFT-956] - Python module's version meta-data should be updated + * [THRIFT-973] - Cocoa library won't compile using clang + * [THRIFT-1632] - ruby: data corruption in thrift_native implementation of MemoryBufferTransport + * [THRIFT-1665] - TBinaryProtocol: exceeded message length raises generic TException + * [THRIFT-1664] - Reference to non-existing variable in build script + * [THRIFT-1663] - Java Thrift server is not throwing exceptions + * [THRIFT-1662] - "removeObject:" should be "removeObserver:" in [-TSocketServer dealloc]? + * [THRIFT-1643] - Denial of Service attack in TBinaryProtocol.readString + * [THRIFT-1674] - Update Thrift D library to be compatible with 2.060 + * [THRIFT-1673] - Ruby compile flags for extension for multi arch builds (os x) + * [THRIFT-1655] - Configure still trying to use thrift_generators in output + * [THRIFT-1654] - c_glib thrift_socket_read() returns corrupted data + * [THRIFT-1653] - TThreadedSelectorServer leaks CLOSE_WAIT sockets + * [THRIFT-1658] - Java thrift server is not throwing TApplicationException + * [THRIFT-1656] - Setting proper headers in THttpServer.cpp so that "Cross-Origin Resource Sharing" on js client can work. + * [THRIFT-1652] - TSaslTransport does not log the error when kerberos auth fails + * [THRIFT-2272] - CLONE - Denial of Service attack in TBinaryProtocol.readString + * [THRIFT-2086] - Invalid generated code for Node.JS when using namespaces + * [THRIFT-1686] - t_php_generator.cc uses "and" instead of "&&", and causes compiler errors with Visual Studio + * [THRIFT-1693] - libthrift has dependency on two different versions of httpcore + * [THRIFT-1689] - don't exit(-1) in TNonblockingServer + * [THRIFT-1679] - NodeJS: protocol readString() should treat string as utf8, not binary + * [THRIFT-1721] - Dist broken due to 0.8.0 to 0.9.0 changes + * [THRIFT-1710] - Minor issues in test case code + * [THRIFT-1709] - Warning "Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first" in TBinaryProtocol.cs at ReadInt64() + * [THRIFT-1707] - [ruby] Adjust server_spec.rb for RSpec 2.11.x and Ruby 1.9.3 + * [THRIFT-1671] - Cocoa code generator does not put keywords into generated method calls + * [THRIFT-1670] - Incompatibilities between different versions of a Thrift interface + * [THRIFT-1669] - NameError: global name 'TApplicationException' is not defined + * [THRIFT-1668] - Compile error in contrib/fb303, thrift/TDispatchProcessor.h: No such file or directory + * [THRIFT-1845] - Fix compiler warning caused by implicit string conversion with Xcode 4.6 + * [THRIFT-304] - Building the Python library requires development headers + * [THRIFT-369] - sets and maps break equality + * [THRIFT-556] - Ruby compiler does not correctly referred to top-level modules when a submodule masks the top-level name + * [THRIFT-481] - indentation of ruby classes is off by a few + +## Improvement + * [THRIFT-1498] - Allow TThreadedPoolServer.Args to pass a ExecutorService + * [THRIFT-1444] - FunctionRunner - add syntactic sugar to create shared_ptrs + * [THRIFT-1443] - define a TProcessor helper class to implement process() + * [THRIFT-1441] - Generate constructor with parameters for exception class to let it update message property automatically. + * [THRIFT-1520] - Embed version number in erlang .app file + * [THRIFT-1480] - python: remove tabs, adjust whitespace and address PEP8 warnings + * [THRIFT-1485] - Performance: pass large and/or refcounted arguments as "const" + * [THRIFT-1484] - Introduce phpunit test suite + * [THRIFT-1532] - The type specifications in the generated Erlang code should include "undefined" where it's used as a default value + * [THRIFT-1534] - Required fields in the Delphi code generator. + * [THRIFT-1469] - Java isset space optimization + * [THRIFT-1465] - Visibility of methods in generated java code + * [THRIFT-1453] - Don't change types of arguments when serializing with thrift php extension + * [THRIFT-1452] - generate a swap() method for all generated structs + * [THRIFT-1451] - FramedTransport: Prevent infinite loop when writing + * [THRIFT-1521] - Two patches for more Performance + * [THRIFT-1555] - Delphi version of the tutorial code + * [THRIFT-1535] - Why thrift don't use wrapped class for optional fields ? + * [THRIFT-1204] - Ruby autogenerated files should require 'thrift' gem + * [THRIFT-1344] - Using the httpc module directly rather than the deprecated http layer + * [THRIFT-1343] - no_auto_import min/2 to avoid compile warning + * [THRIFT-1340] - Add support of ARC to Objective-C + * [THRIFT-1611] - Improved code generation for typedefs + * [THRIFT-1593] - Pass on errors like "connection closed" to the handler module + * [THRIFT-1615] - PHP Namespace + * [THRIFT-1567] - Thrift/cpp: Allow alternate classes to be used for + * [THRIFT-1072] - Missing - (id) initWithSharedProcessor in TSharedProcessorFactory.h + * [THRIFT-1650] - [ruby] Update clean items and svn:ignore entries for OS X artifacts + * [THRIFT-1661] - [PATCH] Add --with-qt4 configure option + * [THRIFT-1675] - Do we have any plan to support scala? + * [THRIFT-1645] - Replace Object#tee with more conventional Object#tap in specs + * [THRIFT-1644] - Upgrade RSpec to 2.10.x and refactor specs as needed + * [THRIFT-1672] - MonoTouch (and Mono for Android) compatibility + * [THRIFT-1702] - a thrift manual + * [THRIFT-1694] - Re-Enable serialization for WP7 Silverlight + * [THRIFT-1691] - Serializer/deserializer support for Delphi + * [THRIFT-1688] - Update IDL page markup + * [THRIFT-1725] - Tutorial web pages for Delphi and C# + * [THRIFT-1714] - [ruby] Explicitly add CWD to Ruby test_suites.rb + * [THRIFT-317] - Issues with Java struct validation + * [THRIFT-164] - Build web tutorial on Incubator web site + * [THRIFT-541] - Cocoa code generator doesn't put keywords before all arguments. + * [THRIFT-681] - The HTML generator does not handle JavaDoc style comments very well + +## New Feature + * [THRIFT-1500] - D programming language support + * [THRIFT-1510] - There should be an implementation of the JsonProtocol for ruby + * [THRIFT-1115] - python TBase class for dynamic (de)serialization, and __slots__ option for memory savings + * [THRIFT-1953] - support for asp.net mvc 3 + +## Question + * [THRIFT-1235] - How could I use THttpServerTransportFactory withTNonBlockingServer + * [THRIFT-1368] - TNonblockingServer usage + * [THRIFT-1061] - Read an invalid frame size of 0. Are you using TFramedTransport on the client side? + * [THRIFT-491] - Ripping raw pthreads out of TFileTransport and associated test issues + +## Sub-task + * [THRIFT-1596] - Delphi: Test clients should have a return codes that reflect whether they succeeded or not + * [THRIFT-982] - javame: add version Info to the library + * [THRIFT-1722] - C# WP7 Assembly addition beaks mono build + * [THRIFT-336] - Compact Protocol in C# + +## Test + * [THRIFT-1613] - Add code back into empty source file ToStringTest.java + * [THRIFT-1718] - Incorrect check in TFileTransportTest + +## Wish + * [THRIFT-1463] - Decouple Thrift IDL from generators + * [THRIFT-1466] - Proper Documentation for Thrift C Glib + * [THRIFT-1539] - Build and distribute the fb303 python libraries along with thrift + * [THRIFT-1685] - Please add "aereo.com" to "Powered by Apache Thrift" list in about page + * [THRIFT-330] - TProcessor - additional method to called when connection is broken + + + +Thrift 0.8 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1436] - pip install thrift fails on Windows with "Unable to find vcvarsall.bat" + * [THRIFT-1432] - Javascript struct constants declared in the same file as their struct definition will cause an error + * [THRIFT-1428] - shared.thrft does not include namespace for php, so thrift compiler generate incorrect name + * [THRIFT-1426] - Dist package missing files for release 0.8 + * [THRIFT-1425] - The Node package is incompatible with latest node (0.6) & npm (1.0.27) + * [THRIFT-1416] - Python Unit test is broken on ci + * [THRIFT-1419] - AbstractNonBlockingServer does not catch errors when invoking the processor + * [THRIFT-1424] - Ruby specs fail when run with rake + * [THRIFT-1420] - Nonblocking and HsHa server should make sure to close all their socket connections when the selector exits + * [THRIFT-1413] - Generated code does not read MapEnd / ListEnd / SetEnd + * [THRIFT-1409] - Name conflict check does not work properly for exception object(Delphi). + * [THRIFT-1408] - Delphi Test Server: Exception test case fails due to naming conflict with e.message + * [THRIFT-1407] - Typo in Python socket server causes Thrift to fail when we enable a global socket timout + * [THRIFT-1397] - CI server fails during build due to unused parameters in delphi generator + * [THRIFT-1404] - Delphi compiler generates struct reader code with problem. + * [THRIFT-1400] - Ruby native extension aborts with __stack_chk_fail in OSX + * [THRIFT-1399] - One of the TServerImpl.Create CTORs lacks implementation + * [THRIFT-1390] - Debian packages build fix for Squeeze (build from the official 0.7.0 tarball) + * [THRIFT-1393] - TTransportException's thrown from THttpClient contain superfluous slashes in the Exception message + * [THRIFT-1392] - Enabling both namespaces and autoloading in generated PHP code won't work. + * [THRIFT-1406] - Build error after applying THRIFT-1395 + * [THRIFT-1405] - Delphi compiler does not generates container serializer properly. + * [THRIFT-1411] - java generator does not provide type parameter for TBaseProcessor + * [THRIFT-1473] - JSON context stack may be left in an incorrect state when an exception is thrown during read or write operations + * [THRIFT-1331] - Ruby library deserializes an empty map to nil + * [THRIFT-1330] - PHP Namespaces no longer generated + * [THRIFT-1328] - TBaseHelper.toString(...) appends ByteBuffer data outside of valid buffer range + * [THRIFT-1322] - OCaml lib fail to compile: Thrift.ml line 305, int vs int32 mismatch + * [THRIFT-1143] - Build doesn't detect correct architecture type on 64bit osx + * [THRIFT-1205] - port server unduly fragile with arbitrary input + * [THRIFT-1279] - type set is handled incorrectly when writing object + * [THRIFT-1298] - Standard scheme doesn't read or write metadata along with field values + * [THRIFT-1265] - C++ container deserialize + * [THRIFT-1263] - publish ruby client to rubygems + * [THRIFT-1384] - Java help menu missing newline near javame flag + * [THRIFT-1382] - Bundle install doesnot work because thrift crashes + * [THRIFT-1381] - Thrift C++ libs have incorrectly versioned names + * [THRIFT-1350] - Go library code does not build as of r60 (most recent release) + * [THRIFT-1365] - TupleProtocol#writeBitSet unintentionally writes a variable length byte array + * [THRIFT-1359] - --gen-cob cpp:cob_style does not compile anymore + * [THRIFT-1319] - Mismatch between how a union reads and writes a container + * [THRIFT-1309] - libfb303-0.7.0.jar missing in maven repository + * [THRIFT-1238] - Thrift JS client cannot read map of structures + * [THRIFT-1254] - Code can't be compiled against a regular JRE: Object.clone() override has a different return type + * [THRIFT-1367] - Mac OSX build fails with "no such file to load -- spec/rake/spectask" + * [THRIFT-1355] - Running make in lib/rb doesn't build the native extensions + * [THRIFT-1370] - Debian packaging should Build-Depend on libglib2.0-dev + * [THRIFT-1342] - Compilation problem on Windows of fastbinary.c + * [THRIFT-1341] - TProtocol.h endian detection wrong with boost + * [THRIFT-1583] - c_glib leaks memory + * [THRIFT-1582] - Bad includes of nested thrift files in c_glib + * [THRIFT-1578] - C_GLib generated code does not compile + * [THRIFT-1027] - 'make -j 16' fails with "unterminated #ifdef" error + * [THRIFT-1121] - Java server performance regression in 0.6 + * [THRIFT-857] - tests run by "make install" fail if generators are disabled + * [THRIFT-380] - Use setuptools for python build + +## Dependency upgrade + * [THRIFT-1257] - thrift's dependency scope on javax.servlet:servlet-api should be 'provided' + +## Improvement + * [THRIFT-1445] - minor C++ generator variable cleanup + * [THRIFT-1435] - make TException.Message property conformant to the usual expectations + * [THRIFT-1431] - Rename 'sys' module to 'util' + * [THRIFT-1396] - Dephi generator has dependacy on boost 1.42 later. + * [THRIFT-1395] - Patch to prevent warnings for integer types in some cases + * [THRIFT-1275] - thrift: always prefix namespaces with " ::" + * [THRIFT-1274] - thrift: fail compilation if an unexpected token is + * [THRIFT-1271] - thrift: fix missing namespace in generated local + * [THRIFT-1270] - thrift: add --allow-neg-keys argument to allow + * [THRIFT-1345] - Allow building without tests + * [THRIFT-1286] - Modernize the Thrift Ruby Library Dev Environment + * [THRIFT-1284] - thrift: fix processor inheritance + * [THRIFT-1283] - thrift: wrap t_cpp_generator::generate_process_function() to 80 + * [THRIFT-1282] - Upgrade httpclient to 4.1.2 (from 4.0.1) + * [THRIFT-1281] - add @generated to the docblock + * [THRIFT-1280] - Thrift: Improve Monitor exception-free interfaces + * [THRIFT-1278] - javadoc warnings - compilation + * [THRIFT-1227] - Erlang implementation of thrift JSON protocol + * [THRIFT-1295] - Duplicate include in TSocket.cpp + * [THRIFT-1294] - thrift: fix log message typos in TSimpleServer + * [THRIFT-1293] - thrift: improve handling of exceptions thrown by + * [THRIFT-1292] - thrift: silence log spew from TThreadedServer + * [THRIFT-1288] - Allow typedefed exceptions in throws clauses + * [THRIFT-1290] - thrift: TNonblockingServer: clean up state in the + * [THRIFT-1287] - thrift: start refactoring some of the C++ processor + * [THRIFT-1289] - thrift: implement TNonblockingServer::stop() + * [THRIFT-1305] - thrift: make TConnection a private inner class of + * [THRIFT-1304] - TNonblockingServer: pass in the connection context to + * [THRIFT-1302] - thrift: raise an exception if send() times out in + * [THRIFT-1301] - thrift: consolidate common code in TNonblockingServer + * [THRIFT-1377] - abort PHP deserialization on unknown field type + * [THRIFT-1379] - fix uninitialized enum values in thrift C++ objects + * [THRIFT-1376] - Make port specification option in thrift remote + * [THRIFT-1375] - fixed a hex char conversion bug in TJSONProtocol + * [THRIFT-1373] - Fix user-defined exception generation in thrift (python) + * [THRIFT-1361] - Optional replacement of pthread by boost::thread + * [THRIFT-1320] - Consistency of configure generated config.h + * [THRIFT-1317] - Remove copy constructibility from + * [THRIFT-1316] - thrift: update server classes to accept + * [THRIFT-1315] - thrift: generate server interface factory classes + * [THRIFT-1314] - thrift: add TProcessorFactory + * [THRIFT-1335] - Add accept timeout to TServerSocket + * [THRIFT-1334] - Add more info to IllegalStateException + * [THRIFT-1333] - Make RWGuard not copyable + * [THRIFT-1332] - TSSLTransportParameters class uses hard coded value keyManagerType: SunX509 + * [THRIFT-1251] - Generated java code should indicate which fields are required and which are optional + * [THRIFT-1387] - Build MSVC libraries with Boost Threads instead of Pthreads + * [THRIFT-1339] - Extend Tuple Protocol to TUnions + * [THRIFT-1031] - Patch to compile Thrift for vc++ 9.0 and 10.0 + * [THRIFT-1130] - Add the ability to specify symbolic default value for optional boolean + * [THRIFT-1123] - Patch to compile Thrift server and client for vc++ 9.0 and 10.0 + * [THRIFT-386] - Make it possible to build the Python library without the extension + +## New Feature + * [THRIFT-1401] - JSON-protocol for Delphi XE Libraries + * [THRIFT-1167] - Java nonblocking server with more than one thread for select and handling IO + * [THRIFT-1366] - Delphi generator, lirbrary and unit test. + * [THRIFT-1354] - Add rake task to build just the gem file + * [THRIFT-769] - Pluggable Serializers + +## Sub-task + * [THRIFT-1415] - delphi: add version Info to the library + * [THRIFT-1391] - Improved Delphi XE test cases + + + +Thrift 0.7 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1140] - Framed Transport Client using C (Glib) Library hangs when connecting to Ruby Server + * [THRIFT-1154] - HttpClient does not specify the connection close parameter + * [THRIFT-1153] - HttpClient does not specify the connection close parameter + * [THRIFT-1149] - Nonblocking server fails when client connection is reset + * [THRIFT-1146] - Android Incompatibility : in Android < 2.3 java.io.IOException doesn't support for Throwable parameter in constructor + * [THRIFT-1133] - Java and JavaScript tutorial is broken since we have Java maven deployment + * [THRIFT-1132] - Deserialization error in TApplicationException C# + * [THRIFT-1131] - C# JSON Protocol is unable to decode escaped characters in string + * [THRIFT-1208] - python TCompactProtocol.py writeBool and readBool not follow the compact-proto-spec-2.txt spec for CONTAINER_WRITE, CONTAINER_READ + * [THRIFT-1200] - JS compiler generates code that clobbers existing namespaces + * [THRIFT-1183] - Pure-ruby CompactProtocol raises ArgumentError when deserializing under Ruby 1.9 + * [THRIFT-1182] - Native deserializer segfaults on incorrect list element type + * [THRIFT-1181] - AS3 compiler generates incorrect code for setting default values in constructor + * [THRIFT-1234] - thrift --help is missing doc on py:utf8strings + * [THRIFT-1180] - AS3 compiler generates uncompilable code for binary types. + * [THRIFT-1194] - Java lib does not install artifacts to local dir correctly + * [THRIFT-1193] - Potential infinite loop in nonblocking_server + * [THRIFT-1192] - Typo: TProtocol.h tests for HAVE_SYS_PARAM_H_ + * [THRIFT-1190] - readBufferBytesAllocated in TNonblockingServer.java should be AtomicLong to fix FD leakage and general server malfunction + * [THRIFT-1187] - nonblocking_server shutdown race under Ruby 1.9 + * [THRIFT-1178] - Java: TBase signature should be T extends TBase + * [THRIFT-1164] - Segmentation fault on NULL pointer in t_js_generator::generate_const + * [THRIFT-1171] - Perl write/readDouble assumes little-endian platform + * [THRIFT-1222] - Unhandled exception for TEvhttpServer request + * [THRIFT-1220] - TProcessor::process never returns false + * [THRIFT-1285] - Stable 0.7.0 Windows compiler exe available on the webside is not the good one + * [THRIFT-1218] - c_glib uses wrong name in pkg-config + * [THRIFT-1215] - Undefined property Thirft in lib/js/thrift.js + * [THRIFT-1211] - When using THttpClient, non 200 responses leave the connection open + * [THRIFT-1228] - The php accelerator module calls flush incorrectly + * [THRIFT-1308] - libfb303-0.7.0.jar missing in maven repository + * [THRIFT-1255] - Mismatch of method name between JavaME's lib and generated code (compareTo/compareObjects) + * [THRIFT-1253] - Code generated for maps is not compiling + * [THRIFT-1252] - Segfault in Ruby deserializer + * [THRIFT-1094] - bug in TCompactProto python readMessageEnd method and updated test cases + * [THRIFT-1093] - several bugs in python TCompactProtocol + * [THRIFT-1092] - generated validate() method has wrong indentation + * [THRIFT-1011] - Error generating package imports when using classes from other packages + * [THRIFT-1050] - Declaring an argument named "manager" to a service method produces code that fails compile due to name conflicts with protected ivars in TAsyncClient + * [THRIFT-1074] - .keystore and .truststore are missing from the 0.6.0 distribution + * [THRIFT-1067] - Tons of bugs in php implementation + * [THRIFT-1065] - Unexpected exceptions not proper handled on JS + * [THRIFT-1076] - Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception + * [THRIFT-1057] - casts in TBinaryProtocol.tcc causing "dereferencing type-punned pointer will break strict-aliasing rules" warnings from gcc + * [THRIFT-1055] - csharp TServerSocket and TSocket do not disable Nagle via Socket.NoDelay = true like cpp and java do + * [THRIFT-1054] - explicit call to PKG_PROG_PKG_CONFIG is missing and first use of PKG_CHECK_MODULES may not happen, causes mono detection to fail + * [THRIFT-1117] - JavaScript Unit Test does not work anymore because libthrift*.jar where moved by Maven Deployment + * [THRIFT-1111] - The HTML generator does not distinguish between string and binary types + * [THRIFT-1032] - "make dist" fails due to c_glib problem + * [THRIFT-1036] - Auto-generated C++ code fails to compile with "-Werror -Wextra -Wall" g++ compiler flags + * [THRIFT-1041] - TDeserializer holds onto a reference of the array it reads after it is done deserializing + * [THRIFT-1106] - C++ code TAsyncProtocolProcessor.h & TAsyncBufferProcessor.h dont have virtual functions but no virtual destructor. Causes warnings on -Wall + * [THRIFT-1105] - OCaml generator does not prefix methods of included structs with their type + * [THRIFT-1104] - INSTALLDIRS should be included in configure script + * [THRIFT-1102] - typo in configure.ac: "==" operator in 'test' (instead of"'=") + * [THRIFT-1101] - bytebuffer length calculation in TBinaryProtocol writeBinary + * [THRIFT-1098] - Undefined properties in TBinaryProtocolFactory + * [THRIFT-1081] - PHP tests broken and somewhat incomplete + * [THRIFT-1080] - erlang test's 'make' fails on Mac OSX + * [THRIFT-1078] - ThriftTest.thrift generates invalid PHP library + * [THRIFT-1120] - proto.WriteListEnd being called in the wrong place + * [THRIFT-1119] - TJSONProtocol fails to UTF8 decode strings + * [THRIFT-867] - PHP accelerator module's output transport is incompatible with TFramedTransport + * [THRIFT-826] - PHP TSocket Write Timeout + * [THRIFT-835] - Bad AS3 syntax in constructors that set default values + * [THRIFT-788] - thrift_protocol.so: multiget/multiget_slice does not handle more than 17 keys correctly + * [THRIFT-125] - OCaml libraries don't compile with 32-bit ocaml + * [THRIFT-342] - PHP: can't have sets of complex types + * [THRIFT-731] - configure doesn't check for ant >= 1.7 + * [THRIFT-690] - Update TApplicationException codes + * [THRIFT-638] - BufferedTransport + C extensions block until recv timeout is reached on last fread call + +## Dependency upgrade + * [THRIFT-1177] - Update thrift to reflect changes in Go's networking libraries + +## Improvement + * [THRIFT-1155] - Remove log4j dependency from java client + * [THRIFT-1151] - Produce more informative runtime error in case of schema and data mismatch during serialization + * [THRIFT-1207] - Support DESTDIR on "make install" of ruby libs + * [THRIFT-1199] - Union structs should have generated methods to test whether a specific field is currently set + * [THRIFT-1233] - Remove unused include in generated C++ code + * [THRIFT-1189] - Ruby deserializer speed improvements + * [THRIFT-1170] - Thrift Generated Code and Java 5 + * [THRIFT-1174] - Publish as3 client implementation via Maven for use by flex-mojos users + * [THRIFT-1225] - TCompactProtocol for PHP + * [THRIFT-1221] - Remove SimpleCallback.h + * [THRIFT-1217] - Use evutil_socketpair instead of pipe (Windows port) + * [THRIFT-1216] - build Java Library behind a proxy + * [THRIFT-1231] - Remove bogus include + * [THRIFT-1213] - Membuffer should provide a way to get back the buffer + * [THRIFT-1237] - Java fb303 missing some methods + * [THRIFT-1063] - Fix Erlang Tutorial Files + * [THRIFT-1053] - Make remote client's IP address available for all socket related transports + * [THRIFT-1109] - Deploy fb303 along side libthrift to maven repo + * [THRIFT-1107] - improvement for compiler-generated python for 'None' object comparisons + * [THRIFT-1069] - Add command line option to prevent thrift from inserting gen-* directories + * [THRIFT-1049] - Allow for TServerSocket python library to bind to a specific host + * [THRIFT-1126] - Extending struct_info for erlang bindings + * [THRIFT-1100] - python TSSLSocket improvements, including certificate validation + * [THRIFT-994] - Don't try to invoke phpize if we don't have it + * [THRIFT-993] - Some improvements in C++ stubs for oneway operations + * [THRIFT-997] - Using valueOf for base types in getFieldValue + * [THRIFT-418] - Don't do runtime sorting of struct fields + * [THRIFT-151] - TSSLServerSocket and TSSLSocket implementation + * [THRIFT-27] - Generated erlang types don't contain default values for records + * [THRIFT-113] - to-string methods should omit optional null fields from output + * [THRIFT-363] - Maven Deploy + * [THRIFT-447] - Make an abstract base Client class so we can generate less code + * [THRIFT-627] - should c++ have setters for optional fields? + +## New Feature + * [THRIFT-1236] - Erlang Reconnecting Thrift Client + * [THRIFT-1021] - Framed transport support for OCaml + * [THRIFT-1068] - Python SSL Socket Support + * [THRIFT-1103] - TZlibTransport for python, a zlib compressed transport + * [THRIFT-1083] - Preforking python process pool server + * [THRIFT-999] - Add TForkingServer + +## Sub-task + * [THRIFT-1152] - Attributes from private to protected + * [THRIFT-1038] - Generated Java code for structures containing binary fields (or collections thereof) are not serializable (in the Java sense) even though they implement java.io.Serializable + +## Task + * [THRIFT-892] - Refactor erlang build system with rebar + +## Wish + * [THRIFT-625] - Add support for 'Go' + + + +Thrift 0.6.1 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1133] - Java and JavaScript tutorial is broken since we have Java maven deployment + * [THRIFT-1131] - C# JSON Protocol is unable to decode escaped characters in string + * [THRIFT-1074] - .keystore and .truststore are missing from the 0.6.0 distribution + +## Improvement + * [THRIFT-1109] - Deploy fb303 along side libthrift to maven repo + * [THRIFT-363] - Maven Deploy + +## Question + * [THRIFT-1206] - did the THRIFT 0.6.1 merge THRIFT-563 ? + +## Sub-task + * [THRIFT-1163] - How can i use multi service in one program? + +## Task + * [THRIFT-1112] - Apply THRIFT-363 to 0.6 branch + * [THRIFT-1113] - Apply THRIFT-1074 to 0.6 branch + + + +Thrift 0.6 +-------------------------------------------------------------------------------- +## Bug + * [THRIFT-1020] - OCaml compiler generates invalid OCaml + * [THRIFT-1015] - TUnion does not handle ByteBuffer in toString + * [THRIFT-1013] - generated java code may have name clashes with thrift library + * [THRIFT-1009] - TUnion does not correctly deep copy a ByteBuffer + * [THRIFT-1032] - "make dist" fails due to c_glib problem + * [THRIFT-868] - Referencing constant values doesn't work with with typedef types + * [THRIFT-971] - java module can't be compiled without ivy and network connection + * [THRIFT-970] - Under heavy load, THttpClient may fail with "too many open files" + * [THRIFT-969] - Java Tutorial broken, move CalculatorHandler to a separate file + * [THRIFT-807] - JavaScript: Initialization of Base Types with 0 instead of null + * [THRIFT-955] - Thrift compiler for Windows uses lowercase names and directories which is inconsistent with compiling on other platforms + * [THRIFT-992] - Naming convention in C# constructor is not consistent with other fields causes compile errors + * [THRIFT-1008] - byte[] accessors throw NPE on unset field + * [THRIFT-1006] - Impossible to correctly qualify an enum constant in an external thrift file + * [THRIFT-950] - Haskell bindings treat 'byte' as unsigned 8-bit int (Data.Word.Word8), java/cpp as signed (byte/int8_t). + * [THRIFT-975] - lib/c_glib/README is missing => breaks make dist + * [THRIFT-944] - Support all version-4s of base + * [THRIFT-939] - optional binary fields throw NPE on default byte[] getters + * [THRIFT-935] - PHP Extension aborts the build if php-config is not installed + * [THRIFT-933] - Haskell's Thrift.cabal has warnings + * [THRIFT-932] - Haskell tests need to be run through 'make check' (and probably 'cabal check') too + * [THRIFT-904] - C# TSocket should disable nagle and linger + * [THRIFT-941] - Make PHP C Extension use the defined Protocol writeMessageBegin function + * [THRIFT-940] - 'make check' fails if boost is not in the std include and link paths + * [THRIFT-924] - Fix generated php structure constants + * [THRIFT-979] - ruby bindings used to work on jruby + * [THRIFT-977] - Hex Conversion Bug in C++ TJSONProtocol + * [THRIFT-347] - PHP TSocket Timeout Issues + * [THRIFT-517] - TExceptions thrown by server result in cryptic error message on client - Tried to read 4 bytes, but only got 0 bytes + +## Improvement + * [THRIFT-1024] - Add Python Twisted example to the Tutorial + * [THRIFT-958] - Change accessmodifer on trans_ field in the FrameBuffer class to public. + * [THRIFT-957] - THsHaServer: Change access modifier of the invoker field. + * [THRIFT-1002] - CodeStyle: t_c_glib_generator.cc + * [THRIFT-1005] - Give unions byte[] signature methods to go along with their ByteBuffer counterparts + * [THRIFT-951] - Add a new isServing() method to TServer + * [THRIFT-943] - Silly readme typo fix. + * [THRIFT-961] - JavaScript TestSuite using ant/ivy and Java's ServerTestBase Handler + * [THRIFT-960] - add TestServer, TestNonblockingServer and TestClient again + * [THRIFT-949] - Modify the TEnum interface so it defines a method similar to findByValue + * [THRIFT-946] - Augment FieldValueMetaData so it differentiates 'string' and 'binary' fields. + * [THRIFT-903] - custom ThreadFactory in THsHaServer + * [THRIFT-913] - Test Case for Url encoded strings + simple enhancement to lib/js/test/RunTestServer.sh + * [THRIFT-926] - Miscellaneous C++ improvements + * [THRIFT-929] - Improvements to the C++ test suite + * [THRIFT-893] - add JavaScript to the tutorial examples + * [THRIFT-1003] - Polishing c_glib code + * [THRIFT-71] - Debian packaging for thrift + +## New Feature + * [THRIFT-1033] - Node.js language target + * [THRIFT-947] - Provide a helper method to determine the TProtocol used to serialize some data. + * [THRIFT-928] - Make more statistics available in C++ servers + * [THRIFT-922] - Templatized [de]serialization code for C++ + * [THRIFT-923] - Event-driven client and server support for C++ + * [THRIFT-925] - Provide name<->value map for enums in C++ + * [THRIFT-927] - Add option to modify the PHP include path + * [THRIFT-377] - TFileTransport port in Java + * [THRIFT-106] - TSSLServerSocket + * [THRIFT-582] - C implementation of Thrift + * [THRIFT-745] - Make it easier to instantiate servers + +## Sub-task + * [THRIFT-1038] - Generated Java code for structures containing binary fields (or collections thereof) are not serializable (in the Java sense) even though they implement java.io.Serializable + +## Task + * [THRIFT-862] - Async client issues / improvements + +## Test + * [THRIFT-581] - Add a testsuite for txThrift (Twisted) + + + +Thrift 0.5.0 - Incubating +-------------------------------------------------------------------------------- +THRIFT-505 Build Make configure give a summary of the enabled components (David Reiss) +THRIFT-506 Build Allow Thrift to be built without the C++ library (David Reiss) +THRIFT-844 Build Build Requirements state autoconf 2.59+ is required, but 2.60+ is needed (Harlan Lieberman-Berg) +THRIFT-850 Build Perl runtime requires Bit::Vector which may not be installed by default, but configure does not fail (Michael Lum) +THRIFT-854 Build Provide configure option and make rules to build/install php extension (Anthony Molinaro) +THRIFT-858 Build Have bootstrap.sh check for a suitable autoconf version before running (David Reiss) +THRIFT-871 Build Thrift compiler for WIndows (binary distribution) (David Reiss) +THRIFT-323 C# TJSONProtocol (Roger Meier) +THRIFT-634 C# C# Compiler Generates Incorrect Code For Fields which begin with an uppercase letter (Jon S Akhtar) +THRIFT-881 C# add csharp to the tutorial (Roger Meier) +THRIFT-856 C++ Building cpp library fails on OS X with malloc and free not being declared in scope (James Clarke) +THRIFT-865 C++ C++ compiler build depends on libfl even when flex/lex not detected (David Reiss) +THRIFT-900 C++ Unix domain socket (Roger Meier) +THRIFT-920 C++ C++ Test and Tutorial does not compile anymore due to the change within Enum handling (Roger Meier) +THRIFT-567 C++ Can't immediately stop a TSimpleServer thread that is idle (Rush Manbert) +THRIFT-756 C++ Exposing TSocket(int) constructor to public (Rajat Goel) +THRIFT-798 C++ TNonblockingServer leaks resources when destroyed (David Reiss) +THRIFT-812 C++, Python Demo of Thrift over ZeroMQ (David Reiss) +THRIFT-629 Cocoa Unused Field In TSocketServer Appears To Break iPhone Build (Jon S Akhtar) +THRIFT-838 Cocoa Generated Cocoa classes have useless @dynamic declarations (Kevin Ballard) +THRIFT-805 Cocoa Don't generate process_XXXX methods for oneway methods (Brad Taylor) +THRIFT-507 Compiler Remove the compiler's dependency on Boost (David Reiss) +THRIFT-895 Compiler (General) Thrift compiler does not allow two different enumerations to have the same key name for one of the enum values (David Reiss) +THRIFT-852 Compiler (General) Missing newline causes many compiler warnings (Anthony Molinaro) +THRIFT-877 Compiler (General) smalltalk namespace doesn't work (Bruce Lowekamp) +THRIFT-897 Compiler (General) Don't allow unqualified constant access to enum values (Bryan Duxbury) +THRIFT-9 Compiler (General) Add a default namespace declaration for all languages (David Reiss) +THRIFT-599 Erlang Don't use unnecessary processes in the Erlang transports and clients (David Reiss) +THRIFT-646 Erlang Erlang library is missing install target (David Reiss) +THRIFT-698 Erlang Generated module list should contain atoms, not strings (Anthony Molinaro) +THRIFT-866 Erlang term() in spec definitions seems to not work in erlang R12 (Anthony Molinaro) +THRIFT-886 Erlang Dialyzer warning (Anthony Molinaro) +THRIFT-785 Erlang Framed transport server problems (Anthony Molinaro) +THRIFT-884 HTML HTML Generator: add Key attribute to the Data Types Tables (Roger Meier) +THRIFT-652 Haskell Generated field name for strut is not capitalized correctly (Christian Lavoie) +THRIFT-743 Haskell compile error with GHC 6.12.1 (Christian Lavoie) +THRIFT-901 Haskell Allow the bindings to compile without -fglasgow-exts and with -Wall -Werror (Christian Lavoie) +THRIFT-905 Haskell Make haskell thrift bindings use automake to compile and install (Christian Lavoie) +THRIFT-906 Haskell Improve type mappings (Christian Lavoie) +THRIFT-914 Haskell Make haskell bindings 'easily' compilable (Christian Lavoie) +THRIFT-918 Haskell Make haskell tests run again (Christian Lavoie) +THRIFT-919 Haskell Update Haskell bindings README (Christian Lavoie) +THRIFT-787 Haskell Enums are not read correctly (Christian Lavoie) +THRIFT-250 Java ExecutorService as a constructor parameter for TServer (Ed Ceaser) +THRIFT-693 Java Thrift compiler generated java code that throws compiler warnings about deprecated methods. (Bryan Duxbury) +THRIFT-843 Java TNonblockingSocket connects without a timeout (Bryan Duxbury) +THRIFT-845 Java async client does not respect timeout (Ning Liang) +THRIFT-870 Java Java constants don't get Javadoc comments (Bryan Duxbury) +THRIFT-873 Java Java tests fail due to Too many open files (Todd Lipcon) +THRIFT-876 Java Add SASL support (Aaron T. Myers) +THRIFT-879 Java Remove @Override from TUnion.clear (Dave Engberg) +THRIFT-882 Java deep copy of binary fields does not copy ByteBuffer characteristics (arrayOffset, position) (Bryan Duxbury) +THRIFT-888 Java async client should also have nonblocking connect (Eric Jensen) +THRIFT-890 Java Java tutorial doesn't work (Todd Lipcon) +THRIFT-894 Java Make default accessors for binary fields return byte[]; provide new accessors to get ByteBuffer version (Bryan Duxbury) +THRIFT-896 Java TNonblockingSocket.isOpen() returns true even after close() (Eric Jensen) +THRIFT-907 Java libfb303 doesn't compile in 0.4.0 (Todd Lipcon) +THRIFT-912 Java Improvements and bug fixes to SASL implementation (Todd Lipcon) +THRIFT-917 Java THsHaServer should not accept an ExecutorService without catching RejectedExecutionException (Ed Ceaser) +THRIFT-931 Java Use log4j for Java tests (Todd Lipcon) +THRIFT-880 JavaME JavaME code generator and runtime library (Dave Engberg) +THRIFT-846 JavaScript JavaScript Test Framwork: extended Testcases (Roger Meier) +THRIFT-885 JavaScript Url encoded strings never get decoded? How do we fix this? (T Jake Luciani) +THRIFT-911 JavaScript (JavaScript compiler) Const structs, maps, sets, and lists generate a trailing comma (T Jake Luciani) +THRIFT-860 OCaml copy method and reset method (Lev Walkin) +THRIFT-682 PHP PHP extension doesn't compile on Mac OS X (Bryan Duxbury) +THRIFT-851 PHP php extension fails to compile on centos 5.x (Todd Lipcon) +THRIFT-840 Perl Perl protocol handler could be more robust against unrecognised types (Conrad Hughes) +THRIFT-758 Perl incorrect deference in exception handling (Yann Kerherve) +THRIFT-257 Python Support validation of required fields (Esteve Fernandez) +THRIFT-335 Python Compact Protocol for Python (David Reiss) +THRIFT-596 Python Make Python's TBufferedTransport use a configurable input buffer (David Reiss) +THRIFT-597 Python Python THttpServer performance improvements (David Reiss) +THRIFT-598 Python Allow Python's threading servers to use daemon threads (David Reiss) +THRIFT-666 Python Allow the handler to override HTTP responses in THttpServer (David Reiss) +THRIFT-673 Python Generated Python code has whitespace issues (Ian Eure) +THRIFT-721 Python THttpClient ignores url parameters (Thomas Kho) +THRIFT-824 Python TApplicationException.__str__() refers to class constants as globals (Peter Schuller) +THRIFT-855 Python Include optimized compiled python objects in install (Anthony Molinaro) +THRIFT-859 Python Allow py:twisted to be generated in different namespace than py (Bruce Lowekamp) +THRIFT-869 Python TSocket.py on Mac (and FreeBSD) doesn't handle ECONNRESET from recv() (Steven Knight) +THRIFT-875 Python Include python setup.cfg in dist (Anthony Molinaro) +THRIFT-610 Ruby binary_protocol.rb segfaults [line 86] (Unassigned) +THRIFT-899 Ruby Ruby read timeouts can sometimes be 2x what they should be (Ryan King) +THRIFT-909 Ruby allow block argument to struct constructor (Michael Stockton) +THRIFT-456 Test Suite Bad IP address string in test/cpp/src/main.cpp (Rush Manbert) + + +Thrift 0.4.0 - Incubating +-------------------------------------------------------------------------------- +THRIFT-650 Build Make Check fails on Centos/OSX with 0.2.0 tarball (Anthony Molinaro) +THRIFT-770 Build Get 'make dist' to work without first compiling source code (Anthony Molinaro) +THRIFT-160 C# Created THttpTransport for the C# library based on WebHttpRequest (Michael Greene) +THRIFT-834 C# THttpClient resends contents of message after transport errors (Anatoly Fayngelerin) +THRIFT-247 C++ THttpServer Transport (Unassigned) +THRIFT-676 C++ Change C++ code generator so that generated classes can be wrapped with SWIG (Unassigned) +THRIFT-570 Compiler Thrift compiler does not error when duplicate method names are present (Bruce Simpson) +THRIFT-808 Compiler Segfault when constant declaration references a struct field that doesn't exist (Bryan Duxbury) +THRIFT-646 Erlang Erlang library is missing install target (Anthony Molinaro) +THRIFT-544 General multiple enums with the same key generate invalid code (Ben Taitelbaum) +THRIFT-434 General ruby compiler should warn when a reserved word is used (Michael Stockton) +THRIFT-799 General Files missing proper Apache license header (Bryan Duxbury) +THRIFT-832 HTML HTML generator shows unspecified struct fields as 'required' (Bryan Duxbury) +THRIFT-226 Java Collections with binary keys or values break equals() (Bryan Duxbury) +THRIFT-484 Java Ability to use a slice of a buffer instead of a direct byte[] for binary fields (Bryan Duxbury) +THRIFT-714 Java maxWorkerThreads parameter to THsHaServer has no effect (Bryan Duxbury) +THRIFT-751 Java Add clear() method to TBase (Bryan Duxbury) +THRIFT-765 Java Improved string encoding and decoding performance (Bryan Duxbury) +THRIFT-768 Java Async client for Java (Bryan Duxbury) +THRIFT-774 Java TDeserializer should provide a partialDeserialize method for primitive types (Piotr Kozikowski) +THRIFT-783 Java .equals java method is broken on structs containing binary-type fields (Unassigned) +THRIFT-804 Java CompareTo is broken for unions set to map, set, or list (Bryan Duxbury) +THRIFT-814 Java Include a TServlet in the standard Thrift distribution (Mathias Herberts) +THRIFT-818 Java Async client doesn't send method args (Bryan Duxbury) +THRIFT-830 Java Switch binary field implementation from byte[] to ByteBuffer (Bryan Duxbury) +THRIFT-831 Java FramedTransport implementation that reuses its buffers (Bryan Duxbury) +THRIFT-833 Java build.xml in lib/java is missing a classpathref attribute for the javadoc task (Bryan Duxbury) +THRIFT-836 Java Race condition causes CancelledKeyException in TAsyncClientManager (Bryan Duxbury) +THRIFT-842 Java Upgrade to current version of commons-lang (2.5 instead of 2.4) and/or change dependency in ivy.xml to not be exact (Bryan Duxbury) +THRIFT-815 JavaScript Deserialization of lists is critically broken. (T Jake Luciani) +THRIFT-827 OCaml OCaml generator to take default values into account (Lev Walkin) +THRIFT-647 PHP PHP library is missing install target (Anthony Molinaro) +THRIFT-682 PHP PHP extension doesn't compile on Mac OS X (Bryan Duxbury) +THRIFT-718 PHP Thrift PHP library includes closing tags and extraneous whitespace (Nicholas Telford) +THRIFT-778 PHP PHP socket listening server (Nick Jones) +THRIFT-780 PHP PHP extension sometimes causes an abort with two exceptions at the same time (David Reiss) +THRIFT-837 PHP PHP accelerator bug for writes > 8k (Thomas Kho) +THRIFT-782 Perl Perl code for writing containers doesn't count length of write*Begin or write*End (Conrad Hughes) +THRIFT-395 Python Python library + compiler does not support unicode strings (Unassigned) +THRIFT-133 Ruby 'namespace ruby' should error out, or be an alias to 'namespace rb' (Bryan Duxbury) +THRIFT-664 Ruby Ruby extension fails to build with Ruby 1.9.1 (Rajesh Malepati) +THRIFT-699 Ruby Excise unused "native protocol method table" stuff from thrift_native (Bryan Duxbury) +THRIFT-767 Ruby ruby compiler does not keep comments for enum values (Bryan Duxbury) +THRIFT-811 Ruby http_client_transport.rb: allow custom http headers (Tony Kamenick) +THRIFT-459 Ruby Ruby installation always tries to write to /Library/Ruby/site (Matthieu Imbert) + + +Thrift 0.1.0 - Incubating (not released) +-------------------------------------------------------------------------------- +Compatibility Breaking Changes: + C++: + * It's quite possible that regenerating code and rebuilding will be + required. Make sure your headers match your libs! + + Java: + + Python: + + Ruby: + * Generated files now have underscored names [THRIFT-421] + * The library has been rearranged to be more Ruby-like [THRIFT-276] + + Erlang: + * Generated code will have to be regenerated, and the new code will + have to be deployed atomically with the new library code [THRIFT-136] + +New Features and Bug Fixes: + C++: + * Support for TCompactProtocol [THRIFT-333] + + Java: + * Support for TCompactProtocol [THRIFT-110] + + Python: + * Support for Twisted [THRIFT-148] + + Ruby: + * Support for TCompactProtocol [THRIFT-332] + diff --git a/vendor/github.com/apache/thrift/CMakeLists.txt b/vendor/github.com/apache/thrift/CMakeLists.txt new file mode 100644 index 0000000000000..93ed8d2ac58e9 --- /dev/null +++ b/vendor/github.com/apache/thrift/CMakeLists.txt @@ -0,0 +1,117 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cmake_minimum_required(VERSION 2.8.12) + +project("Apache Thrift") + +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + +# TODO: add `git rev-parse --short HEAD` +# Read the version information from the Autoconf file +file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" CONFIGURE_AC REGEX "AC_INIT\\(.*\\)" ) + +# The following variable is used in the version.h.in file +string(REGEX REPLACE "AC_INIT\\(\\[.*\\], \\[([0-9]+\\.[0-9]+\\.[0-9]+(-dev)?)\\]\\)" "\\1" PACKAGE_VERSION ${CONFIGURE_AC}) +message(STATUS "Parsed Thrift package version: ${PACKAGE_VERSION}") + +# These are internal to CMake +string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)(-dev)?" "\\1" thrift_VERSION ${PACKAGE_VERSION}) +string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" thrift_VERSION_MAJOR ${thrift_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" thrift_VERSION_MINOR ${thrift_VERSION}) +string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" thrift_VERSION_PATCH ${thrift_VERSION}) +message(STATUS "Parsed Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})") + +# Some default settings +include(DefineCMakeDefaults) + +# Build time options are defined here +include(DefineOptions) +include(DefineInstallationPaths) + +# Based on the options set some platform specifics +include(DefinePlatformSpecifc) + +# Generate the config.h file +include(ConfigureChecks) + +# Package it +include(CPackConfig) + + +find_package(Threads) + +include(CTest) +if(BUILD_TESTING) + message(STATUS "Building with unittests") + + enable_testing() + # Define "make check" as alias for "make test" + add_custom_target(check COMMAND ctest) +else () + message(STATUS "Building without tests") +endif () + +if(BUILD_COMPILER) + if(NOT EXISTS ${THRIFT_COMPILER}) + set(THRIFT_COMPILER $) + endif() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/compiler/cpp) +elseif(EXISTS ${THRIFT_COMPILER}) + add_executable(thrift-compiler IMPORTED) + set_property(TARGET thrift-compiler PROPERTY IMPORTED_LOCATION ${THRIFT_COMPILER}) +endif() + +if(BUILD_CPP) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp) + if(BUILD_TUTORIALS) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tutorial/cpp) + endif() + if(BUILD_TESTING) + if(WITH_LIBEVENT AND WITH_ZLIB AND WITH_OPENSSL) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp) + else() + message(WARNING "libevent and/or ZLIB and/or OpenSSL not found or disabled; will not build some tests") + endif() + endif() +endif() + +if(BUILD_C_GLIB) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/c_glib) +endif() + +if(BUILD_JAVA) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/java) +endif() + +if(BUILD_PYTHON) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/py) + if(BUILD_TESTING) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/py) + endif() +endif() + +if(BUILD_HASKELL) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/hs) + if(BUILD_TESTING) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/hs) + endif() +endif() + +PRINT_CONFIG_SUMMARY() diff --git a/vendor/github.com/apache/thrift/CONTRIBUTING.md b/vendor/github.com/apache/thrift/CONTRIBUTING.md new file mode 100644 index 0000000000000..316da9a00de83 --- /dev/null +++ b/vendor/github.com/apache/thrift/CONTRIBUTING.md @@ -0,0 +1,49 @@ +## How to contribute + 1. Help to review and verify existing patches + 1. Make sure your issue is not all ready in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT) + 1. If not, create a ticket describing the change you're proposing in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT) + 1. Contribute your patch using one of the two methods below + +### Contributing via a patch + +1. Check out the latest version of the source code + + * git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift + +1. Modify the source to include the improvement/bugfix + + * Remember to provide *tests* for all submited changes + * When bugfixing: add test that will isolate bug *before* applying change that fixes it + * Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages) + +1. Create a patch from project root directory (e.g. you@dev:~/thrift $ ): + + * git diff > ../thrift-XXX-my-new-feature.patch + +1. Attach the newly generated patch to the issue +1. Wait for other contributors or committers to review your new addition +1. Wait for a committer to commit your patch + +### Contributing via GitHub pull requests + +1. Create a fork for http://github.com/apache/thrift +1. Create a branch for your changes(best practice is issue as branch name, e.g. THRIFT-9999) +1. Modify the source to include the improvement/bugfix + + * Remember to provide *tests* for all submited changes + * When bugfixing: add test that will isolate bug *before* applying change that fixes it + * Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages) + * Verify that your change works on other platforms by adding a GitHub service hook to [Travis CI](http://docs.travis-ci.com/user/getting-started/#Step-one%3A-Sign-in) and [AppVeyor](http://www.appveyor.com/docs) + +1. Commit and push changes to your branch (please use issue name and description as commit title, e.g. THRIFT-9999 make it perfect) +1. Issue a pull request with the jira ticket number you are working on in it's name +1. Wait for other contributors or committers to review your new addition +1. Wait for a committer to commit your patch + +### More info + + Plenty of information on why and how to contribute is available on the Apache Software Foundation (ASF) web site. In particular, we recommend the following: + + * [Contributors Tech Guide](http://www.apache.org/dev/contributors) + * [Get involved!](http://www.apache.org/foundation/getinvolved.html) + * [Legal aspects on Submission of Contributions (Patches)](http://www.apache.org/licenses/LICENSE-2.0.html#contributions) diff --git a/vendor/github.com/apache/thrift/Dockerfile b/vendor/github.com/apache/thrift/Dockerfile new file mode 100644 index 0000000000000..0d7ad2175e353 --- /dev/null +++ b/vendor/github.com/apache/thrift/Dockerfile @@ -0,0 +1,61 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Goal: provide a thrift-compiler Docker image +# +# Usage: +# docker run -v "${PWD}:/data" thrift/thrift-compiler -gen cpp -o /data/ /data/test/ThriftTest.thrift +# +# further details on docker for thrift is here build/docker/ +# +# TODO: push to apache/thrift-compiler instead of thrift/thrift-compiler + +FROM debian:jessie +MAINTAINER Apache Thrift + +ENV DEBIAN_FRONTEND noninteractive + +ADD . /thrift + +RUN buildDeps=" \ + flex \ + bison \ + g++ \ + make \ + cmake \ + curl \ + "; \ + apt-get update && apt-get install -y --no-install-recommends $buildDeps \ + && mkdir /tmp/cmake-build && cd /tmp/cmake-build \ + && cmake \ + -DBUILD_COMPILER=ON \ + -DBUILD_LIBRARIES=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_EXAMPLES=OFF \ + /thrift \ + && cmake --build . --config Release \ + && make install \ + && curl -k -sSL "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz" -o /tmp/go.tar.gz \ + && tar xzf /tmp/go.tar.gz -C /tmp \ + && cp /tmp/go/bin/gofmt /usr/bin/gofmt \ + && apt-get purge -y --auto-remove $buildDeps \ + && apt-get clean \ + && rm -rf /tmp/* \ + && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT ["thrift"] diff --git a/vendor/github.com/apache/thrift/Makefile.am b/vendor/github.com/apache/thrift/Makefile.am new file mode 100644 index 0000000000000..ed58265acefc4 --- /dev/null +++ b/vendor/github.com/apache/thrift/Makefile.am @@ -0,0 +1,131 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +ACLOCAL_AMFLAGS = -I ./aclocal + +if WITH_PLUGIN +# To enable bootstrap, build order is lib/cpp -> compiler -> others +SUBDIRS = lib/cpp compiler/cpp lib +if WITH_TESTS +SUBDIRS += lib/cpp/test +endif +else +SUBDIRS = compiler/cpp lib +endif + +if WITH_TESTS +SUBDIRS += test +endif + +if WITH_TUTORIAL +SUBDIRS += tutorial +endif + +dist-hook: + find $(distdir) -type f \( -iname ".DS_Store" -or -iname "._*" -or -iname ".gitignore" \) | xargs rm -rf + find $(distdir) -type d \( -iname ".deps" -or -iname ".libs" \) | xargs rm -rf + find $(distdir) -type d \( -iname ".svn" -or -iname ".git" \) | xargs rm -rf + +print-version: + @echo $(VERSION) + +.PHONY: precross cross +precross-%: all + $(MAKE) -C $* precross +precross: all precross-test precross-lib + +empty := +space := $(empty) $(empty) +comma := , + +CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ +CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS)) + +if WITH_PY3 +CROSS_PY=$(PYTHON3) +else +CROSS_PY=$(PYTHON) +endif + +if WITH_PYTHON +crossfeature: precross + $(CROSS_PY) test/test.py --retry-count 3 --features .* --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) +else +# feature test needs python build +crossfeature: +endif + +cross-%: precross crossfeature + $(CROSS_PY) test/test.py --retry-count 3 --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED) --regex "$*" + +cross: cross-.* + +TIMES = 1 2 3 +fail: precross + $(CROSS_PY) test/test.py || true + $(CROSS_PY) test/test.py --update-expected-failures=overwrite + $(foreach var,$(TIMES),test/test.py -s || true;test/test.py --update-expected-failures=merge;) + +codespell_skip_files = \ + *.jar \ + *.class \ + *.so \ + *.a \ + *.la \ + *.o \ + *.p12 \ + *OCamlMakefile \ + .keystore \ + .truststore \ + CHANGES \ + config.sub \ + configure \ + depcomp \ + libtool.m4 \ + output.* \ + rebar \ + thrift + +skipped_files = $(subst $(space),$(comma),$(codespell_skip_files)) + +style-local: + codespell --write-changes --skip=$(skipped_files) --disable-colors + +EXTRA_DIST = \ + .clang-format \ + .editorconfig \ + .travis.yml \ + appveyor.yml \ + bower.json \ + build \ + CMakeLists.txt \ + composer.json \ + contrib \ + CONTRIBUTING.md \ + debian \ + doc \ + doap.rdf \ + package.json \ + sonar-project.properties \ + Dockerfile \ + LICENSE \ + CHANGES \ + NOTICE \ + README.md \ + Thrift.podspec diff --git a/vendor/github.com/apache/thrift/README.md b/vendor/github.com/apache/thrift/README.md new file mode 100644 index 0000000000000..07cd32f09824b --- /dev/null +++ b/vendor/github.com/apache/thrift/README.md @@ -0,0 +1,166 @@ +Apache Thrift +============= + ++[![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift) +- +[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/e2qks7enyp9gw7ma?svg=true)](https://ci.appveyor.com/project/apache/thrift) + + +Introduction +============ + +Thrift is a lightweight, language-independent software stack with an +associated code generation mechanism for RPC. Thrift provides clean +abstractions for data transport, data serialization, and application +level processing. The code generation system takes a simple definition +language as its input and generates code across programming languages that +uses the abstracted stack to build interoperable RPC clients and servers. + +Thrift is specifically designed to support non-atomic version changes +across client and server code. + +For more details on Thrift's design and implementation, take a gander at +the Thrift whitepaper included in this distribution or at the README.md files +in your particular subdirectory of interest. + +Hierarchy +========= + +thrift/ + + compiler/ + + Contains the Thrift compiler, implemented in C++. + + lib/ + + Contains the Thrift software library implementation, subdivided by + language of implementation. + + cpp/ + go/ + java/ + php/ + py/ + rb/ + + test/ + + Contains sample Thrift files and test code across the target programming + languages. + + tutorial/ + + Contains a basic tutorial that will teach you how to develop software + using Thrift. + +Requirements +============ + +See http://thrift.apache.org/docs/install for an up-to-date list of build requirements. + +Resources +========= + +More information about Thrift can be obtained on the Thrift webpage at: + + http://thrift.apache.org + +Acknowledgments +=============== + +Thrift was inspired by pillar, a lightweight RPC tool written by Adam D'Angelo, +and also by Google's protocol buffers. + +Installation +============ + +If you are building from the first time out of the source repository, you will +need to generate the configure scripts. (This is not necessary if you +downloaded a tarball.) From the top directory, do: + + ./bootstrap.sh + +Once the configure scripts are generated, thrift can be configured. +From the top directory, do: + + ./configure + +You may need to specify the location of the boost files explicitly. +If you installed boost in /usr/local, you would run configure as follows: + + ./configure --with-boost=/usr/local + +Note that by default the thrift C++ library is typically built with debugging +symbols included. If you want to customize these options you should use the +CXXFLAGS option in configure, as such: + + ./configure CXXFLAGS='-g -O2' + ./configure CFLAGS='-g -O2' + ./configure CPPFLAGS='-DDEBUG_MY_FEATURE' + +To enable gcov required options -fprofile-arcs -ftest-coverage enable them: + + ./configure --enable-coverage + +Run ./configure --help to see other configuration options + +Please be aware that the Python library will ignore the --prefix option +and just install wherever Python's distutils puts it (usually along +the lines of /usr/lib/pythonX.Y/site-packages/). If you need to control +where the Python modules are installed, set the PY_PREFIX variable. +(DESTDIR is respected for Python and C++.) + +Make thrift: + + make + +From the top directory, become superuser and do: + + make install + +Note that some language packages must be installed manually using build tools +better suited to those languages (at the time of this writing, this applies +to Java, Ruby, PHP). + +Look for the README.md file in the lib// folder for more details on the +installation of each language library package. + +Testing +======= + +There are a large number of client library tests that can all be run +from the top-level directory. + + make -k check + +This will make all of the libraries (as necessary), and run through +the unit tests defined in each of the client libraries. If a single +language fails, the make check will continue on and provide a synopsis +at the end. + +To run the cross-language test suite, please run: + + make cross + +This will run a set of tests that use different language clients and +servers. + +License +======= + +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. diff --git a/vendor/github.com/apache/thrift/Thrift.podspec b/vendor/github.com/apache/thrift/Thrift.podspec new file mode 100644 index 0000000000000..2ead0e93df379 --- /dev/null +++ b/vendor/github.com/apache/thrift/Thrift.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |s| + s.name = "Thrift" + s.version = "0.10.0" + s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC." + s.description = <<-DESC +The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. + DESC + s.homepage = "http://thrift.apache.org" + s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' } + s.author = { "The Apache Software Foundation" => "apache@apache.org" } + s.requires_arc = true + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.8' + s.ios.framework = 'CFNetwork' + s.osx.framework = 'CoreServices' + s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-0.10.0" } + s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}' +end \ No newline at end of file diff --git a/vendor/github.com/apache/thrift/appveyor.yml b/vendor/github.com/apache/thrift/appveyor.yml new file mode 100644 index 0000000000000..03ee29543584e --- /dev/null +++ b/vendor/github.com/apache/thrift/appveyor.yml @@ -0,0 +1,93 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# build Apache Thrift on AppVeyor - https://ci.appveyor.com + +shallow_clone: true +clone_depth: 10 + +version: '{build}' +os: +# - Windows Server 2012 R2 +- Visual Studio 2015 + +environment: + BOOST_ROOT: C:\Libraries\boost_1_59_0 + BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0 + # Unfurtunately, this version needs manual update because old versions are quickly deleted. + ANT_VERSION: 1.9.7 + +install: +- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64' +- cd \ + # Zlib +- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz +- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar > nul +- cd zlib-1.2.8 +- cmake -G "Visual Studio 14 2015 Win64" . +- cmake --build . --config release +- cd .. + # OpenSSL +- C:\Python35-x64\python %APPVEYOR_BUILD_FOLDER%\build\appveyor\download_openssl.py +- ps: Start-Process "Win64OpenSSL.exe" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait + # Libevent +- appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz +- 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar > nul +- cd libevent-2.0.22-stable +- nmake -f Makefile.nmake +- mkdir lib +- move *.lib lib\ +- move WIN32-Code\event2\* include\event2\ +- move *.h include\ +- cd .. +- appveyor-retry cinst -y winflexbison +- appveyor DownloadFile http://www.us.apache.org/dist/ant/binaries/apache-ant-%ANT_VERSION%-bin.zip +- 7z x apache-ant-%ANT_VERSION%-bin.zip > nul +- cd %APPVEYOR_BUILD_FOLDER% +# TODO: Enable Haskell build +# - cinst HaskellPlatform -version 2014.2.0.0 + + +build_script: +- set PATH=C:\ProgramData\chocolatey\bin;C:\apache-ant-%ANT_VERSION%\bin;%PATH% +- set JAVA_HOME=C:\Program Files\Java\jdk1.7.0 +- set PATH=%JAVA_HOME%\bin;%PATH% +# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin +# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin +- set PATH=C:\Python27-x64\scripts;C:\Python27-x64;%PATH% +- pip install ipaddress backports.ssl_match_hostname tornado twisted +- mkdir cmake-build +- cd cmake-build +- cmake -G "Visual Studio 14 2015 Win64" -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=C:\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=C:\zlib-1.2.8 -DZLIB_LIBRARY=C:\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" .. +- findstr /b /e BUILD_COMPILER:BOOL=ON CMakeCache.txt +- findstr /b /e BUILD_CPP:BOOL=ON CMakeCache.txt +- findstr /b /e BUILD_JAVA:BOOL=ON CMakeCache.txt +- findstr /b /e BUILD_PYTHON:BOOL=ON CMakeCache.txt +# - findstr /b /e BUILD_C_GLIB:BOOL=ON CMakeCache.txt +# - findstr /b /e BUILD_HASKELL:BOOL=ON CMakeCache.txt +- findstr /b /e BUILD_TESTING:BOOL=ON CMakeCache.txt +# - cmake --build . +- cmake --build . --config Release +# TODO: Fix cpack +# - cpack +# TODO: Run more tests +# CTest fails to invoke ant seemingly due to "ant.bat" v.s. "ant" (shell script) conflict. +# Currently, everything that involves OpenSSL seems to hang forever on our Appveyor setup. +# Also a few C++ tests hang (on Appveyor or on Windows in general). +- ctest -C Release --timeout 600 -VV -E "(StressTestNonBlocking|PythonTestSSLSocket|python_test$|^Java)" +# TODO make it perfect ;-r diff --git a/vendor/github.com/apache/thrift/bootstrap.sh b/vendor/github.com/apache/thrift/bootstrap.sh new file mode 100644 index 0000000000000..52ecda47b3ada --- /dev/null +++ b/vendor/github.com/apache/thrift/bootstrap.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +./cleanup.sh +if test -d lib/php/src/ext/thrift_protocol ; then + if phpize -v >/dev/null 2>/dev/null ; then + (cd lib/php/src/ext/thrift_protocol && phpize) + fi +fi + +set -e + +# libtoolize is called "glibtoolize" on OSX. +if libtoolize --version 1 >/dev/null 2>/dev/null; then + LIBTOOLIZE=libtoolize +elif glibtoolize --version 1 >/dev/null 2>/dev/null; then + LIBTOOLIZE=glibtoolize +else + echo >&2 "Couldn't find libtoolize!" + exit 1 +fi + +# we require automake 1.13 or later +# check must happen externally due to use of newer macro +AUTOMAKE_VERSION=`automake --version | grep automake | egrep -o '([0-9]{1,}\.)+[0-9]{1,}'` +if [ "$AUTOMAKE_VERSION" \< "1.13" ]; then + echo >&2 "automake version $AUTOMAKE_VERSION is too old (need 1.13 or later)" + exit 1 +fi + +autoscan +$LIBTOOLIZE --copy --automake +aclocal -I ./aclocal +autoheader +autoconf +automake --copy --add-missing --foreign diff --git a/vendor/github.com/apache/thrift/bower.json b/vendor/github.com/apache/thrift/bower.json new file mode 100644 index 0000000000000..9ec59fcb5dc62 --- /dev/null +++ b/vendor/github.com/apache/thrift/bower.json @@ -0,0 +1,16 @@ +{ + "name": "thrift", + "version": "0.10.0", + "homepage": "https://git-wip-us.apache.org/repos/asf/thrift.git", + "authors": [ + "Apache Thrift " + ], + "description": "Apache Thrift", + "main": "lib/js/src/thrift.js", + "keywords": [ + "thrift" + ], + "license": "Apache v2", + "ignore": [ + ] +} diff --git a/vendor/github.com/apache/thrift/cleanup.sh b/vendor/github.com/apache/thrift/cleanup.sh new file mode 100644 index 0000000000000..f110721ac9f59 --- /dev/null +++ b/vendor/github.com/apache/thrift/cleanup.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +topsrcdir="`dirname $0`" +cd "$topsrcdir" + +make -k clean >/dev/null 2>&1 +make -k distclean >/dev/null 2>&1 +find . -name Makefile.in -exec rm -f {} \; +rm -rf \ +AUTHORS \ +ChangeLog \ +INSTALL \ +Makefile \ +Makefile.in \ +Makefile.orig \ +aclocal/libtool.m4 \ +aclocal/ltoptions.m4 \ +aclocal/ltsugar.m4 \ +aclocal/ltversion.m4 \ +aclocal/lt~obsolete.m4 \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.hin~ \ +config.log \ +config.status \ +config.status.lineno \ +config.sub \ +configure \ +configure.lineno \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +libtool \ +ltmain.sh \ +missing \ +ylwrap \ +if/gen-* \ +test/gen-* \ +lib/php/src/ext/thrift_protocol/.deps \ +lib/php/src/ext/thrift_protocol/Makefile \ +lib/php/src/ext/thrift_protocol/Makefile.fragments \ +lib/php/src/ext/thrift_protocol/Makefile.global \ +lib/php/src/ext/thrift_protocol/Makefile.objects \ +lib/php/src/ext/thrift_protocol/acinclude.m4 \ +lib/php/src/ext/thrift_protocol/aclocal.m4 \ +lib/php/src/ext/thrift_protocol/autom4te.cache \ +lib/php/src/ext/thrift_protocol/build \ +lib/php/src/ext/thrift_protocol/config.guess \ +lib/php/src/ext/thrift_protocol/config.h \ +lib/php/src/ext/thrift_protocol/config.h.in \ +lib/php/src/ext/thrift_protocol/config.log \ +lib/php/src/ext/thrift_protocol/config.nice \ +lib/php/src/ext/thrift_protocol/config.status \ +lib/php/src/ext/thrift_protocol/config.sub \ +lib/php/src/ext/thrift_protocol/configure \ +lib/php/src/ext/thrift_protocol/configure.in \ +lib/php/src/ext/thrift_protocol/include \ +lib/php/src/ext/thrift_protocol/install-sh \ +lib/php/src/ext/thrift_protocol/libtool \ +lib/php/src/ext/thrift_protocol/ltmain.sh \ +lib/php/src/ext/thrift_protocol/missing \ +lib/php/src/ext/thrift_protocol/mkinstalldirs \ +lib/php/src/ext/thrift_protocol/modules \ +lib/php/src/ext/thrift_protocol/run-tests.php diff --git a/vendor/github.com/apache/thrift/composer.json b/vendor/github.com/apache/thrift/composer.json new file mode 100644 index 0000000000000..d937bc7ac2155 --- /dev/null +++ b/vendor/github.com/apache/thrift/composer.json @@ -0,0 +1,30 @@ +{ + "name": "apache/thrift", + "description": "Apache Thrift RPC system", + "homepage": "http://thrift.apache.org/", + "type": "library", + "license": "Apache-2.0", + "authors": [ + { + "name": "Apache Thrift Developers", + "email": "dev@thrift.apache.org", + "homepage": "http://thrift.apache.org" + } + ], + "support": { + "email": "dev@thrift.apache.org", + "issues": "https://issues.apache.org/jira/browse/THRIFT" + }, + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-0": {"Thrift": "lib/php/lib/"} + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "0.10.0" + } + } +} diff --git a/vendor/github.com/apache/thrift/configure.ac b/vendor/github.com/apache/thrift/configure.ac new file mode 100644 index 0000000000000..0972abfc9d984 --- /dev/null +++ b/vendor/github.com/apache/thrift/configure.ac @@ -0,0 +1,959 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +AC_PREREQ(2.65) +AC_CONFIG_MACRO_DIR([./aclocal]) + +AC_INIT([thrift], [0.10.0]) + +AC_CONFIG_AUX_DIR([.]) + +AM_INIT_AUTOMAKE([1.13 subdir-objects tar-ustar]) +PKG_PROG_PKG_CONFIG + +AC_ARG_VAR([PY_PREFIX], [Prefix for installing Python modules. + (Normal --prefix is ignored for Python because + Python has different conventions.) + Default = "/usr"]) +AS_IF([test "x$PY_PREFIX" = x], [PY_PREFIX="/usr"]) + +AC_ARG_VAR([JAVA_PREFIX], [Prefix for installing the Java lib jar. + Default = "/usr/local/lib"]) +AS_IF([test "x$JAVA_PREFIX" != x], [JAVA_PREFIX="$JAVA_PREFIX/usr/local/lib"], + [test "x$PREFIX" != x], [JAVA_PREFIX="$PREFIX/usr/local/lib"], + [JAVA_PREFIX="/usr/local/lib"]) + +AC_ARG_VAR([RUBY_PREFIX], [Prefix for installing Ruby modules. + (Normal --prefix is ignored for Ruby because + Ruby has different conventions.) + Default = none, let ruby setup decide]) + +AC_ARG_VAR([PHP_PREFIX], [Prefix for installing PHP modules. + (Normal --prefix is ignored for PHP because + PHP has different conventions.) + Default = "/usr/lib/php"]) +AS_IF([test "x$PHP_PREFIX" = x], [PHP_PREFIX="/usr/lib/php"]) + +AC_ARG_VAR([PHP_CONFIG_PREFIX], + [Prefix for installing PHP extension module .ini file. + (Normal --prefix is ignored for PHP because PHP has + different conventions.) + Default = "/etc/php.d"]) +AS_IF([test "x$PHP_CONFIG_PREFIX" = x], [PHP_CONFIG_PREFIX="/etc/php.d"]) + +AC_ARG_VAR([INSTALLDIRS], [When installing Perl modules, specifies which + of the sets of installation directories + to choose: perl, site or vendor. + Default = "vendor"]) +AS_IF([test "x$INSTALLDIRS" = x], [INSTALLDIRS="vendor"]) + +AC_ARG_VAR([PERL_PREFIX], [Prefix for installing Perl modules. + (Normal --prefix is ignored for Perl because + Perl has different conventions.) + Ignored, when INSTALLDIRS set to site or vendor. + Default = "/usr/local/lib"]) +AS_IF([test "x$PERL_PREFIX" = x], [PERL_PREFIX="/usr/local"]) + +AC_ARG_VAR([CABAL_CONFIGURE_FLAGS], + [Extra flags to pass to cabal: "cabal Setup.lhs configure $CABAL_CONFIGURE_FLAGS". + (Typically used to set --user or force --global.)]) + +AC_SUBST(CABAL_CONFIGURE_FLAGS) + +AC_ARG_VAR([D_IMPORT_PREFIX], [Prefix for installing D modules. + [INCLUDEDIR/d2]]) +AS_IF([test "x$D_IMPORT_PREFIX" = x], [D_IMPORT_PREFIX="${includedir}/d2"]) + +AC_ARG_VAR([DMD_LIBEVENT_FLAGS], [DMD flags for linking libevent (auto-detected if not set).]) +AC_ARG_VAR([DMD_OPENSSL_FLAGS], [DMD flags for linking OpenSSL (auto-detected if not set).]) + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_LIBTOOL +AC_PROG_MAKE_SET +AC_PROG_BISON(2.5) +AC_PROG_YACC +AC_PROG_LEX +AM_PROG_LEX +AC_PROG_LN_S +AC_PROG_MKDIR_P +AC_PROG_AWK +AC_PROG_RANLIB + +AC_LANG([C++]) +AX_CXX_COMPILE_STDCXX_11([noext], [optional]) + +AM_EXTRA_RECURSIVE_TARGETS([style]) +AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;') + +AC_ARG_ENABLE([libs], + AS_HELP_STRING([--enable-libs], [build the Apache Thrift libraries [default=yes]]), + [], enable_libs=yes +) +have_libs=yes +if test "$enable_libs" = "no"; then + have_libs="no" + with_cpp="no" + with_c_glib="no" + with_java="no" + with_csharp="no" + with_python="no" + with_ruby="no" + with_haskell="no" + with_haxe="no" + with_perl="no" + with_php="no" + with_php_extension="no" + with_dart="no" + with_erlang="no" + with_go="no" + with_d="no" + with_nodejs="no" + with_lua="no" +fi + + +AX_THRIFT_LIB(cpp, [C++], yes) +have_cpp=no +if test "$with_cpp" = "yes"; then + AX_BOOST_BASE([1.53.0]) + if test "x$succeeded" = "xyes" ; then + AC_SUBST([BOOST_LIB_DIR], [$(echo "$BOOST_LDFLAGS" | sed -e 's/^\-L//')]) + AC_SUBST([BOOST_CHRONO_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_chrono.a")]) + AC_SUBST([BOOST_FILESYSTEM_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_filesystem.a")]) + AC_SUBST([BOOST_SYSTEM_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_system.a")]) + AC_SUBST([BOOST_TEST_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_unit_test_framework.a")]) + AC_SUBST([BOOST_THREAD_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_thread.a")]) + have_cpp="yes" + fi + + AX_CHECK_OPENSSL() + + AX_LIB_EVENT([1.0]) + have_libevent=$success + + AX_LIB_ZLIB([1.2.3]) + have_zlib=$success + + AX_THRIFT_LIB(qt4, [Qt], yes) + have_qt=no + if test "$with_qt4" = "yes"; then + PKG_CHECK_MODULES([QT], [QtCore >= 4.3, QtNetwork >= 4.3], have_qt=yes, have_qt=no) + fi + if test "$have_qt" = "yes"; then + AC_PATH_PROGS([QT_MOC], [moc-qt4 moc], "fail") + if test "$QT_MOC" = "fail"; then + have_qt=no + fi + fi + + AX_THRIFT_LIB(qt5, [Qt5], yes) + have_qt5=no + qt_reduce_reloc="" + if test "$with_qt5" = "yes"; then + PKG_CHECK_MODULES([QT5], [Qt5Core >= 5.0, Qt5Network >= 5.0], + [have_qt5=yes;qt_reduce_reloc=`$PKG_CONFIG --variable=qt_config Qt5Core | grep "reduce_relocations"`], + [have_qt5=no]) + fi + if test "$have_qt5" = "yes"; then + AC_PATH_PROGS([QT5_MOC], [moc-qt5 moc], "fail") + if test "$QT5_MOC" = "fail"; then + have_qt5=no + fi + fi +fi +AM_CONDITIONAL([WITH_CPP], [test "$have_cpp" = "yes"]) +AM_CONDITIONAL([AMX_HAVE_LIBEVENT], [test "$have_libevent" = "yes"]) +AM_CONDITIONAL([AMX_HAVE_ZLIB], [test "$have_zlib" = "yes"]) +AM_CONDITIONAL([AMX_HAVE_QT], [test "$have_qt" = "yes"]) +AM_CONDITIONAL([AMX_HAVE_QT5], [test "$have_qt5" = "yes"]) +AM_CONDITIONAL([QT5_REDUCE_RELOCATIONS], [test "x$qt_reduce_reloc" != "x"]) + +AX_THRIFT_LIB(c_glib, [C (GLib)], yes) +if test "$with_c_glib" = "yes"; then + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0], have_glib2=yes, have_glib2=no) + PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0], have_gobject2=yes, have_gobject2=no) + if test "$have_glib2" = "yes" -a "$have_gobject2" = "yes" ; then + have_c_glib="yes" + fi +fi +AM_CONDITIONAL(WITH_C_GLIB, [test "$have_glib2" = "yes" -a "$have_gobject2" = "yes"]) + +AX_THRIFT_LIB(csharp, [C#], yes) +if test "$with_csharp" = "yes"; then + PKG_CHECK_MODULES(MONO, mono >= 2.11.0, mono_2_11=yes, mono_2_11=no) + if test "$mono_2_11" == "yes"; then + AC_PATH_PROG([MCS], [mcs]) + if test "x$MCS" != "x"; then + mono_mcs="yes" + fi + fi + PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no) + PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no) + if test "$have_mono" = "yes" ; then + have_csharp="yes" + fi +fi +AM_CONDITIONAL(WITH_MONO, [test "$have_csharp" = "yes"]) +AM_CONDITIONAL(NET_2_0, [test "$net_3_5" = "no"]) +AM_CONDITIONAL(MONO_MCS, [test "$mono_mcs" = "yes"]) + +AX_THRIFT_LIB(java, [Java], yes) +if test "$with_java" = "yes"; then + AX_JAVAC_AND_JAVA + AC_PATH_PROG([ANT], [ant]) + AX_CHECK_ANT_VERSION($ANT, 1.7) + AC_SUBST(CLASSPATH) + AC_SUBST(ANT_FLAGS) + if test "x$JAVA" != "x" && test "x$JAVAC" != "x" && test "x$ANT" != "x" ; then + have_java="yes" + fi +fi +AM_CONDITIONAL([WITH_JAVA], [test "$have_java" = "yes"]) + +AX_THRIFT_LIB(erlang, [Erlang], yes) +if test "$with_erlang" = "yes"; then + AC_ERLANG_PATH_ERL + AC_ERLANG_PATH_ERLC + AC_PATH_PROG([REBAR], [rebar]) + if test -n "$ERLC" ; then + AC_ERLANG_SUBST_LIB_DIR + # Install into the detected Erlang directory instead of $libdir/erlang/lib + ERLANG_INSTALL_LIB_DIR="$ERLANG_LIB_DIR" + AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) + fi + if test -n "$ERL" -a -n "$ERLC" && test "x$REBAR" != "x" ; then + have_erlang="yes" + + # otp_release is simply a number (like "17") for OTP17+ while "R16..." for OTP16 or less. + # OTP version is currently only used for running tests. + if $ERL -eval 'erlang:display(erlang:system_info(otp_release)),halt().' -noshell | grep "^\"R" >/dev/null; then + erlang_otp16_or_less="yes" + fi + fi +fi +AM_CONDITIONAL(WITH_ERLANG, [test "$have_erlang" = "yes"]) +AM_CONDITIONAL(ERLANG_OTP16, [test "$erlang_otp16_or_less" = "yes"]) + +AX_THRIFT_LIB(nodejs, [Nodejs], yes) +have_nodejs=no +if test "$with_nodejs" = "yes"; then + AC_PATH_PROGS([NODEJS], [nodejs node]) + AC_PATH_PROG([NPM], [npm]) + if test "x$NODEJS" != "x" -a "x$NPM" != "x"; then + have_nodejs="yes" + fi +fi +AM_CONDITIONAL(WITH_NODEJS, [test "$have_nodejs" = "yes"]) +AM_CONDITIONAL(HAVE_NPM, [test "x$NPM" != "x"]) + +AX_THRIFT_LIB(lua, [Lua], yes) +have_lua=no +if test "$with_lua" = "yes"; then + AX_PROG_LUA(5.2,, have_lua="yes", have_lua="no") + if test "$have_lua" = "yes"; then + AX_LUA_HEADERS(, have_lua="no") + AX_LUA_LIBS(, have_lua="no") + fi +fi +AM_CONDITIONAL(WITH_LUA, [test "$have_lua" = "yes"]) + +# Find python regardless of with_python value, because it's needed by make cross +AM_PATH_PYTHON(2.6,, :) +AX_THRIFT_LIB(python, [Python], yes) +if test "$with_python" = "yes"; then + if test -n "$PYTHON"; then + have_python="yes" + fi + AC_PATH_PROG([TRIAL], [trial]) + if test -n "$TRIAL"; then + have_trial="yes" + fi +fi +AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"]) +AM_CONDITIONAL(WITH_TWISTED_TEST, [test "$have_trial" = "yes"]) + +# Find "python3" executable. +# It's distro specific and far from ideal but needed to cross test py2-3 at once. +# TODO: find "python2" if it's 3.x +if python --version 2>&1 | grep -q "Python 2"; then + AC_PATH_PROGS([PYTHON3], [python3 python3.5 python35 python3.4 python34]) + if test -n "$PYTHON3"; then + have_py3="yes" + fi +fi +AM_CONDITIONAL(WITH_PY3, [test "$have_py3" = "yes"]) + +AX_THRIFT_LIB(perl, [Perl], yes) +if test "$with_perl" = "yes"; then + AC_PATH_PROG([PERL], [perl]) + if test -n "$PERL" ; then + AC_PROG_PERL_MODULES([Bit::Vector], success="yes", success="no") + have_perl_bit_vector="$success" + AC_PROG_PERL_MODULES([Class::Accessor], success="yes", success="no") + have_perl_class_accessor="$success" + fi + if test -n "$PERL" -a "$have_perl_bit_vector" = "yes" ; then + if test -n "$PERL" -a "$have_perl_class_accessor" = "yes" ; then + have_perl="yes" + fi + fi +fi +AM_CONDITIONAL(WITH_PERL, [test "$have_perl" = "yes"]) + +AX_THRIFT_LIB(php, [PHP], yes) +if test "$with_php" = "yes"; then + AC_PATH_PROG([PHP], [php]) + if test -n "$PHP" ; then + have_php="yes" + fi +fi +AM_CONDITIONAL(WITH_PHP, [test "$have_php" = "yes"]) + +AX_THRIFT_LIB(php_extension, [PHP_EXTENSION], yes) +if test "$with_php_extension" = "yes"; then + if test -f "lib/php/src/ext/thrift_protocol/configure"; then + AC_PATH_PROG([PHP_CONFIG], [php-config]) + if test -n "$PHP_CONFIG" ; then + AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol]) + have_php_extension="yes" + fi + fi +fi +AM_CONDITIONAL(WITH_PHP_EXTENSION, [test "$have_php_extension" = "yes"]) + +AC_PATH_PROG([PHPUNIT], [phpunit]) +AM_CONDITIONAL(HAVE_PHPUNIT, [test "x$PHPUNIT" != "x"]) + +AX_THRIFT_LIB(dart, [DART], yes) +if test "$with_dart" = "yes"; then + AC_PATH_PROG([DART], [dart]) + AC_PATH_PROG([DARTPUB], [pub]) + if test "x$DART" != "x" -a "x$DARTPUB" != "x"; then + have_dart="yes" + fi +fi +AM_CONDITIONAL(WITH_DART, [test "$have_dart" = "yes"]) + +AX_THRIFT_LIB(ruby, [Ruby], yes) +have_ruby=no +if test "$with_ruby" = "yes"; then + AC_PATH_PROG([RUBY], [ruby]) + AC_PATH_PROG([BUNDLER], [bundle]) + if test "x$RUBY" != "x" -a "x$BUNDLER" != "x"; then + have_ruby="yes" + fi +fi +AM_CONDITIONAL(WITH_RUBY, [test "$have_ruby" = "yes"]) +AM_CONDITIONAL(HAVE_BUNDLER, [test "x$BUNDLER" != "x"]) + +AX_THRIFT_LIB(haskell, [Haskell], yes) +have_haskell=no +RUNHASKELL=true +CABAL=true +if test "$with_haskell" = "yes"; then + AC_PATH_PROG([CABAL], [cabal]) + AC_PATH_PROG([RUNHASKELL], [runhaskell]) + if test "x$CABAL" != "x" -a "x$RUNHASKELL" != "x"; then + have_haskell="yes" + else + RUNHASKELL=true + CABAL=true + fi +fi +AC_SUBST(CABAL) +AC_SUBST(RUNHASKELL) +AM_CONDITIONAL(WITH_HASKELL, [test "$have_haskell" = "yes"]) + +AX_THRIFT_LIB(go, [Go], yes) +if test "$with_go" = "yes"; then + AC_PATH_PROG([GO], [go]) + if [[ -x "$GO" ]] ; then + AS_IF([test -n "$GO"],[ + ax_go_version="1.4" + + AC_MSG_CHECKING([for Go version]) + golang_version=`$GO version 2>&1 | $SED -e 's/\(go \)\(version \)\(go\)\(@<:@0-9@:>@.@<:@0-9@:>@.@<:@0-9@:>@\)\(@<:@\*@:>@*\).*/\4/'` + AC_MSG_RESULT($golang_version) + AC_SUBST([golang_version],[$golang_version]) + AX_COMPARE_VERSION([$ax_go_version],[le],[$golang_version],[ + : + have_go="yes" + ],[ + : + have_go="no" + ]) + ],[ + AC_MSG_WARN([could not find Go ]) + have_go="no" + ]) + fi +fi +AM_CONDITIONAL(WITH_GO, [test "$have_go" = "yes"]) + + +AX_THRIFT_LIB(haxe, [Haxe], yes) +if test "$with_haxe" = "yes"; then + AC_PATH_PROG([HAXE], [haxe]) + if [[ -x "$HAXE" ]] ; then + AX_PROG_HAXE_VERSION( [3.1.3], have_haxe="yes", have_haxe="no") + fi +fi +AM_CONDITIONAL(WITH_HAXE, [test "$have_haxe" = "yes"]) + + +AX_THRIFT_LIB(d, [D], yes) +if test "$with_d" = "yes"; then + AX_DMD + AC_SUBST(DMD) + if test "x$DMD" != "x"; then + have_d="yes" + fi +fi + +# Determine actual name of the generated D library for use in the command line +# when compiling tests. This is needed because the -l syntax doesn't work +# with OPTLINK (Windows). +lib_prefix=lib +lib_suffix=a +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + lib_prefix="" + lib_suffix=lib + ;; +esac +D_LIB_NAME="${lib_prefix}thriftd.${lib_suffix}" +AC_SUBST(D_LIB_NAME) +D_EVENT_LIB_NAME="${lib_prefix}thriftd-event.${lib_suffix}" +AC_SUBST(D_EVENT_LIB_NAME) +D_SSL_LIB_NAME="${lib_prefix}thriftd-ssl.${lib_suffix}" +AC_SUBST(D_SSL_LIB_NAME) + +if test "$have_d" = "yes"; then + AX_CHECK_D_MODULE(deimos.event2.event) + have_deimos_event2=$success + + with_d_event_tests="no" + if test "$have_deimos_event2" = "yes"; then + if test "x$DMD_LIBEVENT_FLAGS" = "x"; then + if test "$dmd_optlink" = "yes"; then + AC_MSG_WARN([D libevent interface found, but cannot auto-detect \ +linker flags for OPTLINK. Please set DMD_LIBEVENT_FLAGS manually.]) + else + AX_LIB_EVENT([2.0]) + if test "$success" = "yes"; then + DMD_LIBEVENT_FLAGS=$(echo "$LIBEVENT_LDFLAGS $LIBEVENT_LIBS" | \ + sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g') + with_d_event_tests="yes" + else + AC_MSG_WARN([D libevent interface present, but libevent library not found.]) + fi + fi + else + with_d_event_tests="yes" + fi + fi + + AX_CHECK_D_MODULE(deimos.openssl.ssl) + have_deimos_openssl=$success + + with_d_ssl_tests="no" + if test "$have_deimos_openssl" = "yes"; then + if test "x$DMD_OPENSSL_FLAGS" = "x"; then + if test "$dmd_optlink" = "yes"; then + AC_MSG_WARN([D OpenSSL interface found, but cannot auto-detect \ +linker flags for OPTLINK. Please set DMD_OPENSSL_FLAGS manually.]) + else + AX_CHECK_OPENSSL([with_d_ssl_tests="yes"]) + if test "$with_d_ssl_tests" = "yes"; then + DMD_OPENSSL_FLAGS=$(echo "$OPENSSL_LDFLAGS $OPENSSL_LIBS" | \ + sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g') + else + AC_MSG_WARN([D OpenSSL interface present, but OpenSSL library not found.]) + fi + fi + else + with_d_ssl_tests="yes" + fi + fi +fi + +AM_CONDITIONAL(WITH_D, [test "$have_d" = "yes"]) +AM_CONDITIONAL(DMD_OPTLINK, [test "$dmd_optlink" = "yes"]) +AC_SUBST(DMD_OF_DIRSEP, "$dmd_of_dirsep") +AM_CONDITIONAL(HAVE_DEIMOS_EVENT2, [test "$have_deimos_event2" = "yes"]) +AM_CONDITIONAL(WITH_D_EVENT_TESTS, [test "$with_d_event_tests" = "yes"]) +AC_SUBST(DMD_LIBEVENT_FLAGS) +AM_CONDITIONAL(HAVE_DEIMOS_OPENSSL, [test "$have_deimos_openssl" = "yes"]) +AM_CONDITIONAL(WITH_D_SSL_TESTS, [test "$with_d_ssl_tests" = "yes"]) +AC_SUBST(DMD_OPENSSL_FLAGS) + +AC_ARG_ENABLE([tests], + AS_HELP_STRING([--enable-tests], [build tests [default=yes]]), + [], enable_tests=yes +) +have_tests=yes +if test "$enable_tests" = "no"; then + have_tests="no" +fi +AM_CONDITIONAL(WITH_TESTS, [test "$have_tests" = "yes"]) + +AC_ARG_ENABLE([plugin], + AS_HELP_STRING([--enable-plugin], [build compiler plugin support [default=yes]]), + [], enable_plugin=yes +) +have_plugin=yes +if test "$have_cpp" = "no" ; then + have_plugin="no" +fi +if test "$enable_plugin" = "no"; then + have_plugin="no" +fi +if test "$have_plugin" = "yes" ; then + AC_CONFIG_LINKS([compiler/cpp/test/plugin/t_cpp_generator.cc:compiler/cpp/src/thrift/generate/t_cpp_generator.cc]) +fi +AM_CONDITIONAL(WITH_PLUGIN, [test "$have_plugin" = "yes"]) + +AC_ARG_ENABLE([tutorial], + AS_HELP_STRING([--enable-tutorial], [build tutorial [default=yes]]), + [], enable_tutorial=yes +) +have_tutorial=yes +if test "$enable_tutorial" = "no"; then + have_tutorial="no" +fi +AM_CONDITIONAL(WITH_TUTORIAL, [test "$have_tutorial" = "yes"]) + +AM_CONDITIONAL(MINGW, false) +case "${host_os}" in +*mingw*) + mingw32_support="yes" + AC_CHECK_HEADER(windows.h) + AM_CONDITIONAL(MINGW, true) + ;; +*) + AC_ISC_POSIX + ;; +esac + +AC_C_CONST +AC_C_INLINE +AC_C_VOLATILE + +AC_HEADER_STDBOOL +AC_HEADER_STDC +AC_HEADER_TIME +AC_HEADER_SYS_WAIT +AC_TYPE_SIGNAL +AC_CHECK_HEADERS([arpa/inet.h]) +AC_CHECK_HEADERS([sys/param.h]) +AC_CHECK_HEADERS([fcntl.h]) +AC_CHECK_HEADERS([inttypes.h]) +AC_CHECK_HEADERS([limits.h]) +AC_CHECK_HEADERS([netdb.h]) +AC_CHECK_HEADERS([netinet/in.h]) +AC_CHECK_HEADERS([pthread.h]) +AC_CHECK_HEADERS([stddef.h]) +AC_CHECK_HEADERS([stdlib.h]) +AC_CHECK_HEADERS([sys/socket.h]) +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_HEADERS([sys/un.h]) +AC_CHECK_HEADERS([sys/poll.h]) +AC_CHECK_HEADERS([sys/resource.h]) +AC_CHECK_HEADERS([unistd.h]) +AC_CHECK_HEADERS([libintl.h]) +AC_CHECK_HEADERS([malloc.h]) +AC_CHECK_HEADERS([openssl/ssl.h]) +AC_CHECK_HEADERS([openssl/rand.h]) +AC_CHECK_HEADERS([openssl/x509v3.h]) +AC_CHECK_HEADERS([sched.h]) +AC_CHECK_HEADERS([wchar.h]) + +AC_CHECK_LIB(pthread, pthread_create) +dnl NOTE(dreiss): I haven't been able to find any really solid docs +dnl on what librt is and how it fits into various Unix systems. +dnl My best guess is that it is where glibc stashes its implementation +dnl of the POSIX Real-Time Extensions. This seems necessary on Linux, +dnl and we haven't yet found a system where this is a problem. +AC_CHECK_LIB(rt, clock_gettime) +AC_CHECK_LIB(socket, setsockopt) + +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_CHECK_TYPES([ptrdiff_t], [], [exit 1]) + +AC_STRUCT_TM + +dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD. +AC_CHECK_DECL([AI_ADDRCONFIG], [], + [AC_DEFINE([AI_ADDRCONFIG], 0, + [Define if the AI_ADDRCONFIG symbol is unavailable])], + [ + #include + #include + #include +]) + +AC_FUNC_ALLOCA +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_STAT +AC_FUNC_STRERROR_R +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([strtoul]) +AC_CHECK_FUNCS([bzero]) +AC_CHECK_FUNCS([ftruncate]) +AC_CHECK_FUNCS([gethostbyname]) +AC_CHECK_FUNCS([gethostbyname_r]) +AC_CHECK_FUNCS([gettimeofday]) +AC_CHECK_FUNCS([memmove]) +AC_CHECK_FUNCS([memset]) +AC_CHECK_FUNCS([mkdir]) +AC_CHECK_FUNCS([realpath]) +AC_CHECK_FUNCS([select]) +AC_CHECK_FUNCS([setlocale]) +AC_CHECK_FUNCS([socket]) +AC_CHECK_FUNCS([strchr]) +AC_CHECK_FUNCS([strdup]) +AC_CHECK_FUNCS([strerror]) +AC_CHECK_FUNCS([strstr]) +AC_CHECK_FUNCS([strtol]) +AC_CHECK_FUNCS([sqrt]) +dnl The following functions are optional. +AC_CHECK_FUNCS([alarm]) +AC_CHECK_FUNCS([clock_gettime]) +AC_CHECK_FUNCS([sched_get_priority_min]) +AC_CHECK_FUNCS([sched_get_priority_max]) +AC_CHECK_FUNCS([inet_ntoa]) +AC_CHECK_FUNCS([pow]) + +if test "$cross_compiling" = "no" ; then + AX_SIGNED_RIGHT_SHIFT +fi + +dnl autoscan thinks we need this macro because we have a member function +dnl called "error". Invoke the macro but don't run the check so autoscan +dnl thinks we are in the clear. It's highly unlikely that we will ever +dnl actually use the function that this checks for. +if false ; then + AC_FUNC_ERROR_AT_LINE +fi + +# --- Coverage hooks --- + +AC_ARG_ENABLE(coverage, + [ --enable-coverage turn on -fprofile-arcs -ftest-coverage], + [case "${enableval}" in + yes) ENABLE_COVERAGE=1 ;; + no) ENABLE_COVERAGE=0 ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;; + esac], + [ENABLE_COVERAGE=2]) + +if test "x[$]ENABLE_COVERAGE" = "x1"; then + AC_MSG_WARN(enable coverage) + GCOV_CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage" + GCOV_CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage" + GCOV_LDFLAGS="-XCClinker -fprofile-arcs -XCClinker -ftest-coverage" +fi + +AC_SUBST(ENABLE_COVERAGE) +AC_SUBST(GCOV_CFLAGS) +AC_SUBST(GCOV_CXXFLAGS) +AC_SUBST(GCOV_LDFLAGS) + +AC_ARG_ENABLE(boostthreads, + [ --enable-boostthreads use boost threads, instead of POSIX pthread (experimental) ], + [case "${enableval}" in + yes) ENABLE_BOOSTTHREADS=1 ;; + no) ENABLE_BOOSTTHREADS=0 ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;; + esac], + [ENABLE_BOOSTTHREADS=2]) + + +if test "x[$]ENABLE_BOOSTTHREADS" = "x1"; then + AC_MSG_WARN(enable boostthreads) + AC_DEFINE([USE_BOOST_THREAD], [1], [experimental --enable-boostthreads that replaces POSIX pthread by boost::thread]) + LIBS="-lboost_thread $LIBS" +fi + +AM_CONDITIONAL([WITH_BOOSTTHREADS], [test "x[$]ENABLE_BOOSTTHREADS" = "x1"]) + +AC_CONFIG_HEADERS(config.h:config.hin) +AC_CONFIG_HEADERS(lib/cpp/src/thrift/config.h:config.hin) +AC_CONFIG_HEADERS(lib/c_glib/src/thrift/config.h:config.hin) +# gruard against pre defined config.h +AH_TOP([ +#ifndef CONFIG_H +#define CONFIG_H +]) +AH_BOTTOM([ +#endif +]) + + +AC_CONFIG_FILES([ + Makefile + compiler/cpp/Makefile + compiler/cpp/src/Makefile + compiler/cpp/src/thrift/plugin/Makefile + compiler/cpp/test/Makefile + compiler/cpp/src/thrift/version.h + lib/Makefile + lib/cpp/Makefile + lib/cpp/test/Makefile + lib/cpp/thrift-nb.pc + lib/cpp/thrift-z.pc + lib/cpp/thrift-qt.pc + lib/cpp/thrift-qt5.pc + lib/cpp/thrift.pc + lib/c_glib/Makefile + lib/c_glib/thrift_c_glib.pc + lib/c_glib/test/Makefile + lib/csharp/Makefile + lib/csharp/test/Multiplex/Makefile + lib/d/Makefile + lib/d/test/Makefile + lib/erl/Makefile + lib/go/Makefile + lib/go/test/Makefile + lib/haxe/test/Makefile + lib/hs/Makefile + lib/java/Makefile + lib/js/Makefile + lib/js/test/Makefile + lib/json/Makefile + lib/json/test/Makefile + lib/nodejs/Makefile + lib/perl/Makefile + lib/perl/test/Makefile + lib/php/Makefile + lib/php/test/Makefile + lib/dart/Makefile + lib/py/Makefile + lib/rb/Makefile + lib/lua/Makefile + lib/xml/Makefile + lib/xml/test/Makefile + test/Makefile + test/features/Makefile + test/c_glib/Makefile + test/cpp/Makefile + test/csharp/Makefile + test/erl/Makefile + test/go/Makefile + test/haxe/Makefile + test/hs/Makefile + test/lua/Makefile + test/php/Makefile + test/dart/Makefile + test/perl/Makefile + test/py/Makefile + test/py.twisted/Makefile + test/py.tornado/Makefile + test/rb/Makefile + tutorial/Makefile + tutorial/c_glib/Makefile + tutorial/cpp/Makefile + tutorial/d/Makefile + tutorial/go/Makefile + tutorial/haxe/Makefile + tutorial/hs/Makefile + tutorial/java/Makefile + tutorial/js/Makefile + tutorial/nodejs/Makefile + tutorial/dart/Makefile + tutorial/py/Makefile + tutorial/py.twisted/Makefile + tutorial/py.tornado/Makefile + tutorial/rb/Makefile +]) + +if test "$have_cpp" = "yes" ; then MAYBE_CPP="cpp" ; else MAYBE_CPP="" ; fi +AC_SUBST([MAYBE_CPP]) +if test "$have_c_glib" = "yes" ; then MAYBE_C_GLIB="c_glib" ; else MAYBE_C_GLIB="" ; fi +AC_SUBST([MAYBE_C_GLIB]) +if test "$have_d" = "yes" -a "$have_deimos_event2" = "yes" -a "$have_deimos_openssl" = "yes"; then MAYBE_D="d" ; else MAYBE_D="" ; fi +AC_SUBST([MAYBE_D]) +if test "$have_java" = "yes" ; then MAYBE_JAVA="java" ; else MAYBE_JAVA="" ; fi +AC_SUBST([MAYBE_JAVA]) +if test "$have_csharp" = "yes" ; then MAYBE_CSHARP="csharp" ; else MAYBE_CSHARP="" ; fi +AC_SUBST([MAYBE_CSHARP]) +if test "$have_python" = "yes" ; then MAYBE_PYTHON="py" ; else MAYBE_PYTHON="" ; fi +AC_SUBST([MAYBE_PYTHON]) +if test "$have_py3" = "yes" ; then MAYBE_PY3="py3" ; else MAYBE_PY3="" ; fi +AC_SUBST([MAYBE_PY3]) +if test "$have_ruby" = "yes" ; then MAYBE_RUBY="rb" ; else MAYBE_RUBY="" ; fi +AC_SUBST([MAYBE_RUBY]) +if test "$have_haskell" = "yes" ; then MAYBE_HASKELL="hs" ; else MAYBE_HASKELL="" ; fi +AC_SUBST([MAYBE_HASKELL]) +if test "$have_perl" = "yes" ; then MAYBE_PERL="perl" ; else MAYBE_PERL="" ; fi +AC_SUBST([MAYBE_PERL]) +if test "$have_php" = "yes" ; then MAYBE_PHP="php" ; else MAYBE_PHP="" ; fi +AC_SUBST([MAYBE_PHP]) +if test "$have_dart" = "yes" ; then MAYBE_DART="dart" ; else MAYBE_DART="" ; fi +AC_SUBST([MAYBE_DART]) +if test "$have_go" = "yes" ; then MAYBE_GO="go" ; else MAYBE_GO="" ; fi +AC_SUBST([MAYBE_GO]) +if test "$have_nodejs" = "yes" ; then MAYBE_NODEJS="nodejs" ; else MAYBE_NODEJS="" ; fi +AC_SUBST([MAYBE_NODEJS]) +if test "$have_erlang" = "yes" ; then MAYBE_ERLANG="erl" ; else MAYBE_ERLANG="" ; fi +AC_SUBST([MAYBE_ERLANG]) +if test "$have_lua" = "yes" ; then MAYBE_LUA="lua" ; else MAYBE_LUA="" ; fi +AC_SUBST([MAYBE_LUA]) + +AC_OUTPUT + + +echo +echo "$PACKAGE $VERSION" +echo +echo "Building Plugin Support ...... : $have_plugin" +echo "Building C++ Library ......... : $have_cpp" +echo "Building C (GLib) Library .... : $have_c_glib" +echo "Building Java Library ........ : $have_java" +echo "Building C# Library .......... : $have_csharp" +echo "Building Python Library ...... : $have_python" +echo "Building Ruby Library ........ : $have_ruby" +echo "Building Haxe Library ........ : $have_haxe" +echo "Building Haskell Library ..... : $have_haskell" +echo "Building Perl Library ........ : $have_perl" +echo "Building PHP Library ......... : $have_php" +echo "Building Dart Library ........ : $have_dart" +echo "Building Erlang Library ...... : $have_erlang" +echo "Building Go Library .......... : $have_go" +echo "Building D Library ........... : $have_d" +echo "Building NodeJS Library ...... : $have_nodejs" +echo "Building Lua Library ......... : $have_lua" + +if test "$have_cpp" = "yes" ; then + echo + echo "C++ Library:" + echo " Build TZlibTransport ...... : $have_zlib" + echo " Build TNonblockingServer .. : $have_libevent" + echo " Build TQTcpServer (Qt4) .... : $have_qt" + echo " Build TQTcpServer (Qt5) .... : $have_qt5" +fi +if test "$have_java" = "yes" ; then + echo + echo "Java Library:" + echo " Using javac ............... : $JAVAC" + echo " Using java ................ : $JAVA" + echo " Using ant ................. : $ANT" +fi +if test "$have_csharp" = "yes" ; then + echo + echo "C# Library:" + echo " Using .NET 3.5 ............ : $net_3_5" +fi +if test "$have_python" = "yes" ; then + echo + echo "Python Library:" + echo " Using Python .............. : $PYTHON" + if test "$have_py3" = "yes" ; then + echo " Using Python3 ............. : $PYTHON3" + fi + if test "$have_trial" = "yes"; then + echo " Using trial ............... : $TRIAL" + fi +fi +if test "$have_php" = "yes" ; then + echo + echo "PHP Library:" + echo " Using php-config .......... : $PHP_CONFIG" +fi +if test "$have_dart" = "yes" ; then + echo + echo "Dart Library:" + echo " Using Dart ................ : $DART" + echo " Using Pub ................. : $DARTPUB" +fi +if test "$have_ruby" = "yes" ; then + echo + echo "Ruby Library:" + echo " Using Ruby ................ : $RUBY" +fi +if test "$have_haskell" = "yes" ; then + echo + echo "Haskell Library:" + echo " Using Haskell ............. : $RUNHASKELL" + echo " Using Cabal ............... : $CABAL" +fi +if test "$have_haxe" = "yes" ; then + echo + echo "Haxe Library:" + echo " Using Haxe ................ : $HAXE" + echo " Using Haxe version ........ : $HAXE_VERSION" +fi +if test "$have_perl" = "yes" ; then + echo + echo "Perl Library:" + echo " Using Perl ................ : $PERL" +fi +if test "$have_erlang" = "yes" ; then + echo + echo "Erlang Library:" + echo " Using erlc ................ : $ERLC" + echo " Using rebar ............... : $REBAR" +fi +if test "$have_go" = "yes" ; then + echo + echo "Go Library:" + echo " Using Go................... : $GO" + echo " Using Go version........... : $($GO version)" +fi +if test "$have_d" = "yes" ; then + echo + echo "D Library:" + echo " Using D Compiler .......... : $DMD" + echo " Building D libevent tests . : $with_d_event_tests" + echo " Building D SSL tests ...... : $with_d_ssl_tests" +fi +if test "$have_nodejs" = "yes" ; then + echo + echo "NodeJS Library:" + echo " Using NodeJS .............. : $NODEJS" + echo " Using NodeJS version....... : $($NODEJS --version)" +fi +if test "$have_lua" = "yes" ; then + echo + echo "Lua Library:" + echo " Using Lua .............. : $LUA" +fi +echo +echo "If something is missing that you think should be present," +echo "please skim the output of configure to find the missing" +echo "component. Details are present in config.log." diff --git a/vendor/github.com/apache/thrift/contrib/fb303/LICENSE b/vendor/github.com/apache/thrift/contrib/fb303/LICENSE deleted file mode 100644 index 4eacb64317973..0000000000000 --- a/vendor/github.com/apache/thrift/contrib/fb303/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. diff --git a/vendor/github.com/apache/thrift/doap.rdf b/vendor/github.com/apache/thrift/doap.rdf new file mode 100644 index 0000000000000..14a8d6638d562 --- /dev/null +++ b/vendor/github.com/apache/thrift/doap.rdf @@ -0,0 +1,132 @@ + + + + + + 2012-04-14 + + Apache Thrift + + + Apache Thrift software provides a framework for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. + Apache Thrift allows you to define data types and service interfaces in a simple definition file. Taking that file as input, the compiler generates code to be used to easily build RPC clients and servers that communicate seamlessly across programming languages. Instead of writing a load of boilerplate code to serialize and transport your objects and invoke remote methods, you can get right down to business. + + + + ActionScript + C + C# + C++ + Cocoa + D + Delphi + Erlang + Go + Haskell + Java + JavaScript + node.js + OCaml + Perl + PHP + Python + SmallTalk + + + + + + + Apache Thrift + 2015-09-25 + 0.9.3 + + + Apache Thrift + 2014-11-05 + 0.9.2 + + + Apache Thrift + 2013-08-22 + 0.9.1 + + + Apache Thrift + 2012-10-15 + 0.9.0 + + + Apache Thrift + 2011-11-29 + 0.8.0 + + + Apache Thrift + 2011-08-13 + 0.7.0 + + + Apache Thrift + 2011-04-25 + 0.6.1 + + + Apache Thrift + 2011-02-08 + 0.6.0 + + + Apache Thrift (incubating) + 2010-10-07 + 0.5.0 + + + Apache Thrift (incubating) + 2010-08-23 + 0.4.0 + + + Apache Thrift (incubating) + 2010-08-04 + 0.3.0 + + + Apache Thrift (incubating) + 2009-12-11 + 0.2.0 + + + + + + + + + + + Apache Thrift PMC + + + + + diff --git a/vendor/github.com/apache/thrift/lib/Makefile.am b/vendor/github.com/apache/thrift/lib/Makefile.am new file mode 100644 index 0000000000000..5f17fca882d42 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/Makefile.am @@ -0,0 +1,109 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = json xml +PRECROSS_TARGET = + +if WITH_CPP +# cpp dir is picked directly by plugin build +if !WITH_PLUGIN +SUBDIRS += cpp +endif +endif + +if WITH_C_GLIB +SUBDIRS += c_glib +endif + +if WITH_MONO +SUBDIRS += csharp +endif + +if WITH_JAVA +SUBDIRS += java +PRECROSS_TARGET += precross-java +# JavaScript unit test depends on java +# so test only if java, ant & co is available +SUBDIRS += js +endif + +if WITH_PYTHON +SUBDIRS += py +endif + +if WITH_ERLANG +SUBDIRS += erl +endif + +if WITH_RUBY +SUBDIRS += rb +endif + +if WITH_HASKELL +SUBDIRS += hs +endif + +if WITH_PERL +SUBDIRS += perl +endif + +if WITH_PHP +SUBDIRS += php +endif + +if WITH_DART +SUBDIRS += dart +endif + +if WITH_GO +SUBDIRS += go +endif + +if WITH_D +SUBDIRS += d +PRECROSS_TARGET += precross-d +endif + +if WITH_NODEJS +SUBDIRS += nodejs +PRECROSS_TARGET += precross-nodejs +endif + +if WITH_LUA +SUBDIRS += lua +endif + +# All of the libs that don't use Automake need to go in here +# so they will end up in our release tarballs. +EXTRA_DIST = \ + as3 \ + cocoa \ + d \ + dart \ + delphi \ + haxe \ + javame \ + js \ + ocaml \ + st \ + ts + +precross-%: + $(MAKE) -C $* precross +precross: $(PRECROSS_TARGET) diff --git a/vendor/github.com/apache/thrift/lib/dart/LICENSE_HEADER b/vendor/github.com/apache/thrift/lib/dart/LICENSE_HEADER deleted file mode 100644 index 4eacb64317973..0000000000000 --- a/vendor/github.com/apache/thrift/lib/dart/LICENSE_HEADER +++ /dev/null @@ -1,16 +0,0 @@ -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. diff --git a/vendor/github.com/apache/thrift/lib/go/Makefile.am b/vendor/github.com/apache/thrift/lib/go/Makefile.am new file mode 100644 index 0000000000000..ff946ea8d0cfd --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/Makefile.am @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = . + +if WITH_TESTS +SUBDIRS += test +endif + +install: + @echo '##############################################################' + @echo '##############################################################' + @echo 'The Go client library should be installed via "go get", please see /lib/go/README.md' + @echo '##############################################################' + @echo '##############################################################' + +check-local: + $(GO) test ./thrift + +all-local: + $(GO) build ./thrift + +EXTRA_DIST = \ + thrift \ + coding_standards.md \ + README.md diff --git a/vendor/github.com/apache/thrift/lib/go/README.md b/vendor/github.com/apache/thrift/lib/go/README.md new file mode 100644 index 0000000000000..7440474c325c1 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/README.md @@ -0,0 +1,81 @@ +Thrift Go Software Library + +License +======= + +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. + + +Using Thrift with Go +==================== + +In following Go conventions, we recommend you use the 'go' tool to install +Thrift for go. + + $ go get git.apache.org/thrift.git/lib/go/thrift/... + +Will retrieve and install the most recent version of the package. + + +A note about optional fields +============================ + +The thrift-to-Go compiler tries to represent thrift IDL structs as Go structs. +We must be able to distinguish between optional fields that are set to their +default value and optional values which are actually unset, so the generated +code represents optional fields via pointers. + +This is generally intuitive and works well much of the time, but Go does not +have a syntax for creating a pointer to a constant in a single expression. That +is, given a struct like + + struct SomeIDLType { + OptionalField *int32 + } + +, the following will not compile: + + x := &SomeIDLType{ + OptionalField: &(3), + } + +(Nor is there any other syntax that's built in to the language) + +As such, we provide some helpers that do just this under lib/go/thrift/. E.g., + + x := &SomeIDLType{ + OptionalField: thrift.Int32Ptr(3), + } + +And so on. The code generator also creates analogous helpers for user-defined +typedefs and enums. + +Adding custom tags to generated Thrift structs +============================================== + +You can add tags to the auto-generated thrift structs using the following format: + + struct foo { + 1: required string Bar (go.tag = "some_tag:\"some_tag_value\"") + } + +which will generate: + + type Foo struct { + Bar string `thrift:"bar,1,required" some_tag:"some_tag_value"` + } diff --git a/vendor/github.com/apache/thrift/lib/go/coding_standards.md b/vendor/github.com/apache/thrift/lib/go/coding_standards.md new file mode 100644 index 0000000000000..fa0390bb57747 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/coding_standards.md @@ -0,0 +1 @@ +Please follow [General Coding Standards](/doc/coding_standards.md) diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go new file mode 100644 index 0000000000000..7010f868f1892 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/application_exception_test.go @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestTApplicationException(t *testing.T) { + exc := NewTApplicationException(UNKNOWN_APPLICATION_EXCEPTION, "") + if exc.Error() != "" { + t.Fatalf("Expected empty string for exception but found '%s'", exc.Error()) + } + if exc.TypeId() != UNKNOWN_APPLICATION_EXCEPTION { + t.Fatalf("Expected type UNKNOWN for exception but found '%s'", exc.TypeId()) + } + exc = NewTApplicationException(WRONG_METHOD_NAME, "junk_method") + if exc.Error() != "junk_method" { + t.Fatalf("Expected 'junk_method' for exception but found '%s'", exc.Error()) + } + if exc.TypeId() != WRONG_METHOD_NAME { + t.Fatalf("Expected type WRONG_METHOD_NAME for exception but found '%s'", exc.TypeId()) + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go new file mode 100644 index 0000000000000..0462cc79deead --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/binary_protocol_test.go @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestReadWriteBinaryProtocol(t *testing.T) { + ReadWriteProtocolTest(t, NewTBinaryProtocolFactoryDefault()) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go new file mode 100644 index 0000000000000..95ec0cbd2c012 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/buffered_transport_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestBufferedTransport(t *testing.T) { + trans := NewTBufferedTransport(NewTMemoryBuffer(), 10240) + TransportTest(t, trans, trans) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go new file mode 100644 index 0000000000000..72812f9cb0d28 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/compact_protocol_test.go @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "bytes" + "testing" +) + +func TestReadWriteCompactProtocol(t *testing.T) { + ReadWriteProtocolTest(t, NewTCompactProtocolFactory()) + transports := []TTransport{ + NewTMemoryBuffer(), + NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 16384))), + NewTFramedTransport(NewTMemoryBuffer()), + } + for _, trans := range transports { + p := NewTCompactProtocol(trans); + ReadWriteBool(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteByte(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI16(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI32(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI64(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteDouble(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteString(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteBinary(t, p, trans); + trans.Close(); + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go new file mode 100644 index 0000000000000..71f5e2c7e79e6 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/exception_test.go @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "errors" + "testing" +) + +func TestPrependError(t *testing.T) { + err := NewTApplicationException(INTERNAL_ERROR, "original error") + err2, ok := PrependError("Prepend: ", err).(TApplicationException) + if !ok { + t.Fatal("Couldn't cast error TApplicationException") + } + if err2.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err2.TypeId() != INTERNAL_ERROR { + t.Fatal("Unexpected type error") + } + + err3 := NewTProtocolExceptionWithType(INVALID_DATA, errors.New("original error")) + err4, ok := PrependError("Prepend: ", err3).(TProtocolException) + if !ok { + t.Fatal("Couldn't cast error TProtocolException") + } + if err4.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err4.TypeId() != INVALID_DATA { + t.Fatal("Unexpected type error") + } + + err5 := NewTTransportException(TIMED_OUT, "original error") + err6, ok := PrependError("Prepend: ", err5).(TTransportException) + if !ok { + t.Fatal("Couldn't cast error TTransportException") + } + if err6.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err6.TypeId() != TIMED_OUT { + t.Fatal("Unexpected type error") + } + + err7 := errors.New("original error") + err8 := PrependError("Prepend: ", err7) + if err8.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go new file mode 100644 index 0000000000000..8f683ef306251 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/framed_transport_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestFramedTransport(t *testing.T) { + trans := NewTFramedTransport(NewTMemoryBuffer()) + TransportTest(t, trans, trans) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go new file mode 100644 index 0000000000000..453680ace87b3 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/http_client_test.go @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "net/http" + "testing" +) + +func TestHttpClient(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportTest(t, trans, trans) +} + +func TestHttpClientHeaders(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) +} + +func TestHttpCustomClient(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + + httpTransport := &customHttpTransport{} + + trans, err := NewTHttpPostClientWithOptions("http://"+addr.String(), THttpClientOptions{ + Client: &http.Client{ + Transport: httpTransport, + }, + }) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) + + if !httpTransport.hit { + t.Fatalf("Custom client was not used") + } +} + +func TestHttpCustomClientPackageScope(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + httpTransport := &customHttpTransport{} + DefaultHttpClient = &http.Client{ + Transport: httpTransport, + } + + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) + + if !httpTransport.hit { + t.Fatalf("Custom client was not used") + } +} + +type customHttpTransport struct { + hit bool +} + +func (c *customHttpTransport) RoundTrip(req *http.Request) (*http.Response, error) { + c.hit = true + return http.DefaultTransport.RoundTrip(req) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go new file mode 100644 index 0000000000000..15a6116427d05 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/iostream_transport_test.go @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "bytes" + "testing" +) + +func TestStreamTransport(t *testing.T) { + trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024))) + TransportTest(t, trans, trans) +} + +func TestStreamTransportOpenClose(t *testing.T) { + trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024))) + if !trans.IsOpen() { + t.Fatal("StreamTransport should be already open") + } + if trans.Open() == nil { + t.Fatal("StreamTransport should return error when open twice") + } + if trans.Close() != nil { + t.Fatal("StreamTransport should not return error when closing open transport") + } + if trans.IsOpen() { + t.Fatal("StreamTransport should not be open after close") + } + if trans.Close() == nil { + t.Fatal("StreamTransport should return error when closing a non open transport") + } + if trans.Open() == nil { + t.Fatal("StreamTransport should not be able to reopen") + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go new file mode 100644 index 0000000000000..7104ce3a02e78 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol_test.go @@ -0,0 +1,649 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "math" + "strconv" + "testing" +) + +func TestWriteJSONProtocolBool(t *testing.T) { + thetype := "boolean" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range BOOL_VALUES { + if e := p.WriteBool(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + expected := "" + if value { + expected = "1" + } else { + expected = "0" + } + if s != expected { + t.Fatalf("Bad value for %s %v: %s expected", thetype, value, s) + } + v := -1 + if err := json.Unmarshal([]byte(s), &v); err != nil || (v != 0) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolBool(t *testing.T) { + thetype := "boolean" + for _, value := range BOOL_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + if value { + trans.Write([]byte{'1'}) // not JSON_TRUE + } else { + trans.Write([]byte{'0'}) // not JSON_FALSE + } + trans.Flush() + s := trans.String() + v, e := p.ReadBool() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + vv := -1 + if err := json.Unmarshal([]byte(s), &vv); err != nil || (vv != 0) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, vv) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolByte(t *testing.T) { + thetype := "byte" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range BYTE_VALUES { + if e := p.WriteByte(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int8(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolByte(t *testing.T) { + thetype := "byte" + for _, value := range BYTE_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadByte() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI16(t *testing.T) { + thetype := "int16" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT16_VALUES { + if e := p.WriteI16(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int16(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI16(t *testing.T) { + thetype := "int16" + for _, value := range INT16_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI16() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI32(t *testing.T) { + thetype := "int32" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT32_VALUES { + if e := p.WriteI32(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int32(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI32(t *testing.T) { + thetype := "int32" + for _, value := range INT32_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI64(t *testing.T) { + thetype := "int64" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT64_VALUES { + if e := p.WriteI64(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI64(t *testing.T) { + thetype := "int64" + for _, value := range INT64_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.FormatInt(value, 10)) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolDouble(t *testing.T) { + thetype := "double" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, -1) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN)) + } + } else { + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolDouble(t *testing.T) { + thetype := "double" + for _, value := range DOUBLE_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + n := NewNumericFromDouble(value) + trans.WriteString(n.String()) + trans.Flush() + s := trans.String() + v, e := p.ReadDouble() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if math.IsInf(value, 1) { + if !math.IsInf(v, 1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsInf(value, -1) { + if !math.IsInf(v, -1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsNaN(value) { + if !math.IsNaN(v) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else { + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolString(t *testing.T) { + thetype := "string" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range STRING_VALUES { + if e := p.WriteString(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s[0] != '"' || s[len(s)-1] != '"' { + t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\"")) + } + v := new(string) + if err := json.Unmarshal([]byte(s), v); err != nil || *v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolString(t *testing.T) { + thetype := "string" + for _, value := range STRING_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(jsonQuote(value)) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + if e := p.WriteBinary(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + expectedString := fmt.Sprint("\"", b64String, "\"") + if s != expectedString { + t.Fatalf("Bad value for %s %v\n wrote: \"%v\"\nexpected: \"%v\"", thetype, value, s, expectedString) + } + v1, err := p.ReadBinary() + if err != nil { + t.Fatalf("Unable to read binary: %s", err.Error()) + } + if len(v1) != len(value) { + t.Fatalf("Invalid value for binary\nexpected: \"%v\"\n read: \"%v\"", value, v1) + } + for k, v := range value { + if v1[k] != v { + t.Fatalf("Invalid value for binary at %v\nexpected: \"%v\"\n read: \"%v\"", k, v, v1[k]) + } + } + trans.Close() +} + +func TestReadJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(jsonQuote(b64String)) + trans.Flush() + s := trans.String() + v, e := p.ReadBinary() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if len(v) != len(value) { + t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v)) + } + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i]) + } + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() +} + +func TestWriteJSONProtocolList(t *testing.T) { + thetype := "list" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteListEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("List must be at least of length two to include metadata") + } + if l[0] != "dbl" { + t.Fatal("Invalid type for list, expected: ", STRING, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteJSONProtocolSet(t *testing.T) { + thetype := "set" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteSetEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("Set must be at least of length two to include metadata") + } + if l[0] != "dbl" { + t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteJSONProtocolMap(t *testing.T) { + thetype := "map" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES)) + for k, value := range DOUBLE_VALUES { + if e := p.WriteI32(int32(k)); e != nil { + t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error()) + } + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteMapEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + if str[0] != '[' || str[len(str)-1] != ']' { + t.Fatalf("Bad value for %s, wrote: %q, in go: %q", thetype, str, DOUBLE_VALUES) + } + expectedKeyType, expectedValueType, expectedSize, err := p.ReadMapBegin() + if err != nil { + t.Fatalf("Error while reading map begin: %s", err.Error()) + } + if expectedKeyType != I32 { + t.Fatal("Expected map key type ", I32, ", but was ", expectedKeyType) + } + if expectedValueType != DOUBLE { + t.Fatal("Expected map value type ", DOUBLE, ", but was ", expectedValueType) + } + if expectedSize != len(DOUBLE_VALUES) { + t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", expectedSize) + } + for k, value := range DOUBLE_VALUES { + ik, err := p.ReadI32() + if err != nil { + t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, ik, string(k), err.Error()) + } + if int(ik) != k { + t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v", thetype, k, ik, k) + } + dv, err := p.ReadDouble() + if err != nil { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, dv, value, err.Error()) + } + s := strconv.FormatFloat(dv, 'g', 10, 64) + if math.IsInf(value, 1) { + if !math.IsInf(dv, 1) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, 0) { + if !math.IsInf(dv, 0) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if !math.IsNaN(dv) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN)) + } + } else { + expected := strconv.FormatFloat(value, 'g', 10, 64) + if s != expected { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + } + err = p.ReadMapEnd() + if err != nil { + t.Fatalf("Error while reading map end: %s", err.Error()) + } + trans.Close() +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go new file mode 100644 index 0000000000000..a5094ae97ce2c --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/lowlevel_benchmarks_test.go @@ -0,0 +1,396 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "bytes" + "testing" +) + +var binaryProtoF = NewTBinaryProtocolFactoryDefault() +var compactProtoF = NewTCompactProtocolFactory() + +var buf = bytes.NewBuffer(make([]byte, 0, 1024)) + +var tfv = []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), +} + +func BenchmarkBinaryBool_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkBinaryBool_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkBinaryBool_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go new file mode 100644 index 0000000000000..af2e8bfe52224 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/memory_buffer_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestMemoryBuffer(t *testing.T) { + trans := NewTMemoryBufferLen(1024) + TransportTest(t, trans, trans) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go new file mode 100644 index 0000000000000..613eae6bc8846 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/protocol_test.go @@ -0,0 +1,479 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "bytes" + "io/ioutil" + "math" + "net" + "net/http" + "testing" +) + +const PROTOCOL_BINARY_DATA_SIZE = 155 + +var ( + data string // test data for writing + protocol_bdata []byte // test data for writing; same as data + BOOL_VALUES []bool + BYTE_VALUES []int8 + INT16_VALUES []int16 + INT32_VALUES []int32 + INT64_VALUES []int64 + DOUBLE_VALUES []float64 + STRING_VALUES []string +) + +func init() { + protocol_bdata = make([]byte, PROTOCOL_BINARY_DATA_SIZE) + for i := 0; i < PROTOCOL_BINARY_DATA_SIZE; i++ { + protocol_bdata[i] = byte((i + 'a') % 255) + } + data = string(protocol_bdata) + BOOL_VALUES = []bool{false, true, false, false, true} + BYTE_VALUES = []int8{117, 0, 1, 32, 127, -128, -1} + INT16_VALUES = []int16{459, 0, 1, -1, -128, 127, 32767, -32768} + INT32_VALUES = []int32{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535} + INT64_VALUES = []int64{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535, 34359738481, -35184372088719, -9223372036854775808, 9223372036854775807} + DOUBLE_VALUES = []float64{459.3, 0.0, -1.0, 1.0, 0.5, 0.3333, 3.14159, 1.537e-38, 1.673e25, 6.02214179e23, -6.02214179e23, INFINITY.Float64(), NEGATIVE_INFINITY.Float64(), NAN.Float64()} + STRING_VALUES = []string{"", "a", "st[uf]f", "st,u:ff with spaces", "stuff\twith\nescape\\characters'...\"lots{of}fun"} +} + +type HTTPEchoServer struct{} +type HTTPHeaderEchoServer struct{} + +func (p *HTTPEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + w.Write(buf) + } else { + w.WriteHeader(http.StatusOK) + w.Write(buf) + } +} + +func (p *HTTPHeaderEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + w.Write(buf) + } else { + w.WriteHeader(http.StatusOK) + w.Write(buf) + } +} + +func HttpClientSetupForTest(t *testing.T) (net.Listener, net.Addr) { + addr, err := FindAvailableTCPServerPort(40000) + if err != nil { + t.Fatalf("Unable to find available tcp port addr: %s", err) + return nil, addr + } + l, err := net.Listen(addr.Network(), addr.String()) + if err != nil { + t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err) + return l, addr + } + go http.Serve(l, &HTTPEchoServer{}) + return l, addr +} + +func HttpClientSetupForHeaderTest(t *testing.T) (net.Listener, net.Addr) { + addr, err := FindAvailableTCPServerPort(40000) + if err != nil { + t.Fatalf("Unable to find available tcp port addr: %s", err) + return nil, addr + } + l, err := net.Listen(addr.Network(), addr.String()) + if err != nil { + t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err) + return l, addr + } + go http.Serve(l, &HTTPHeaderEchoServer{}) + return l, addr +} + +func ReadWriteProtocolTest(t *testing.T, protocolFactory TProtocolFactory) { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + l, addr := HttpClientSetupForTest(t) + defer l.Close() + transports := []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), + NewTHttpPostClientTransportFactory("http://" + addr.String()), + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteBool(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteByte(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI16(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI32(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI64(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteDouble(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteString(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteBinary(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI64(t, p, trans) + ReadWriteDouble(t, p, trans) + ReadWriteBinary(t, p, trans) + ReadWriteByte(t, p, trans) + trans.Close() + } +} + +func ReadWriteBool(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(BOOL) + thelen := len(BOOL_VALUES) + err := p.WriteListBegin(thetype, thelen) + if err != nil { + t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteBool", p, trans, err, thetype) + } + for k, v := range BOOL_VALUES { + err = p.WriteBool(v) + if err != nil { + t.Errorf("%s: %T %T %q Error writing bool in list at index %d: %q", "ReadWriteBool", p, trans, err, k, v) + } + } + p.WriteListEnd() + if err != nil { + t.Errorf("%s: %T %T %q Error writing list end: %q", "ReadWriteBool", p, trans, err, BOOL_VALUES) + } + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteBool", p, trans, err, BOOL_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteBool", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteBool", p, trans, thelen, thelen2) + } + } + for k, v := range BOOL_VALUES { + value, err := p.ReadBool() + if err != nil { + t.Errorf("%s: %T %T %q Error reading bool at index %d: %q", "ReadWriteBool", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: index %d %q %q %q != %q", "ReadWriteBool", k, p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteBool", p, trans, err) + } +} + +func ReadWriteByte(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(BYTE) + thelen := len(BYTE_VALUES) + err := p.WriteListBegin(thetype, thelen) + if err != nil { + t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteByte", p, trans, err, thetype) + } + for k, v := range BYTE_VALUES { + err = p.WriteByte(v) + if err != nil { + t.Errorf("%s: %T %T %q Error writing byte in list at index %d: %q", "ReadWriteByte", p, trans, err, k, v) + } + } + err = p.WriteListEnd() + if err != nil { + t.Errorf("%s: %T %T %q Error writing list end: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + err = p.Flush() + if err != nil { + t.Errorf("%s: %T %T %q Error flushing list of bytes: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteByte", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteByte", p, trans, thelen, thelen2) + } + } + for k, v := range BYTE_VALUES { + value, err := p.ReadByte() + if err != nil { + t.Errorf("%s: %T %T %q Error reading byte at index %d: %q", "ReadWriteByte", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteByte", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteByte", p, trans, err) + } +} + +func ReadWriteI16(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I16) + thelen := len(INT16_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT16_VALUES { + p.WriteI16(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI16", p, trans, err, INT16_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI16", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI16", p, trans, thelen, thelen2) + } + } + for k, v := range INT16_VALUES { + value, err := p.ReadI16() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int16 at index %d: %q", "ReadWriteI16", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteI16", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI16", p, trans, err) + } +} + +func ReadWriteI32(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I32) + thelen := len(INT32_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT32_VALUES { + p.WriteI32(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI32", p, trans, err, INT32_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI32", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI32", p, trans, thelen, thelen2) + } + } + for k, v := range INT32_VALUES { + value, err := p.ReadI32() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int32 at index %d: %q", "ReadWriteI32", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteI32", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI32", p, trans, err) + } +} + +func ReadWriteI64(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I64) + thelen := len(INT64_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT64_VALUES { + p.WriteI64(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI64", p, trans, err, INT64_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI64", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI64", p, trans, thelen, thelen2) + } + } + for k, v := range INT64_VALUES { + value, err := p.ReadI64() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int64 at index %d: %q", "ReadWriteI64", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %q != %q", "ReadWriteI64", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI64", p, trans, err) + } +} + +func ReadWriteDouble(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(DOUBLE) + thelen := len(DOUBLE_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range DOUBLE_VALUES { + p.WriteDouble(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteDouble", p, trans, err, DOUBLE_VALUES) + } + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteDouble", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteDouble", p, trans, thelen, thelen2) + } + for k, v := range DOUBLE_VALUES { + value, err := p.ReadDouble() + if err != nil { + t.Errorf("%s: %T %T %q Error reading double at index %d: %q", "ReadWriteDouble", p, trans, err, k, v) + } + if math.IsNaN(v) { + if !math.IsNaN(value) { + t.Errorf("%s: %T %T math.IsNaN(%q) != math.IsNaN(%q)", "ReadWriteDouble", p, trans, v, value) + } + } else if v != value { + t.Errorf("%s: %T %T %v != %q", "ReadWriteDouble", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteDouble", p, trans, err) + } +} + +func ReadWriteString(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(STRING) + thelen := len(STRING_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range STRING_VALUES { + p.WriteString(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteString", p, trans, err, STRING_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteString", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteString", p, trans, thelen, thelen2) + } + } + for k, v := range STRING_VALUES { + value, err := p.ReadString() + if err != nil { + t.Errorf("%s: %T %T %q Error reading string at index %d: %q", "ReadWriteString", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteString", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteString", p, trans, err) + } +} + +func ReadWriteBinary(t testing.TB, p TProtocol, trans TTransport) { + v := protocol_bdata + p.WriteBinary(v) + p.Flush() + value, err := p.ReadBinary() + if err != nil { + t.Errorf("%s: %T %T Unable to read binary: %s", "ReadWriteBinary", p, trans, err.Error()) + } + if len(v) != len(value) { + t.Errorf("%s: %T %T len(v) != len(value)... %d != %d", "ReadWriteBinary", p, trans, len(v), len(value)) + } else { + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Errorf("%s: %T %T %s != %s", "ReadWriteBinary", p, trans, v, value) + } + } + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go new file mode 100644 index 0000000000000..41513f812b7f6 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/rich_transport_test.go @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "bytes" + "errors" + "io" + "reflect" + "testing" +) + +func TestEnsureTransportsAreRich(t *testing.T) { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + transports := []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), + NewTHttpPostClientTransportFactory("http://127.0.0.1"), + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + _, ok := trans.(TRichTransport) + if !ok { + t.Errorf("Transport %s does not implement TRichTransport interface", reflect.ValueOf(trans)) + } + } +} + +// TestReadByte tests whether readByte handles error cases correctly. +func TestReadByte(t *testing.T) { + for i, test := range readByteTests { + v, err := readByte(test.r) + if v != test.v { + t.Fatalf("TestReadByte %d: value differs. Expected %d, got %d", i, test.v, test.r.v) + } + if err != test.err { + t.Fatalf("TestReadByte %d: error differs. Expected %s, got %s", i, test.err, test.r.err) + } + } +} + +var someError = errors.New("Some error") +var readByteTests = []struct { + r *mockReader + v byte + err error +}{ + {&mockReader{0, 55, io.EOF}, 0, io.EOF}, // reader sends EOF w/o data + {&mockReader{0, 55, someError}, 0, someError}, // reader sends some other error + {&mockReader{1, 55, nil}, 55, nil}, // reader sends data w/o error + {&mockReader{1, 55, io.EOF}, 55, nil}, // reader sends data with EOF + {&mockReader{1, 55, someError}, 55, someError}, // reader sends data withsome error +} + +type mockReader struct { + n int + v byte + err error +} + +func (r *mockReader) Read(p []byte) (n int, err error) { + if r.n > 0 { + p[0] = r.v + } + return r.n, r.err +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go new file mode 100644 index 0000000000000..06d27a16b7bb6 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_test.go @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "errors" + "fmt" + "testing" +) + +type ProtocolFactory interface { + GetProtocol(t TTransport) TProtocol +} + +func compareStructs(m, m1 MyTestStruct) (bool, error) { + switch { + case m.On != m1.On: + return false, errors.New("Boolean not equal") + case m.B != m1.B: + return false, errors.New("Byte not equal") + case m.Int16 != m1.Int16: + return false, errors.New("Int16 not equal") + case m.Int32 != m1.Int32: + return false, errors.New("Int32 not equal") + case m.Int64 != m1.Int64: + return false, errors.New("Int64 not equal") + case m.D != m1.D: + return false, errors.New("Double not equal") + case m.St != m1.St: + return false, errors.New("String not equal") + + case len(m.Bin) != len(m1.Bin): + return false, errors.New("Binary size not equal") + case len(m.Bin) == len(m1.Bin): + for i := range m.Bin { + if m.Bin[i] != m1.Bin[i] { + return false, errors.New("Binary not equal") + } + } + case len(m.StringMap) != len(m1.StringMap): + return false, errors.New("StringMap size not equal") + case len(m.StringList) != len(m1.StringList): + return false, errors.New("StringList size not equal") + case len(m.StringSet) != len(m1.StringSet): + return false, errors.New("StringSet size not equal") + + case m.E != m1.E: + return false, errors.New("MyTestEnum not equal") + + default: + return true, nil + + } + return true, nil +} + +func ProtocolTest1(test *testing.T, pf ProtocolFactory) (bool, error) { + t := NewTSerializer() + t.Protocol = pf.GetProtocol(t.Transport) + var m = MyTestStruct{} + m.On = true + m.B = int8(0) + m.Int16 = 1 + m.Int32 = 2 + m.Int64 = 3 + m.D = 4.1 + m.St = "Test" + m.Bin = make([]byte, 10) + m.StringMap = make(map[string]string, 5) + m.StringList = make([]string, 5) + m.StringSet = make(map[string]struct{}, 5) + m.E = 2 + + s, err := t.WriteString(&m) + if err != nil { + return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err)) + } + + t1 := NewTDeserializer() + t1.Protocol = pf.GetProtocol(t1.Transport) + var m1 = MyTestStruct{} + if err = t1.ReadString(&m1, s); err != nil { + return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err)) + + } + + return compareStructs(m, m1) + +} + +func ProtocolTest2(test *testing.T, pf ProtocolFactory) (bool, error) { + t := NewTSerializer() + t.Protocol = pf.GetProtocol(t.Transport) + var m = MyTestStruct{} + m.On = false + m.B = int8(0) + m.Int16 = 1 + m.Int32 = 2 + m.Int64 = 3 + m.D = 4.1 + m.St = "Test" + m.Bin = make([]byte, 10) + m.StringMap = make(map[string]string, 5) + m.StringList = make([]string, 5) + m.StringSet = make(map[string]struct{}, 5) + m.E = 2 + + s, err := t.WriteString(&m) + if err != nil { + return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err)) + + } + + t1 := NewTDeserializer() + t1.Protocol = pf.GetProtocol(t1.Transport) + var m1 = MyTestStruct{} + if err = t1.ReadString(&m1, s); err != nil { + return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err)) + + } + + return compareStructs(m, m1) + +} + +func TestSerializer(t *testing.T) { + + var protocol_factories map[string]ProtocolFactory + protocol_factories = make(map[string]ProtocolFactory) + protocol_factories["Binary"] = NewTBinaryProtocolFactoryDefault() + protocol_factories["Compact"] = NewTCompactProtocolFactory() + //protocol_factories["SimpleJSON"] = NewTSimpleJSONProtocolFactory() - write only, can't be read back by design + protocol_factories["JSON"] = NewTJSONProtocolFactory() + + var tests map[string]func(*testing.T, ProtocolFactory) (bool, error) + tests = make(map[string]func(*testing.T, ProtocolFactory) (bool, error)) + tests["Test 1"] = ProtocolTest1 + tests["Test 2"] = ProtocolTest2 + //tests["Test 3"] = ProtocolTest3 // Example of how to add additional tests + + for name, pf := range protocol_factories { + + for test, f := range tests { + + if s, err := f(t, pf); !s || err != nil { + t.Errorf("%s Failed for %s protocol\n\t %s", test, name, err) + } + + } + } + +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go new file mode 100644 index 0000000000000..38ab8d6d60052 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/serializer_types_test.go @@ -0,0 +1,633 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +// Autogenerated by Thrift Compiler (1.0.0-dev) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS + +enum MyTestEnum { + FIRST = 1, + SECOND = 2, + THIRD = 3, + FOURTH = 4, +} + +struct MyTestStruct { + 1: bool on, + 2: byte b, + 3: i16 int16, + 4: i32 int32, + 5: i64 int64, + 6: double d, + 7: string st, + 8: binary bin, + 9: map stringMap, + 10: list stringList, + 11: set stringSet, + 12: MyTestEnum e, +} +*/ + +import ( + "fmt" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = ZERO +var _ = fmt.Printf + +var GoUnusedProtection__ int + +type MyTestEnum int64 + +const ( + MyTestEnum_FIRST MyTestEnum = 1 + MyTestEnum_SECOND MyTestEnum = 2 + MyTestEnum_THIRD MyTestEnum = 3 + MyTestEnum_FOURTH MyTestEnum = 4 +) + +func (p MyTestEnum) String() string { + switch p { + case MyTestEnum_FIRST: + return "FIRST" + case MyTestEnum_SECOND: + return "SECOND" + case MyTestEnum_THIRD: + return "THIRD" + case MyTestEnum_FOURTH: + return "FOURTH" + } + return "" +} + +func MyTestEnumFromString(s string) (MyTestEnum, error) { + switch s { + case "FIRST": + return MyTestEnum_FIRST, nil + case "SECOND": + return MyTestEnum_SECOND, nil + case "THIRD": + return MyTestEnum_THIRD, nil + case "FOURTH": + return MyTestEnum_FOURTH, nil + } + return MyTestEnum(0), fmt.Errorf("not a valid MyTestEnum string") +} + +func MyTestEnumPtr(v MyTestEnum) *MyTestEnum { return &v } + +type MyTestStruct struct { + On bool `thrift:"on,1" json:"on"` + B int8 `thrift:"b,2" json:"b"` + Int16 int16 `thrift:"int16,3" json:"int16"` + Int32 int32 `thrift:"int32,4" json:"int32"` + Int64 int64 `thrift:"int64,5" json:"int64"` + D float64 `thrift:"d,6" json:"d"` + St string `thrift:"st,7" json:"st"` + Bin []byte `thrift:"bin,8" json:"bin"` + StringMap map[string]string `thrift:"stringMap,9" json:"stringMap"` + StringList []string `thrift:"stringList,10" json:"stringList"` + StringSet map[string]struct{} `thrift:"stringSet,11" json:"stringSet"` + E MyTestEnum `thrift:"e,12" json:"e"` +} + +func NewMyTestStruct() *MyTestStruct { + return &MyTestStruct{} +} + +func (p *MyTestStruct) GetOn() bool { + return p.On +} + +func (p *MyTestStruct) GetB() int8 { + return p.B +} + +func (p *MyTestStruct) GetInt16() int16 { + return p.Int16 +} + +func (p *MyTestStruct) GetInt32() int32 { + return p.Int32 +} + +func (p *MyTestStruct) GetInt64() int64 { + return p.Int64 +} + +func (p *MyTestStruct) GetD() float64 { + return p.D +} + +func (p *MyTestStruct) GetSt() string { + return p.St +} + +func (p *MyTestStruct) GetBin() []byte { + return p.Bin +} + +func (p *MyTestStruct) GetStringMap() map[string]string { + return p.StringMap +} + +func (p *MyTestStruct) GetStringList() []string { + return p.StringList +} + +func (p *MyTestStruct) GetStringSet() map[string]struct{} { + return p.StringSet +} + +func (p *MyTestStruct) GetE() MyTestEnum { + return p.E +} +func (p *MyTestStruct) Read(iprot TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return PrependError(fmt.Sprintf("%T read error: ", p), err) + } + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == STOP { + break + } + switch fieldId { + case 1: + if err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 10: + if err := p.readField10(iprot); err != nil { + return err + } + case 11: + if err := p.readField11(iprot); err != nil { + return err + } + case 12: + if err := p.readField12(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *MyTestStruct) readField1(iprot TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return PrependError("error reading field 1: ", err) + } else { + p.On = v + } + return nil +} + +func (p *MyTestStruct) readField2(iprot TProtocol) error { + if v, err := iprot.ReadByte(); err != nil { + return PrependError("error reading field 2: ", err) + } else { + temp := int8(v) + p.B = temp + } + return nil +} + +func (p *MyTestStruct) readField3(iprot TProtocol) error { + if v, err := iprot.ReadI16(); err != nil { + return PrependError("error reading field 3: ", err) + } else { + p.Int16 = v + } + return nil +} + +func (p *MyTestStruct) readField4(iprot TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return PrependError("error reading field 4: ", err) + } else { + p.Int32 = v + } + return nil +} + +func (p *MyTestStruct) readField5(iprot TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return PrependError("error reading field 5: ", err) + } else { + p.Int64 = v + } + return nil +} + +func (p *MyTestStruct) readField6(iprot TProtocol) error { + if v, err := iprot.ReadDouble(); err != nil { + return PrependError("error reading field 6: ", err) + } else { + p.D = v + } + return nil +} + +func (p *MyTestStruct) readField7(iprot TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 7: ", err) + } else { + p.St = v + } + return nil +} + +func (p *MyTestStruct) readField8(iprot TProtocol) error { + if v, err := iprot.ReadBinary(); err != nil { + return PrependError("error reading field 8: ", err) + } else { + p.Bin = v + } + return nil +} + +func (p *MyTestStruct) readField9(iprot TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + p.StringMap = tMap + for i := 0; i < size; i++ { + var _key0 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _key0 = v + } + var _val1 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _val1 = v + } + p.StringMap[_key0] = _val1 + } + if err := iprot.ReadMapEnd(); err != nil { + return PrependError("error reading map end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField10(iprot TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.StringList = tSlice + for i := 0; i < size; i++ { + var _elem2 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _elem2 = v + } + p.StringList = append(p.StringList, _elem2) + } + if err := iprot.ReadListEnd(); err != nil { + return PrependError("error reading list end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField11(iprot TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return PrependError("error reading set begin: ", err) + } + tSet := make(map[string]struct{}, size) + p.StringSet = tSet + for i := 0; i < size; i++ { + var _elem3 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _elem3 = v + } + p.StringSet[_elem3] = struct{}{} + } + if err := iprot.ReadSetEnd(); err != nil { + return PrependError("error reading set end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField12(iprot TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return PrependError("error reading field 12: ", err) + } else { + temp := MyTestEnum(v) + p.E = temp + } + return nil +} + +func (p *MyTestStruct) Write(oprot TProtocol) error { + if err := oprot.WriteStructBegin("MyTestStruct"); err != nil { + return PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := p.writeField4(oprot); err != nil { + return err + } + if err := p.writeField5(oprot); err != nil { + return err + } + if err := p.writeField6(oprot); err != nil { + return err + } + if err := p.writeField7(oprot); err != nil { + return err + } + if err := p.writeField8(oprot); err != nil { + return err + } + if err := p.writeField9(oprot); err != nil { + return err + } + if err := p.writeField10(oprot); err != nil { + return err + } + if err := p.writeField11(oprot); err != nil { + return err + } + if err := p.writeField12(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *MyTestStruct) writeField1(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("on", BOOL, 1); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 1:on: ", p), err) + } + if err := oprot.WriteBool(bool(p.On)); err != nil { + return PrependError(fmt.Sprintf("%T.on (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 1:on: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField2(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("b", BYTE, 2); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err) + } + if err := oprot.WriteByte(int8(p.B)); err != nil { + return PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField3(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int16", I16, 3); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 3:int16: ", p), err) + } + if err := oprot.WriteI16(int16(p.Int16)); err != nil { + return PrependError(fmt.Sprintf("%T.int16 (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 3:int16: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField4(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int32", I32, 4); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 4:int32: ", p), err) + } + if err := oprot.WriteI32(int32(p.Int32)); err != nil { + return PrependError(fmt.Sprintf("%T.int32 (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 4:int32: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField5(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int64", I64, 5); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 5:int64: ", p), err) + } + if err := oprot.WriteI64(int64(p.Int64)); err != nil { + return PrependError(fmt.Sprintf("%T.int64 (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 5:int64: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField6(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("d", DOUBLE, 6); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 6:d: ", p), err) + } + if err := oprot.WriteDouble(float64(p.D)); err != nil { + return PrependError(fmt.Sprintf("%T.d (6) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 6:d: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField7(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("st", STRING, 7); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 7:st: ", p), err) + } + if err := oprot.WriteString(string(p.St)); err != nil { + return PrependError(fmt.Sprintf("%T.st (7) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 7:st: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField8(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("bin", STRING, 8); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 8:bin: ", p), err) + } + if err := oprot.WriteBinary(p.Bin); err != nil { + return PrependError(fmt.Sprintf("%T.bin (8) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 8:bin: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField9(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringMap", MAP, 9); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 9:stringMap: ", p), err) + } + if err := oprot.WriteMapBegin(STRING, STRING, len(p.StringMap)); err != nil { + return PrependError("error writing map begin: ", err) + } + for k, v := range p.StringMap { + if err := oprot.WriteString(string(k)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 9:stringMap: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField10(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringList", LIST, 10); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 10:stringList: ", p), err) + } + if err := oprot.WriteListBegin(STRING, len(p.StringList)); err != nil { + return PrependError("error writing list begin: ", err) + } + for _, v := range p.StringList { + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 10:stringList: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField11(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringSet", SET, 11); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 11:stringSet: ", p), err) + } + if err := oprot.WriteSetBegin(STRING, len(p.StringSet)); err != nil { + return PrependError("error writing set begin: ", err) + } + for v, _ := range p.StringSet { + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 11:stringSet: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField12(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("e", I32, 12); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 12:e: ", p), err) + } + if err := oprot.WriteI32(int32(p.E)); err != nil { + return PrependError(fmt.Sprintf("%T.e (12) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 12:e: ", p), err) + } + return err +} + +func (p *MyTestStruct) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("MyTestStruct(%+v)", *p) +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go new file mode 100644 index 0000000000000..f08e8e900de76 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/server_socket_test.go @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "fmt" + "testing" +) + +func TestSocketIsntListeningAfterInterrupt(t *testing.T) { + host := "127.0.0.1" + port := 9090 + addr := fmt.Sprintf("%s:%d", host, port) + + socket := CreateServerSocket(t, addr) + socket.Listen() + socket.Interrupt() + + newSocket := CreateServerSocket(t, addr) + err := newSocket.Listen() + defer newSocket.Interrupt() + if err != nil { + t.Fatalf("Failed to rebinds: %s", err) + } +} + +func CreateServerSocket(t *testing.T, addr string) *TServerSocket { + socket, err := NewTServerSocket(addr) + if err != nil { + t.Fatalf("Failed to create server socket: %s", err) + } + return socket +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go new file mode 100644 index 0000000000000..ffaf457027d31 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/server_test.go @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "testing" +) + +func TestNothing(t *testing.T) { + +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go new file mode 100644 index 0000000000000..8f0dcc9dfe26d --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/simple_json_protocol_test.go @@ -0,0 +1,715 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "math" + "strconv" + "strings" + "testing" +) + +func TestWriteSimpleJSONProtocolBool(t *testing.T) { + thetype := "boolean" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range BOOL_VALUES { + if e := p.WriteBool(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := false + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolBool(t *testing.T) { + thetype := "boolean" + for _, value := range BOOL_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + if value { + trans.Write(JSON_TRUE) + } else { + trans.Write(JSON_FALSE) + } + trans.Flush() + s := trans.String() + v, e := p.ReadBool() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolByte(t *testing.T) { + thetype := "byte" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range BYTE_VALUES { + if e := p.WriteByte(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int8(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolByte(t *testing.T) { + thetype := "byte" + for _, value := range BYTE_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadByte() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolI16(t *testing.T) { + thetype := "int16" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT16_VALUES { + if e := p.WriteI16(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int16(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI16(t *testing.T) { + thetype := "int16" + for _, value := range INT16_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI16() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolI32(t *testing.T) { + thetype := "int32" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT32_VALUES { + if e := p.WriteI32(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int32(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI32(t *testing.T) { + thetype := "int32" + for _, value := range INT32_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestReadSimpleJSONProtocolI32Null(t *testing.T) { + thetype := "int32" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != 0 { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolI64(t *testing.T) { + thetype := "int64" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT64_VALUES { + if e := p.WriteI64(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI64(t *testing.T) { + thetype := "int64" + for _, value := range INT64_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.FormatInt(value, 10)) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestReadSimpleJSONProtocolI64Null(t *testing.T) { + thetype := "int32" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != 0 { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolDouble(t *testing.T) { + thetype := "double" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, -1) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN)) + } + } else { + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolDouble(t *testing.T) { + thetype := "double" + for _, value := range DOUBLE_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + n := NewNumericFromDouble(value) + trans.WriteString(n.String()) + trans.Flush() + s := trans.String() + v, e := p.ReadDouble() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if math.IsInf(value, 1) { + if !math.IsInf(v, 1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsInf(value, -1) { + if !math.IsInf(v, -1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsNaN(value) { + if !math.IsNaN(v) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else { + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolString(t *testing.T) { + thetype := "string" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range STRING_VALUES { + if e := p.WriteString(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s[0] != '"' || s[len(s)-1] != '"' { + t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\"")) + } + v := new(string) + if err := json.Unmarshal([]byte(s), v); err != nil || *v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolString(t *testing.T) { + thetype := "string" + for _, value := range STRING_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(jsonQuote(value)) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() + } +} +func TestReadSimpleJSONProtocolStringNull(t *testing.T) { + thetype := "string" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != "" { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + if e := p.WriteBinary(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint("\"", b64String, "\"") { + t.Fatalf("Bad value for %s %v\n wrote: %v\nexpected: %v", thetype, value, s, "\""+b64String+"\"") + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Close() +} + +func TestReadSimpleJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(jsonQuote(b64String)) + trans.Flush() + s := trans.String() + v, e := p.ReadBinary() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if len(v) != len(value) { + t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v)) + } + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i]) + } + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() +} + +func TestReadSimpleJSONProtocolBinaryNull(t *testing.T) { + thetype := "binary" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + b, e := p.ReadBinary() + v := string(b) + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != "" { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolList(t *testing.T) { + thetype := "list" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteListEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("List must be at least of length two to include metadata") + } + if int(l[0].(float64)) != DOUBLE { + t.Fatal("Invalid type for list, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteSimpleJSONProtocolSet(t *testing.T) { + thetype := "set" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteSetEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("Set must be at least of length two to include metadata") + } + if int(l[0].(float64)) != DOUBLE { + t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteSimpleJSONProtocolMap(t *testing.T) { + thetype := "map" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES)) + for k, value := range DOUBLE_VALUES { + if e := p.WriteI32(int32(k)); e != nil { + t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error()) + } + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteMapEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + if str[0] != '[' || str[len(str)-1] != ']' { + t.Fatalf("Bad value for %s, wrote: %q, in go: %q", thetype, str, DOUBLE_VALUES) + } + l := strings.Split(str[1:len(str)-1], ",") + if len(l) < 3 { + t.Fatal("Expected list of at least length 3 for map for metadata, but was of length ", len(l)) + } + expectedKeyType, _ := strconv.Atoi(l[0]) + expectedValueType, _ := strconv.Atoi(l[1]) + expectedSize, _ := strconv.Atoi(l[2]) + if expectedKeyType != I32 { + t.Fatal("Expected map key type ", I32, ", but was ", l[0]) + } + if expectedValueType != DOUBLE { + t.Fatal("Expected map value type ", DOUBLE, ", but was ", l[1]) + } + if expectedSize != len(DOUBLE_VALUES) { + t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", l[2]) + } + for k, value := range DOUBLE_VALUES { + strk := l[k*2+3] + strv := l[k*2+4] + ik, err := strconv.Atoi(strk) + if err != nil { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, strk, string(k), err.Error()) + } + if ik != k { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v", thetype, k, strk, k) + } + s := strv + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, 0) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN)) + } + } else { + expected := strconv.FormatFloat(value, 'g', 10, 64) + if s != expected { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go new file mode 100644 index 0000000000000..b44314f490d10 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/transport_exception_test.go @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "fmt" + "io" + + "testing" +) + +type timeout struct{ timedout bool } + +func (t *timeout) Timeout() bool { + return t.timedout +} + +func (t *timeout) Error() string { + return fmt.Sprintf("Timeout: %v", t.timedout) +} + +func TestTExceptionTimeout(t *testing.T) { + timeout := &timeout{true} + exception := NewTTransportExceptionFromError(timeout) + if timeout.Error() != exception.Error() { + t.Fatalf("Error did not match: expected %q, got %q", timeout.Error(), exception.Error()) + } + + if exception.TypeId() != TIMED_OUT { + t.Fatalf("TypeId was not TIMED_OUT: expected %v, got %v", TIMED_OUT, exception.TypeId()) + } +} + +func TestTExceptionEOF(t *testing.T) { + exception := NewTTransportExceptionFromError(io.EOF) + if io.EOF.Error() != exception.Error() { + t.Fatalf("Error did not match: expected %q, got %q", io.EOF.Error(), exception.Error()) + } + + if exception.TypeId() != END_OF_FILE { + t.Fatalf("TypeId was not END_OF_FILE: expected %v, got %v", END_OF_FILE, exception.TypeId()) + } +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go new file mode 100644 index 0000000000000..864958a9da016 --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/transport_test.go @@ -0,0 +1,176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "io" + "net" + "strconv" + "testing" +) + +const TRANSPORT_BINARY_DATA_SIZE = 4096 + +var ( + transport_bdata []byte // test data for writing; same as data + transport_header map[string]string +) + +func init() { + transport_bdata = make([]byte, TRANSPORT_BINARY_DATA_SIZE) + for i := 0; i < TRANSPORT_BINARY_DATA_SIZE; i++ { + transport_bdata[i] = byte((i + 'a') % 255) + } + transport_header = map[string]string{"key": "User-Agent", + "value": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"} +} + +func TransportTest(t *testing.T, writeTrans TTransport, readTrans TTransport) { + buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE) + if !writeTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans) + } + if !readTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", readTrans, readTrans) + } + _, err := writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err) + } + n, err := io.ReadFull(readTrans, buf) + if err != nil { + t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err) + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } + _, err = writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data 2 of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write binary data 2: %s", writeTrans, err) + } + buf = make([]byte, TRANSPORT_BINARY_DATA_SIZE) + read := 1 + for n = 0; n < TRANSPORT_BINARY_DATA_SIZE && read != 0; { + read, err = readTrans.Read(buf[n:]) + if err != nil { + t.Errorf("Transport %T cannot read binary data 2 of total length %d from offset %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, n, err) + } + n += read + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data 2", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } +} + +func TransportHeaderTest(t *testing.T, writeTrans TTransport, readTrans TTransport) { + buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE) + if !writeTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans) + } + if !readTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", readTrans, readTrans) + } + // Need to assert type of TTransport to THttpClient to expose the Setter + httpWPostTrans := writeTrans.(*THttpClient) + httpWPostTrans.SetHeader(transport_header["key"], transport_header["value"]) + + _, err := writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err) + } + // Need to assert type of TTransport to THttpClient to expose the Getter + httpRPostTrans := readTrans.(*THttpClient) + readHeader := httpRPostTrans.GetHeader(transport_header["key"]) + if err != nil { + t.Errorf("Transport %T cannot read HTTP Header Value", httpRPostTrans) + } + + if transport_header["value"] != readHeader { + t.Errorf("Expected HTTP Header Value %s, got %s", transport_header["value"], readHeader) + } + n, err := io.ReadFull(readTrans, buf) + if err != nil { + t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err) + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } +} + +func CloseTransports(t *testing.T, readTrans TTransport, writeTrans TTransport) { + err := readTrans.Close() + if err != nil { + t.Errorf("Transport %T cannot close read transport: %s", readTrans, err) + } + if writeTrans != readTrans { + err = writeTrans.Close() + if err != nil { + t.Errorf("Transport %T cannot close write transport: %s", writeTrans, err) + } + } +} + +func FindAvailableTCPServerPort(startPort int) (net.Addr, error) { + for i := startPort; i < 65535; i++ { + s := "127.0.0.1:" + strconv.Itoa(i) + l, err := net.Listen("tcp", s) + if err == nil { + l.Close() + return net.ResolveTCPAddr("tcp", s) + } + } + return nil, NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "Could not find available server port") +} + +func valueInSlice(value string, slice []string) bool { + for _, v := range slice { + if value == v { + return true + } + } + return false +} diff --git a/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go b/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go new file mode 100644 index 0000000000000..f57610cbd2a0d --- /dev/null +++ b/vendor/github.com/apache/thrift/lib/go/thrift/zlib_transport_test.go @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package thrift + +import ( + "compress/zlib" + "testing" +) + +func TestZlibTransport(t *testing.T) { + trans, err := NewTZlibTransport(NewTMemoryBuffer(), zlib.BestCompression) + if err != nil { + t.Fatal(err) + } + TransportTest(t, trans, trans) +} diff --git a/vendor/github.com/apache/thrift/package.json b/vendor/github.com/apache/thrift/package.json new file mode 100644 index 0000000000000..edfc3553ed5ce --- /dev/null +++ b/vendor/github.com/apache/thrift/package.json @@ -0,0 +1,54 @@ +{ + "name": "thrift", + "description": "node.js bindings for the Apache Thrift RPC system", + "homepage": "http://thrift.apache.org/", + "repository": { + "type": "git", + "url": "https://git-wip-us.apache.org/repos/asf/thrift.git" + }, + "version": "0.10.0", + "author": { + "name": "Apache Thrift Developers", + "email": "dev@thrift.apache.org", + "url": "http://thrift.apache.org" + }, + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "bugs": { + "mail": "dev@thrift.apache.org", + "url": "https://issues.apache.org/jira/browse/THRIFT" + }, + "files": [ + "lib/nodejs/lib/thrift", + "lib/nodejs/README.md" + ], + "directories": { + "lib": "./lib/nodejs/lib/thrift" + }, + "main": "./lib/nodejs/lib/thrift", + "engines": { + "node": ">= 0.2.4" + }, + "dependencies": { + "node-int64": "~0.3.0", + "q": "1.0.x", + "ws": "~0.4.32" + }, + "devDependencies": { + "buffer-equals": "^1.0.3", + "commander": "2.1.x", + "connect": "2.7.x", + "istanbul": "^0.3.5", + "run-browser": "^2.0.1", + "tape": "~3.5.0" + }, + "scripts": { + "cover": "lib/nodejs/test/testAll.sh COVER", + "test": "lib/nodejs/test/testAll.sh" + } +} diff --git a/vendor/github.com/apache/thrift/sonar-project.properties b/vendor/github.com/apache/thrift/sonar-project.properties new file mode 100644 index 0000000000000..6e6c5db90d1c4 --- /dev/null +++ b/vendor/github.com/apache/thrift/sonar-project.properties @@ -0,0 +1,140 @@ +# Apache Thrift © The Apache Software Foundation +# http://www.apache.org/licenses/LICENSE-2.0 +# SPDX-License-Identifier: Apache-2.0 + +# File: sonar-project.properties +# Apache Thrift configuration file for Sonar https://analysis.apache.org/ +# Sonar is an open platform to manage code quality http://www.sonarsource.org/ + + +# required metadata +sonar.projectKey=org.apache.thrift +sonar.projectName=Apache Thrift +sonar.projectDescription= +The Apache Thrift software framework, for scalable cross-language services +development, combines a software stack with a code generation engine to build +services that work efficiently and seamlessly between all major languages. + +# Apache Thrift Version +sonar.projectVersion=0.10.0 +# use this to set another version string +# $ sonar-runner -D sonar.projectVersion=`git rev-parse HEAD` +# set projectDate in combination with projectVersion for imports of old releases +#sonar.projectDate=yyyy-MM-dd + +# TODO add website (sonar.projectUrl does not work) +#sonar.XXXX=http//thrift.apache.org + +# Some properties that will be inherited by the modules +sonar.sources=src +sonar.language=java,js,c++,py,c +sonar.sourceEncoding=UTF-8 + +# scm +sonar.scm.url=scm:git:https://git-wip-us.apache.org/repos/asf/thrift + +# cppcheck -q --error-exitcode=0 --xml . 2> cppcheck-result.xml +sonar.cxx.cppcheck.reportPath=cppcheck-result.xml + +# List of the module identifiers +sonar.modules=module1,module3,module4,module5,module6,module7,module8,module9,module10,module11,module12,module14 + + + +# we need sonar-runner 2.1 for this, see http://jira.codehaus.org/browse/SONARPLUGINS-2421 +#sonar.modules=module2 + +# delph plugin is broken +#sonar.modules=module13 + +# phpunit plugin is broken +#sonar.modules=module15 + +module1.sonar.projectName=Apache Thrift - Java Library +module1.sonar.projectBaseDir=lib/java +module1.sonar.sources=src +module1.sonar.tests=test +module1.sonar.binaries=build/libthrift-0.10.0.jar +module1.sonar.libraries=build/lib/*.jar +module1.sonar.language=java + +module2.sonar.projectName=Apache Thrift - Java Tutorial +module2.sonar.projectBaseDir=. +module2.sonar.sources=tutorial/java/src, tutorial/java/gen-java +module2.sonar.binaries=tutorial/java/tutorial.jar +module2.sonar.libraries=lib/java/build/lib/*.jar,lib/java/build/libthrift-1.0.0.jar +module2.sonar.language=java + +module3.sonar.projectName=Apache Thrift - JavaScript Library +module3.sonar.projectBaseDir=lib/js +module3.sonar.sources=. +module3.sonar.exclusions=test/**/* +module3.sonar.language=js + +module4.sonar.projectName=Apache Thrift - JavaScript Tutorial +module4.sonar.projectBaseDir=tutorial/js +module4.sonar.sources=. +module4.sonar.language=web + +module5.sonar.projectName=Apache Thrift - C++ Library +module5.sonar.projectBaseDir=lib/cpp +module5.sonar.sources=src +module5.sonar.tests=test +module5.sonar.language=c++ + +module6.sonar.projectName=Apache Thrift - C++ Tutorial +module6.sonar.projectBaseDir=tutorial/cpp +module6.sonar.sources=. +module6.sonar.exclusions=gen-cpp/**/* +module6.sonar.language=c++ + +module7.sonar.projectName=Apache Thrift - C++ Cross Language Test +module7.sonar.projectBaseDir=test/cpp +module7.sonar.sources=src +module7.sonar.language=c++ + +module8.sonar.projectName=Apache Thrift - Compiler +module8.sonar.projectBaseDir=compiler/cpp +module8.sonar.sources=src +module8.sonar.language=c++ + +module9.sonar.projectName=Apache Thrift - Python Library +module9.sonar.projectBaseDir=lib/py +module9.sonar.sources=src +module9.sonar.language=py + +module10.sonar.projectName=Apache Thrift - Python Tutorial +module10.sonar.projectBaseDir=tutorial/py +module10.sonar.sources=. +module10.sonar.exclusions=gen-py/**/* +module10.sonar.language=py + +module11.sonar.projectName=Apache Thrift - Python Cross Language Test +module11.sonar.projectBaseDir=test/py +module11.sonar.sources=. +module11.sonar.exclusions=gen-*/**/* +module11.sonar.language=py + +module12.sonar.projectName=Apache Thrift - c_glib Library +module12.sonar.projectBaseDir=lib/c_glib +module12.sonar.sources=src +module12.sonar.language=c + +module13.sonar.projectName=Apache Thrift - Delphi Library +module13.sonar.projectBaseDir=lib/delphi +module13.sonar.sources=src +module13.sonar.tests=test +module13.sonar.language=delph + +module14.sonar.projectName=Apache Thrift - Flex (as3) Library +module14.sonar.projectBaseDir=lib/as3 +module14.sonar.sources=src +module14.sonar.language=flex + +module15.sonar.projectName=Apache Thrift - PHP Library +module15.sonar.projectBaseDir=lib/php +module15.sonar.sources=src +module15.sonar.language=php + +# TODO add some more languages here + diff --git a/vendor/github.com/beorn7/perks/.gitignore b/vendor/github.com/beorn7/perks/.gitignore new file mode 100644 index 0000000000000..1bd9209aa195a --- /dev/null +++ b/vendor/github.com/beorn7/perks/.gitignore @@ -0,0 +1,2 @@ +*.test +*.prof diff --git a/vendor/github.com/beorn7/perks/README.md b/vendor/github.com/beorn7/perks/README.md new file mode 100644 index 0000000000000..fc05777701ab7 --- /dev/null +++ b/vendor/github.com/beorn7/perks/README.md @@ -0,0 +1,31 @@ +# Perks for Go (golang.org) + +Perks contains the Go package quantile that computes approximate quantiles over +an unbounded data stream within low memory and CPU bounds. + +For more information and examples, see: +http://godoc.org/github.com/bmizerany/perks + +A very special thank you and shout out to Graham Cormode (Rutgers University), +Flip Korn (AT&T Labs–Research), S. Muthukrishnan (Rutgers University), and +Divesh Srivastava (AT&T Labs–Research) for their research and publication of +[Effective Computation of Biased Quantiles over Data Streams](http://www.cs.rutgers.edu/~muthu/bquant.pdf) + +Thank you, also: +* Armon Dadgar (@armon) +* Andrew Gerrand (@nf) +* Brad Fitzpatrick (@bradfitz) +* Keith Rarick (@kr) + +FAQ: + +Q: Why not move the quantile package into the project root? +A: I want to add more packages to perks later. + +Copyright (C) 2013 Blake Mizerany + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/quantile/bench_test.go b/vendor/github.com/beorn7/perks/quantile/bench_test.go new file mode 100644 index 0000000000000..0bd0e4e775217 --- /dev/null +++ b/vendor/github.com/beorn7/perks/quantile/bench_test.go @@ -0,0 +1,63 @@ +package quantile + +import ( + "testing" +) + +func BenchmarkInsertTargeted(b *testing.B) { + b.ReportAllocs() + + s := NewTargeted(Targets) + b.ResetTimer() + for i := float64(0); i < float64(b.N); i++ { + s.Insert(i) + } +} + +func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) { + s := NewTargeted(TargetsSmallEpsilon) + b.ResetTimer() + for i := float64(0); i < float64(b.N); i++ { + s.Insert(i) + } +} + +func BenchmarkInsertBiased(b *testing.B) { + s := NewLowBiased(0.01) + b.ResetTimer() + for i := float64(0); i < float64(b.N); i++ { + s.Insert(i) + } +} + +func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) { + s := NewLowBiased(0.0001) + b.ResetTimer() + for i := float64(0); i < float64(b.N); i++ { + s.Insert(i) + } +} + +func BenchmarkQuery(b *testing.B) { + s := NewTargeted(Targets) + for i := float64(0); i < 1e6; i++ { + s.Insert(i) + } + b.ResetTimer() + n := float64(b.N) + for i := float64(0); i < n; i++ { + s.Query(i / n) + } +} + +func BenchmarkQuerySmallEpsilon(b *testing.B) { + s := NewTargeted(TargetsSmallEpsilon) + for i := float64(0); i < 1e6; i++ { + s.Insert(i) + } + b.ResetTimer() + n := float64(b.N) + for i := float64(0); i < n; i++ { + s.Query(i / n) + } +} diff --git a/vendor/github.com/beorn7/perks/quantile/example_test.go b/vendor/github.com/beorn7/perks/quantile/example_test.go new file mode 100644 index 0000000000000..ab3293aaf2a09 --- /dev/null +++ b/vendor/github.com/beorn7/perks/quantile/example_test.go @@ -0,0 +1,121 @@ +// +build go1.1 + +package quantile_test + +import ( + "bufio" + "fmt" + "log" + "os" + "strconv" + "time" + + "github.com/beorn7/perks/quantile" +) + +func Example_simple() { + ch := make(chan float64) + go sendFloats(ch) + + // Compute the 50th, 90th, and 99th percentile. + q := quantile.NewTargeted(map[float64]float64{ + 0.50: 0.005, + 0.90: 0.001, + 0.99: 0.0001, + }) + for v := range ch { + q.Insert(v) + } + + fmt.Println("perc50:", q.Query(0.50)) + fmt.Println("perc90:", q.Query(0.90)) + fmt.Println("perc99:", q.Query(0.99)) + fmt.Println("count:", q.Count()) + // Output: + // perc50: 5 + // perc90: 16 + // perc99: 223 + // count: 2388 +} + +func Example_mergeMultipleStreams() { + // Scenario: + // We have multiple database shards. On each shard, there is a process + // collecting query response times from the database logs and inserting + // them into a Stream (created via NewTargeted(0.90)), much like the + // Simple example. These processes expose a network interface for us to + // ask them to serialize and send us the results of their + // Stream.Samples so we may Merge and Query them. + // + // NOTES: + // * These sample sets are small, allowing us to get them + // across the network much faster than sending the entire list of data + // points. + // + // * For this to work correctly, we must supply the same quantiles + // a priori the process collecting the samples supplied to NewTargeted, + // even if we do not plan to query them all here. + ch := make(chan quantile.Samples) + getDBQuerySamples(ch) + q := quantile.NewTargeted(map[float64]float64{0.90: 0.001}) + for samples := range ch { + q.Merge(samples) + } + fmt.Println("perc90:", q.Query(0.90)) +} + +func Example_window() { + // Scenario: We want the 90th, 95th, and 99th percentiles for each + // minute. + + ch := make(chan float64) + go sendStreamValues(ch) + + tick := time.NewTicker(1 * time.Minute) + q := quantile.NewTargeted(map[float64]float64{ + 0.90: 0.001, + 0.95: 0.0005, + 0.99: 0.0001, + }) + for { + select { + case t := <-tick.C: + flushToDB(t, q.Samples()) + q.Reset() + case v := <-ch: + q.Insert(v) + } + } +} + +func sendStreamValues(ch chan float64) { + // Use your imagination +} + +func flushToDB(t time.Time, samples quantile.Samples) { + // Use your imagination +} + +// This is a stub for the above example. In reality this would hit the remote +// servers via http or something like it. +func getDBQuerySamples(ch chan quantile.Samples) {} + +func sendFloats(ch chan<- float64) { + f, err := os.Open("exampledata.txt") + if err != nil { + log.Fatal(err) + } + sc := bufio.NewScanner(f) + for sc.Scan() { + b := sc.Bytes() + v, err := strconv.ParseFloat(string(b), 64) + if err != nil { + log.Fatal(err) + } + ch <- v + } + if sc.Err() != nil { + log.Fatal(sc.Err()) + } + close(ch) +} diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt new file mode 100644 index 0000000000000..1602287d7ce52 --- /dev/null +++ b/vendor/github.com/beorn7/perks/quantile/exampledata.txt @@ -0,0 +1,2388 @@ +8 +5 +26 +12 +5 +235 +13 +6 +28 +30 +3 +3 +3 +3 +5 +2 +33 +7 +2 +4 +7 +12 +14 +5 +8 +3 +10 +4 +5 +3 +6 +6 +209 +20 +3 +10 +14 +3 +4 +6 +8 +5 +11 +7 +3 +2 +3 +3 +212 +5 +222 +4 +10 +10 +5 +6 +3 +8 +3 +10 +254 +220 +2 +3 +5 +24 +5 +4 +222 +7 +3 +3 +223 +8 +15 +12 +14 +14 +3 +2 +2 +3 +13 +3 +11 +4 +4 +6 +5 +7 +13 +5 +3 +5 +2 +5 +3 +5 +2 +7 +15 +17 +14 +3 +6 +6 +3 +17 +5 +4 +7 +6 +4 +4 +8 +6 +8 +3 +9 +3 +6 +3 +4 +5 +3 +3 +660 +4 +6 +10 +3 +6 +3 +2 +5 +13 +2 +4 +4 +10 +4 +8 +4 +3 +7 +9 +9 +3 +10 +37 +3 +13 +4 +12 +3 +6 +10 +8 +5 +21 +2 +3 +8 +3 +2 +3 +3 +4 +12 +2 +4 +8 +8 +4 +3 +2 +20 +1 +6 +32 +2 +11 +6 +18 +3 +8 +11 +3 +212 +3 +4 +2 +6 +7 +12 +11 +3 +2 +16 +10 +6 +4 +6 +3 +2 +7 +3 +2 +2 +2 +2 +5 +6 +4 +3 +10 +3 +4 +6 +5 +3 +4 +4 +5 +6 +4 +3 +4 +4 +5 +7 +5 +5 +3 +2 +7 +2 +4 +12 +4 +5 +6 +2 +4 +4 +8 +4 +15 +13 +7 +16 +5 +3 +23 +5 +5 +7 +3 +2 +9 +8 +7 +5 +8 +11 +4 +10 +76 +4 +47 +4 +3 +2 +7 +4 +2 +3 +37 +10 +4 +2 +20 +5 +4 +4 +10 +10 +4 +3 +7 +23 +240 +7 +13 +5 +5 +3 +3 +2 +5 +4 +2 +8 +7 +19 +2 +23 +8 +7 +2 +5 +3 +8 +3 +8 +13 +5 +5 +5 +2 +3 +23 +4 +9 +8 +4 +3 +3 +5 +220 +2 +3 +4 +6 +14 +3 +53 +6 +2 +5 +18 +6 +3 +219 +6 +5 +2 +5 +3 +6 +5 +15 +4 +3 +17 +3 +2 +4 +7 +2 +3 +3 +4 +4 +3 +2 +664 +6 +3 +23 +5 +5 +16 +5 +8 +2 +4 +2 +24 +12 +3 +2 +3 +5 +8 +3 +5 +4 +3 +14 +3 +5 +8 +2 +3 +7 +9 +4 +2 +3 +6 +8 +4 +3 +4 +6 +5 +3 +3 +6 +3 +19 +4 +4 +6 +3 +6 +3 +5 +22 +5 +4 +4 +3 +8 +11 +4 +9 +7 +6 +13 +4 +4 +4 +6 +17 +9 +3 +3 +3 +4 +3 +221 +5 +11 +3 +4 +2 +12 +6 +3 +5 +7 +5 +7 +4 +9 +7 +14 +37 +19 +217 +16 +3 +5 +2 +2 +7 +19 +7 +6 +7 +4 +24 +5 +11 +4 +7 +7 +9 +13 +3 +4 +3 +6 +28 +4 +4 +5 +5 +2 +5 +6 +4 +4 +6 +10 +5 +4 +3 +2 +3 +3 +6 +5 +5 +4 +3 +2 +3 +7 +4 +6 +18 +16 +8 +16 +4 +5 +8 +6 +9 +13 +1545 +6 +215 +6 +5 +6 +3 +45 +31 +5 +2 +2 +4 +3 +3 +2 +5 +4 +3 +5 +7 +7 +4 +5 +8 +5 +4 +749 +2 +31 +9 +11 +2 +11 +5 +4 +4 +7 +9 +11 +4 +5 +4 +7 +3 +4 +6 +2 +15 +3 +4 +3 +4 +3 +5 +2 +13 +5 +5 +3 +3 +23 +4 +4 +5 +7 +4 +13 +2 +4 +3 +4 +2 +6 +2 +7 +3 +5 +5 +3 +29 +5 +4 +4 +3 +10 +2 +3 +79 +16 +6 +6 +7 +7 +3 +5 +5 +7 +4 +3 +7 +9 +5 +6 +5 +9 +6 +3 +6 +4 +17 +2 +10 +9 +3 +6 +2 +3 +21 +22 +5 +11 +4 +2 +17 +2 +224 +2 +14 +3 +4 +4 +2 +4 +4 +4 +4 +5 +3 +4 +4 +10 +2 +6 +3 +3 +5 +7 +2 +7 +5 +6 +3 +218 +2 +2 +5 +2 +6 +3 +5 +222 +14 +6 +33 +3 +2 +5 +3 +3 +3 +9 +5 +3 +3 +2 +7 +4 +3 +4 +3 +5 +6 +5 +26 +4 +13 +9 +7 +3 +221 +3 +3 +4 +4 +4 +4 +2 +18 +5 +3 +7 +9 +6 +8 +3 +10 +3 +11 +9 +5 +4 +17 +5 +5 +6 +6 +3 +2 +4 +12 +17 +6 +7 +218 +4 +2 +4 +10 +3 +5 +15 +3 +9 +4 +3 +3 +6 +29 +3 +3 +4 +5 +5 +3 +8 +5 +6 +6 +7 +5 +3 +5 +3 +29 +2 +31 +5 +15 +24 +16 +5 +207 +4 +3 +3 +2 +15 +4 +4 +13 +5 +5 +4 +6 +10 +2 +7 +8 +4 +6 +20 +5 +3 +4 +3 +12 +12 +5 +17 +7 +3 +3 +3 +6 +10 +3 +5 +25 +80 +4 +9 +3 +2 +11 +3 +3 +2 +3 +8 +7 +5 +5 +19 +5 +3 +3 +12 +11 +2 +6 +5 +5 +5 +3 +3 +3 +4 +209 +14 +3 +2 +5 +19 +4 +4 +3 +4 +14 +5 +6 +4 +13 +9 +7 +4 +7 +10 +2 +9 +5 +7 +2 +8 +4 +6 +5 +5 +222 +8 +7 +12 +5 +216 +3 +4 +4 +6 +3 +14 +8 +7 +13 +4 +3 +3 +3 +3 +17 +5 +4 +3 +33 +6 +6 +33 +7 +5 +3 +8 +7 +5 +2 +9 +4 +2 +233 +24 +7 +4 +8 +10 +3 +4 +15 +2 +16 +3 +3 +13 +12 +7 +5 +4 +207 +4 +2 +4 +27 +15 +2 +5 +2 +25 +6 +5 +5 +6 +13 +6 +18 +6 +4 +12 +225 +10 +7 +5 +2 +2 +11 +4 +14 +21 +8 +10 +3 +5 +4 +232 +2 +5 +5 +3 +7 +17 +11 +6 +6 +23 +4 +6 +3 +5 +4 +2 +17 +3 +6 +5 +8 +3 +2 +2 +14 +9 +4 +4 +2 +5 +5 +3 +7 +6 +12 +6 +10 +3 +6 +2 +2 +19 +5 +4 +4 +9 +2 +4 +13 +3 +5 +6 +3 +6 +5 +4 +9 +6 +3 +5 +7 +3 +6 +6 +4 +3 +10 +6 +3 +221 +3 +5 +3 +6 +4 +8 +5 +3 +6 +4 +4 +2 +54 +5 +6 +11 +3 +3 +4 +4 +4 +3 +7 +3 +11 +11 +7 +10 +6 +13 +223 +213 +15 +231 +7 +3 +7 +228 +2 +3 +4 +4 +5 +6 +7 +4 +13 +3 +4 +5 +3 +6 +4 +6 +7 +2 +4 +3 +4 +3 +3 +6 +3 +7 +3 +5 +18 +5 +6 +8 +10 +3 +3 +3 +2 +4 +2 +4 +4 +5 +6 +6 +4 +10 +13 +3 +12 +5 +12 +16 +8 +4 +19 +11 +2 +4 +5 +6 +8 +5 +6 +4 +18 +10 +4 +2 +216 +6 +6 +6 +2 +4 +12 +8 +3 +11 +5 +6 +14 +5 +3 +13 +4 +5 +4 +5 +3 +28 +6 +3 +7 +219 +3 +9 +7 +3 +10 +6 +3 +4 +19 +5 +7 +11 +6 +15 +19 +4 +13 +11 +3 +7 +5 +10 +2 +8 +11 +2 +6 +4 +6 +24 +6 +3 +3 +3 +3 +6 +18 +4 +11 +4 +2 +5 +10 +8 +3 +9 +5 +3 +4 +5 +6 +2 +5 +7 +4 +4 +14 +6 +4 +4 +5 +5 +7 +2 +4 +3 +7 +3 +3 +6 +4 +5 +4 +4 +4 +3 +3 +3 +3 +8 +14 +2 +3 +5 +3 +2 +4 +5 +3 +7 +3 +3 +18 +3 +4 +4 +5 +7 +3 +3 +3 +13 +5 +4 +8 +211 +5 +5 +3 +5 +2 +5 +4 +2 +655 +6 +3 +5 +11 +2 +5 +3 +12 +9 +15 +11 +5 +12 +217 +2 +6 +17 +3 +3 +207 +5 +5 +4 +5 +9 +3 +2 +8 +5 +4 +3 +2 +5 +12 +4 +14 +5 +4 +2 +13 +5 +8 +4 +225 +4 +3 +4 +5 +4 +3 +3 +6 +23 +9 +2 +6 +7 +233 +4 +4 +6 +18 +3 +4 +6 +3 +4 +4 +2 +3 +7 +4 +13 +227 +4 +3 +5 +4 +2 +12 +9 +17 +3 +7 +14 +6 +4 +5 +21 +4 +8 +9 +2 +9 +25 +16 +3 +6 +4 +7 +8 +5 +2 +3 +5 +4 +3 +3 +5 +3 +3 +3 +2 +3 +19 +2 +4 +3 +4 +2 +3 +4 +4 +2 +4 +3 +3 +3 +2 +6 +3 +17 +5 +6 +4 +3 +13 +5 +3 +3 +3 +4 +9 +4 +2 +14 +12 +4 +5 +24 +4 +3 +37 +12 +11 +21 +3 +4 +3 +13 +4 +2 +3 +15 +4 +11 +4 +4 +3 +8 +3 +4 +4 +12 +8 +5 +3 +3 +4 +2 +220 +3 +5 +223 +3 +3 +3 +10 +3 +15 +4 +241 +9 +7 +3 +6 +6 +23 +4 +13 +7 +3 +4 +7 +4 +9 +3 +3 +4 +10 +5 +5 +1 +5 +24 +2 +4 +5 +5 +6 +14 +3 +8 +2 +3 +5 +13 +13 +3 +5 +2 +3 +15 +3 +4 +2 +10 +4 +4 +4 +5 +5 +3 +5 +3 +4 +7 +4 +27 +3 +6 +4 +15 +3 +5 +6 +6 +5 +4 +8 +3 +9 +2 +6 +3 +4 +3 +7 +4 +18 +3 +11 +3 +3 +8 +9 +7 +24 +3 +219 +7 +10 +4 +5 +9 +12 +2 +5 +4 +4 +4 +3 +3 +19 +5 +8 +16 +8 +6 +22 +3 +23 +3 +242 +9 +4 +3 +3 +5 +7 +3 +3 +5 +8 +3 +7 +5 +14 +8 +10 +3 +4 +3 +7 +4 +6 +7 +4 +10 +4 +3 +11 +3 +7 +10 +3 +13 +6 +8 +12 +10 +5 +7 +9 +3 +4 +7 +7 +10 +8 +30 +9 +19 +4 +3 +19 +15 +4 +13 +3 +215 +223 +4 +7 +4 +8 +17 +16 +3 +7 +6 +5 +5 +4 +12 +3 +7 +4 +4 +13 +4 +5 +2 +5 +6 +5 +6 +6 +7 +10 +18 +23 +9 +3 +3 +6 +5 +2 +4 +2 +7 +3 +3 +2 +5 +5 +14 +10 +224 +6 +3 +4 +3 +7 +5 +9 +3 +6 +4 +2 +5 +11 +4 +3 +3 +2 +8 +4 +7 +4 +10 +7 +3 +3 +18 +18 +17 +3 +3 +3 +4 +5 +3 +3 +4 +12 +7 +3 +11 +13 +5 +4 +7 +13 +5 +4 +11 +3 +12 +3 +6 +4 +4 +21 +4 +6 +9 +5 +3 +10 +8 +4 +6 +4 +4 +6 +5 +4 +8 +6 +4 +6 +4 +4 +5 +9 +6 +3 +4 +2 +9 +3 +18 +2 +4 +3 +13 +3 +6 +6 +8 +7 +9 +3 +2 +16 +3 +4 +6 +3 +2 +33 +22 +14 +4 +9 +12 +4 +5 +6 +3 +23 +9 +4 +3 +5 +5 +3 +4 +5 +3 +5 +3 +10 +4 +5 +5 +8 +4 +4 +6 +8 +5 +4 +3 +4 +6 +3 +3 +3 +5 +9 +12 +6 +5 +9 +3 +5 +3 +2 +2 +2 +18 +3 +2 +21 +2 +5 +4 +6 +4 +5 +10 +3 +9 +3 +2 +10 +7 +3 +6 +6 +4 +4 +8 +12 +7 +3 +7 +3 +3 +9 +3 +4 +5 +4 +4 +5 +5 +10 +15 +4 +4 +14 +6 +227 +3 +14 +5 +216 +22 +5 +4 +2 +2 +6 +3 +4 +2 +9 +9 +4 +3 +28 +13 +11 +4 +5 +3 +3 +2 +3 +3 +5 +3 +4 +3 +5 +23 +26 +3 +4 +5 +6 +4 +6 +3 +5 +5 +3 +4 +3 +2 +2 +2 +7 +14 +3 +6 +7 +17 +2 +2 +15 +14 +16 +4 +6 +7 +13 +6 +4 +5 +6 +16 +3 +3 +28 +3 +6 +15 +3 +9 +2 +4 +6 +3 +3 +22 +4 +12 +6 +7 +2 +5 +4 +10 +3 +16 +6 +9 +2 +5 +12 +7 +5 +5 +5 +5 +2 +11 +9 +17 +4 +3 +11 +7 +3 +5 +15 +4 +3 +4 +211 +8 +7 +5 +4 +7 +6 +7 +6 +3 +6 +5 +6 +5 +3 +4 +4 +26 +4 +6 +10 +4 +4 +3 +2 +3 +3 +4 +5 +9 +3 +9 +4 +4 +5 +5 +8 +2 +4 +2 +3 +8 +4 +11 +19 +5 +8 +6 +3 +5 +6 +12 +3 +2 +4 +16 +12 +3 +4 +4 +8 +6 +5 +6 +6 +219 +8 +222 +6 +16 +3 +13 +19 +5 +4 +3 +11 +6 +10 +4 +7 +7 +12 +5 +3 +3 +5 +6 +10 +3 +8 +2 +5 +4 +7 +2 +4 +4 +2 +12 +9 +6 +4 +2 +40 +2 +4 +10 +4 +223 +4 +2 +20 +6 +7 +24 +5 +4 +5 +2 +20 +16 +6 +5 +13 +2 +3 +3 +19 +3 +2 +4 +5 +6 +7 +11 +12 +5 +6 +7 +7 +3 +5 +3 +5 +3 +14 +3 +4 +4 +2 +11 +1 +7 +3 +9 +6 +11 +12 +5 +8 +6 +221 +4 +2 +12 +4 +3 +15 +4 +5 +226 +7 +218 +7 +5 +4 +5 +18 +4 +5 +9 +4 +4 +2 +9 +18 +18 +9 +5 +6 +6 +3 +3 +7 +3 +5 +4 +4 +4 +12 +3 +6 +31 +5 +4 +7 +3 +6 +5 +6 +5 +11 +2 +2 +11 +11 +6 +7 +5 +8 +7 +10 +5 +23 +7 +4 +3 +5 +34 +2 +5 +23 +7 +3 +6 +8 +4 +4 +4 +2 +5 +3 +8 +5 +4 +8 +25 +2 +3 +17 +8 +3 +4 +8 +7 +3 +15 +6 +5 +7 +21 +9 +5 +6 +6 +5 +3 +2 +3 +10 +3 +6 +3 +14 +7 +4 +4 +8 +7 +8 +2 +6 +12 +4 +213 +6 +5 +21 +8 +2 +5 +23 +3 +11 +2 +3 +6 +25 +2 +3 +6 +7 +6 +6 +4 +4 +6 +3 +17 +9 +7 +6 +4 +3 +10 +7 +2 +3 +3 +3 +11 +8 +3 +7 +6 +4 +14 +36 +3 +4 +3 +3 +22 +13 +21 +4 +2 +7 +4 +4 +17 +15 +3 +7 +11 +2 +4 +7 +6 +209 +6 +3 +2 +2 +24 +4 +9 +4 +3 +3 +3 +29 +2 +2 +4 +3 +3 +5 +4 +6 +3 +3 +2 +4 diff --git a/vendor/github.com/beorn7/perks/quantile/stream_test.go b/vendor/github.com/beorn7/perks/quantile/stream_test.go new file mode 100644 index 0000000000000..4dba05449cb46 --- /dev/null +++ b/vendor/github.com/beorn7/perks/quantile/stream_test.go @@ -0,0 +1,188 @@ +package quantile + +import ( + "math" + "math/rand" + "sort" + "testing" +) + +var ( + Targets = map[float64]float64{ + 0.01: 0.001, + 0.10: 0.01, + 0.50: 0.05, + 0.90: 0.01, + 0.99: 0.001, + } + TargetsSmallEpsilon = map[float64]float64{ + 0.01: 0.0001, + 0.10: 0.001, + 0.50: 0.005, + 0.90: 0.001, + 0.99: 0.0001, + } + LowQuantiles = []float64{0.01, 0.1, 0.5} + HighQuantiles = []float64{0.99, 0.9, 0.5} +) + +const RelativeEpsilon = 0.01 + +func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) { + sort.Float64s(a) + for quantile, epsilon := range Targets { + n := float64(len(a)) + k := int(quantile * n) + lower := int((quantile - epsilon) * n) + if lower < 1 { + lower = 1 + } + upper := int(math.Ceil((quantile + epsilon) * n)) + if upper > len(a) { + upper = len(a) + } + w, min, max := a[k-1], a[lower-1], a[upper-1] + if g := s.Query(quantile); g < min || g > max { + t.Errorf("q=%f: want %v [%f,%f], got %v", quantile, w, min, max, g) + } + } +} + +func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { + sort.Float64s(a) + for _, qu := range LowQuantiles { + n := float64(len(a)) + k := int(qu * n) + + lowerRank := int((1 - RelativeEpsilon) * qu * n) + upperRank := int(math.Ceil((1 + RelativeEpsilon) * qu * n)) + w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] + if g := s.Query(qu); g < min || g > max { + t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) + } + } +} + +func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { + sort.Float64s(a) + for _, qu := range HighQuantiles { + n := float64(len(a)) + k := int(qu * n) + + lowerRank := int((1 - (1+RelativeEpsilon)*(1-qu)) * n) + upperRank := int(math.Ceil((1 - (1-RelativeEpsilon)*(1-qu)) * n)) + w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] + if g := s.Query(qu); g < min || g > max { + t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) + } + } +} + +func populateStream(s *Stream) []float64 { + a := make([]float64, 0, 1e5+100) + for i := 0; i < cap(a); i++ { + v := rand.NormFloat64() + // Add 5% asymmetric outliers. + if i%20 == 0 { + v = v*v + 1 + } + s.Insert(v) + a = append(a, v) + } + return a +} + +func TestTargetedQuery(t *testing.T) { + rand.Seed(42) + s := NewTargeted(Targets) + a := populateStream(s) + verifyPercsWithAbsoluteEpsilon(t, a, s) +} + +func TestLowBiasedQuery(t *testing.T) { + rand.Seed(42) + s := NewLowBiased(RelativeEpsilon) + a := populateStream(s) + verifyLowPercsWithRelativeEpsilon(t, a, s) +} + +func TestHighBiasedQuery(t *testing.T) { + rand.Seed(42) + s := NewHighBiased(RelativeEpsilon) + a := populateStream(s) + verifyHighPercsWithRelativeEpsilon(t, a, s) +} + +// BrokenTestTargetedMerge is broken, see Merge doc comment. +func BrokenTestTargetedMerge(t *testing.T) { + rand.Seed(42) + s1 := NewTargeted(Targets) + s2 := NewTargeted(Targets) + a := populateStream(s1) + a = append(a, populateStream(s2)...) + s1.Merge(s2.Samples()) + verifyPercsWithAbsoluteEpsilon(t, a, s1) +} + +// BrokenTestLowBiasedMerge is broken, see Merge doc comment. +func BrokenTestLowBiasedMerge(t *testing.T) { + rand.Seed(42) + s1 := NewLowBiased(RelativeEpsilon) + s2 := NewLowBiased(RelativeEpsilon) + a := populateStream(s1) + a = append(a, populateStream(s2)...) + s1.Merge(s2.Samples()) + verifyLowPercsWithRelativeEpsilon(t, a, s2) +} + +// BrokenTestHighBiasedMerge is broken, see Merge doc comment. +func BrokenTestHighBiasedMerge(t *testing.T) { + rand.Seed(42) + s1 := NewHighBiased(RelativeEpsilon) + s2 := NewHighBiased(RelativeEpsilon) + a := populateStream(s1) + a = append(a, populateStream(s2)...) + s1.Merge(s2.Samples()) + verifyHighPercsWithRelativeEpsilon(t, a, s2) +} + +func TestUncompressed(t *testing.T) { + q := NewTargeted(Targets) + for i := 100; i > 0; i-- { + q.Insert(float64(i)) + } + if g := q.Count(); g != 100 { + t.Errorf("want count 100, got %d", g) + } + // Before compression, Query should have 100% accuracy. + for quantile := range Targets { + w := quantile * 100 + if g := q.Query(quantile); g != w { + t.Errorf("want %f, got %f", w, g) + } + } +} + +func TestUncompressedSamples(t *testing.T) { + q := NewTargeted(map[float64]float64{0.99: 0.001}) + for i := 1; i <= 100; i++ { + q.Insert(float64(i)) + } + if g := q.Samples().Len(); g != 100 { + t.Errorf("want count 100, got %d", g) + } +} + +func TestUncompressedOne(t *testing.T) { + q := NewTargeted(map[float64]float64{0.99: 0.01}) + q.Insert(3.14) + if g := q.Query(0.90); g != 3.14 { + t.Error("want PI, got", g) + } +} + +func TestDefaults(t *testing.T) { + if g := NewTargeted(map[float64]float64{0.99: 0.001}).Query(0.99); g != 0 { + t.Errorf("want 0, got %f", g) + } +} diff --git a/vendor/github.com/blacktear23/go-proxyprotocol/.travis.yml b/vendor/github.com/blacktear23/go-proxyprotocol/.travis.yml new file mode 100644 index 0000000000000..67d2d12c8c25b --- /dev/null +++ b/vendor/github.com/blacktear23/go-proxyprotocol/.travis.yml @@ -0,0 +1,12 @@ +language: go + +go_import_path: github.com/blacktear23/go-proxyprotocol + +go: + - 1.9.x + +before_install: + - go get github.com/pingcap/check + +script: + - go test -cover diff --git a/vendor/github.com/blacktear23/go-proxyprotocol/README.md b/vendor/github.com/blacktear23/go-proxyprotocol/README.md new file mode 100644 index 0000000000000..f1de3b4a449ed --- /dev/null +++ b/vendor/github.com/blacktear23/go-proxyprotocol/README.md @@ -0,0 +1,37 @@ +# go-proxyprotocol + +PROXY protocol implementation in Go. + +## Usage + +import + +```go +import ( + proxyprotocol "github.com/blacktear23/go-proxyprotocol" +) +``` + +basic usage + +```go +// Create listener +l, err := net.Listen("tcp", "...") + +// Wrap listener as PROXY protocol listener +ppl, err := proxyprotocol.NewListener(l, "*", 5) + +for { + conn, err := ppl.Accept() + if err != nil { + // PROXY protocol related errors can be output by log and + // continue accept next one. + if proxyprotocol.IsProxyProtocolError(err) { + log.Errorf("PROXY protocol error: %s", err.Error()) + continue + } + panic(err) + } + go processConn(conn) +} +``` diff --git a/vendor/github.com/blacktear23/go-proxyprotocol/proxy_protocol_test.go b/vendor/github.com/blacktear23/go-proxyprotocol/proxy_protocol_test.go new file mode 100644 index 0000000000000..9fbe6ed006697 --- /dev/null +++ b/vendor/github.com/blacktear23/go-proxyprotocol/proxy_protocol_test.go @@ -0,0 +1,353 @@ +package proxyprotocol + +import ( + "bytes" + "encoding/binary" + "net" + "testing" + "time" + + . "github.com/pingcap/check" +) + +func Test(t *testing.T) { TestingT(t) } + +type ProxyProtocolTestSuite struct{} + +var _ = Suite(ProxyProtocolTestSuite{}) + +type mockBufferConn struct { + *bytes.Buffer + raddr net.Addr +} + +func newMockBufferConn(buffer *bytes.Buffer, raddr net.Addr) net.Conn { + return &mockBufferConn{ + Buffer: buffer, + raddr: raddr, + } +} + +func (c *mockBufferConn) Close() error { + return nil +} + +func (c *mockBufferConn) RemoteAddr() net.Addr { + if c.raddr != nil { + return c.raddr + } + addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:12345") + return addr +} + +func (c *mockBufferConn) LocalAddr() net.Addr { + addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:4000") + return addr +} + +func (c *mockBufferConn) SetDeadline(t time.Time) error { + return nil +} + +func (c *mockBufferConn) SetReadDeadline(t time.Time) error { + return nil +} + +func (c *mockBufferConn) SetWriteDeadline(t time.Time) error { + return nil +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolConnCheckAllowed(c *C) { + l, _ := newListener(nil, "*", 5) + raddr, _ := net.ResolveTCPAddr("tcp4", "192.168.1.100:8080") + c.Assert(l.checkAllowed(raddr), IsTrue) + l, _ = newListener(nil, "192.168.1.0/24,192.168.2.0/24", 5) + for _, ipstr := range []string{"192.168.1.100:8080", "192.168.2.100:8080"} { + raddr, _ := net.ResolveTCPAddr("tcp4", ipstr) + c.Assert(l.checkAllowed(raddr), IsTrue) + } + for _, ipstr := range []string{"192.168.3.100:8080", "192.168.4.100:8080"} { + raddr, _ := net.ResolveTCPAddr("tcp4", ipstr) + c.Assert(l.checkAllowed(raddr), IsFalse) + } +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolConnMustNotReadAnyDataAfterCLRF(c *C) { + buffer := []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data") + conn := newMockBufferConn(bytes.NewBuffer(buffer), nil) + + l, _ := newListener(nil, "*", 5) + wconn, err := l.createProxyProtocolConn(conn) + c.Assert(err, IsNil) + expectedString := "Other Data" + buf := make([]byte, 10) + n, _ := wconn.Read(buf) + c.Assert(n, Equals, 10) + c.Assert(string(buf[0:n]), Equals, expectedString) + + buffer = []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data") + conn = newMockBufferConn(bytes.NewBuffer(buffer), nil) + wconn, err = l.createProxyProtocolConn(conn) + c.Assert(err, IsNil) + buf = make([]byte, 5) + n, err = wconn.Read(buf) + c.Assert(err, IsNil) + c.Assert(n, Equals, 5) + c.Assert(string(buf[0:n]), Equals, "Other") + n, err = wconn.Read(buf) + c.Assert(err, IsNil) + c.Assert(n, Equals, 5) + c.Assert(string(buf[0:n]), Equals, " Data") + + buffer = []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data for a very long long long long long long long long long content") + expectedString = "Other Data for a very long long long long long long long long long content" + conn = newMockBufferConn(bytes.NewBuffer(buffer), nil) + wconn, err = l.createProxyProtocolConn(conn) + c.Assert(err, IsNil) + buf = make([]byte, 1024) + n, err = wconn.Read(buf) + c.Assert(err, IsNil) + c.Assert(string(buf[0:n]), Equals, expectedString) +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolV2ConnMustNotReadAnyDataAfterHeader(c *C) { + craddr, _ := net.ResolveTCPAddr("tcp4", "192.168.1.51:8080") + buffer := encodeProxyProtocolV2Header("tcp4", "192.168.1.100:5678", "192.168.1.5:4000") + expectedString := "Other Data" + buffer = append(buffer, []byte(expectedString)...) + l, _ := newListener(nil, "*", 5) + conn := newMockBufferConn(bytes.NewBuffer(buffer), craddr) + wconn, err := l.createProxyProtocolConn(conn) + buf := make([]byte, len(expectedString)) + n, err := wconn.Read(buf) + c.Assert(err, IsNil) + c.Assert(string(buf[0:n]), Equals, expectedString) +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolV1HeaderRead(c *C) { + buffer := []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data") + expectedString := "PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\n" + conn := newMockBufferConn(bytes.NewBuffer(buffer), nil) + wconn := &proxyProtocolConn{ + Conn: conn, + headerReadTimeout: 5, + } + ver, buf, err := wconn.readHeader() + c.Assert(err, IsNil) + c.Assert(ver, Equals, proxyProtocolV1) + c.Assert(string(buf), Equals, expectedString) +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolV1ExtractClientIP(c *C) { + craddr, _ := net.ResolveTCPAddr("tcp4", "192.168.1.51:8080") + tests := []struct { + buffer []byte + expectedIP string + expectedErr bool + }{ + { + buffer: []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data"), + expectedIP: "192.168.1.100:5678", + expectedErr: false, + }, + { + buffer: []byte("PROXY UNKNOWN 192.168.1.100 192.168.1.50 5678 3306\r\n"), + expectedIP: "192.168.1.51:8080", + expectedErr: false, + }, + { + buffer: []byte("PROXY TCP 192.168.1.100 192.168.1.50 5678 3306 3307\r\n"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306 jkasdjfkljaksldfjklajsdkfjsklafjldsafa"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY TCP4 192.168.1.100 192.168.1.50 5678 3306785478934785738275489275843728954782598345"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY TCP6 2001:0db8:85a3:0000:0000:8a2e:0370:7334 2001:0db8:85a3:0000:0000:8a2e:0390:7334 5678 3306\r\n"), + expectedIP: "[2001:db8:85a3::8a2e:370:7334]:5678", + expectedErr: false, + }, + { + buffer: []byte("this is a invalid header"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY MCP3 192.168.1.100 192.168.1.50 5678 3306\r\nOther Data"), + expectedIP: "", + expectedErr: true, + }, + { + buffer: []byte("PROXY UNKNOWN\r\n"), + expectedIP: "192.168.1.51:8080", + expectedErr: false, + }, + } + + l, _ := newListener(nil, "*", 5) + for _, t := range tests { + conn := newMockBufferConn(bytes.NewBuffer(t.buffer), craddr) + wconn, err := l.createProxyProtocolConn(conn) + if err == nil { + clientIP := wconn.RemoteAddr() + if t.expectedErr { + c.Assert(false, IsTrue, Commentf( + "Buffer:%s\nExpect Error", string(t.buffer))) + } + c.Assert(clientIP.String(), Equals, t.expectedIP, Commentf( + "Buffer:%s\nExpect: %s Got: %s", string(t.buffer), t.expectedIP, clientIP.String())) + } else { + if !t.expectedErr { + c.Assert(false, IsTrue, Commentf( + "Buffer:%s\nExpect %s But got Error: %v", string(t.buffer), t.expectedIP, err)) + } + } + } +} + +func encodeProxyProtocolV2Header(network, srcAddr, dstAddr string) []byte { + saddr, _ := net.ResolveTCPAddr(network, srcAddr) + daddr, _ := net.ResolveTCPAddr(network, dstAddr) + buffer := make([]byte, 1024) + copy(buffer, proxyProtocolV2Sig) + // Command + buffer[v2CmdPos] = 0x21 + // Famly + if network == "tcp4" { + buffer[v2FamlyPos] = 0x11 + binary.BigEndian.PutUint16(buffer[14:14+2], 12) + copy(buffer[16:16+4], []byte(saddr.IP.To4())) + copy(buffer[20:20+4], []byte(daddr.IP.To4())) + binary.BigEndian.PutUint16(buffer[24:24+2], uint16(saddr.Port)) + binary.BigEndian.PutUint16(buffer[26:26+2], uint16(saddr.Port)) + return buffer[0:28] + } else if network == "tcp6" { + buffer[v2FamlyPos] = 0x21 + binary.BigEndian.PutUint16(buffer[14:14+2], 36) + copy(buffer[16:16+16], []byte(saddr.IP.To16())) + copy(buffer[32:32+16], []byte(daddr.IP.To16())) + binary.BigEndian.PutUint16(buffer[48:48+2], uint16(saddr.Port)) + binary.BigEndian.PutUint16(buffer[50:50+2], uint16(saddr.Port)) + return buffer[0:52] + } + return buffer +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolV2HeaderRead(c *C) { + craddr, _ := net.ResolveTCPAddr("tcp4", "192.168.1.51:8080") + tests := []struct { + buffer []byte + expectedIP string + }{ + { + buffer: encodeProxyProtocolV2Header("tcp4", "192.168.1.100:5678", "192.168.1.5:4000"), + expectedIP: "192.168.1.100:5678", + }, + { + buffer: encodeProxyProtocolV2Header("tcp6", "[2001:db8:85a3::8a2e:370:7334]:5678", "[2001:db8:85a3::8a2e:370:8000]:4000"), + expectedIP: "[2001:db8:85a3::8a2e:370:7334]:5678", + }, + } + + l, _ := newListener(nil, "*", 5) + for _, t := range tests { + conn := newMockBufferConn(bytes.NewBuffer(t.buffer), craddr) + wconn, err := l.createProxyProtocolConn(conn) + clientIP := wconn.RemoteAddr() + if err == nil { + c.Assert(clientIP.String(), Equals, t.expectedIP, Commentf( + "Buffer:%v\nExpect: %s Got: %s", t.buffer, t.expectedIP, clientIP.String(), + )) + } else { + c.Assert(false, IsTrue, Commentf( + "Buffer:%v\nExpect: %s Got Error: %v", t.buffer, t.expectedIP, err, + )) + } + } +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolV2HeaderReadLocalCommand(c *C) { + craddr, _ := net.ResolveTCPAddr("tcp4", "192.168.1.51:8080") + buffer := encodeProxyProtocolV2Header("tcp4", "192.168.1.100:5678", "192.168.1.5:4000") + buffer[v2CmdPos] = 0x20 + l, _ := newListener(nil, "*", 5) + conn := newMockBufferConn(bytes.NewBuffer(buffer), craddr) + wconn, err := l.createProxyProtocolConn(conn) + clientIP := wconn.RemoteAddr() + c.Assert(err, IsNil) + c.Assert(clientIP.String(), Equals, craddr.String(), Commentf( + "Buffer:%v\nExpected: %s Got: %s", buffer, craddr.String(), clientIP.String(), + )) +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolListenerReadHeaderTimeout(c *C) { + addr := "127.0.0.1:18080" + go func() { + l, err := net.Listen("tcp", addr) + c.Assert(err, IsNil) + ppl, err := NewListener(l, "*", 1) + c.Assert(err, IsNil) + defer ppl.Close() + + conn, err := ppl.Accept() + c.Assert(conn, IsNil) + c.Assert(err, Equals, ErrHeaderReadTimeout) + }() + + conn, err := net.Dial("tcp", addr) + c.Assert(err, IsNil) + time.Sleep(2 * time.Second) + conn.Close() +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolListenerProxyNotAllowed(c *C) { + addr := "127.0.0.1:18080" + go func() { + l, err := net.Listen("tcp", addr) + c.Assert(err, IsNil) + ppl, err := NewListener(l, "192.168.1.1", 1) + c.Assert(err, IsNil) + defer ppl.Close() + + conn, err := ppl.Accept() + c.Assert(conn, IsNil) + c.Assert(err, Equals, ErrProxyAddressNotAllowed) + }() + + conn, err := net.Dial("tcp", addr) + c.Assert(err, IsNil) + time.Sleep(2 * time.Second) + conn.Close() +} + +func (ts ProxyProtocolTestSuite) TestProxyProtocolListenerCloseInOtherGoroutine(c *C) { + addr := "127.0.0.1:18081" + l, err := net.Listen("tcp", addr) + c.Assert(err, IsNil) + ppl, err := NewListener(l, "*", 1) + c.Assert(err, IsNil) + go func() { + conn, err := ppl.Accept() + c.Assert(conn, IsNil) + opErr, ok := err.(*net.OpError) + c.Assert(ok, IsTrue) + c.Assert(opErr.Err.Error(), Equals, "use of closed network connection") + }() + + time.Sleep(1 * time.Second) + ppl.Close() + time.Sleep(2 * time.Second) +} diff --git a/vendor/github.com/codahale/hdrhistogram/.travis.yml b/vendor/github.com/codahale/hdrhistogram/.travis.yml new file mode 100644 index 0000000000000..7960fc95b865d --- /dev/null +++ b/vendor/github.com/codahale/hdrhistogram/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - 1.5 + - 1.6 + - tip diff --git a/vendor/github.com/codahale/hdrhistogram/README.md b/vendor/github.com/codahale/hdrhistogram/README.md new file mode 100644 index 0000000000000..614b197c3dd3a --- /dev/null +++ b/vendor/github.com/codahale/hdrhistogram/README.md @@ -0,0 +1,15 @@ +hdrhistogram +============ + +[![Build Status](https://travis-ci.org/codahale/hdrhistogram.png?branch=master)](https://travis-ci.org/codahale/hdrhistogram) + +A pure Go implementation of the [HDR Histogram](https://github.com/HdrHistogram/HdrHistogram). + +> A Histogram that supports recording and analyzing sampled data value counts +> across a configurable integer value range with configurable value precision +> within the range. Value precision is expressed as the number of significant +> digits in the value recording, and provides control over value quantization +> behavior across the value range and the subsequent value resolution at any +> given level. + +For documentation, check [godoc](http://godoc.org/github.com/codahale/hdrhistogram). diff --git a/vendor/github.com/codahale/hdrhistogram/hdr_test.go b/vendor/github.com/codahale/hdrhistogram/hdr_test.go new file mode 100644 index 0000000000000..309f0ea896978 --- /dev/null +++ b/vendor/github.com/codahale/hdrhistogram/hdr_test.go @@ -0,0 +1,388 @@ +package hdrhistogram_test + +import ( + "math" + "reflect" + "testing" + + "github.com/codahale/hdrhistogram" +) + +func TestHighSigFig(t *testing.T) { + input := []int64{ + 459876, 669187, 711612, 816326, 931423, 1033197, 1131895, 2477317, + 3964974, 12718782, + } + + hist := hdrhistogram.New(459876, 12718782, 5) + for _, sample := range input { + hist.RecordValue(sample) + } + + if v, want := hist.ValueAtQuantile(50), int64(1048575); v != want { + t.Errorf("Median was %v, but expected %v", v, want) + } +} + +func TestValueAtQuantile(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + data := []struct { + q float64 + v int64 + }{ + {q: 50, v: 500223}, + {q: 75, v: 750079}, + {q: 90, v: 900095}, + {q: 95, v: 950271}, + {q: 99, v: 990207}, + {q: 99.9, v: 999423}, + {q: 99.99, v: 999935}, + } + + for _, d := range data { + if v := h.ValueAtQuantile(d.q); v != d.v { + t.Errorf("P%v was %v, but expected %v", d.q, v, d.v) + } + } +} + +func TestMean(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + if v, want := h.Mean(), 500000.013312; v != want { + t.Errorf("Mean was %v, but expected %v", v, want) + } +} + +func TestStdDev(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + if v, want := h.StdDev(), 288675.1403682715; v != want { + t.Errorf("StdDev was %v, but expected %v", v, want) + } +} + +func TestTotalCount(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + if v, want := h.TotalCount(), int64(i+1); v != want { + t.Errorf("TotalCount was %v, but expected %v", v, want) + } + } +} + +func TestMax(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + if v, want := h.Max(), int64(1000447); v != want { + t.Errorf("Max was %v, but expected %v", v, want) + } +} + +func TestReset(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + h.Reset() + + if v, want := h.Max(), int64(0); v != want { + t.Errorf("Max was %v, but expected %v", v, want) + } +} + +func TestMerge(t *testing.T) { + h1 := hdrhistogram.New(1, 1000, 3) + h2 := hdrhistogram.New(1, 1000, 3) + + for i := 0; i < 100; i++ { + if err := h1.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + for i := 100; i < 200; i++ { + if err := h2.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + h1.Merge(h2) + + if v, want := h1.ValueAtQuantile(50), int64(99); v != want { + t.Errorf("Median was %v, but expected %v", v, want) + } +} + +func TestMin(t *testing.T) { + h := hdrhistogram.New(1, 10000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + if v, want := h.Min(), int64(0); v != want { + t.Errorf("Min was %v, but expected %v", v, want) + } +} + +func TestByteSize(t *testing.T) { + h := hdrhistogram.New(1, 100000, 3) + + if v, want := h.ByteSize(), 65604; v != want { + t.Errorf("ByteSize was %v, but expected %d", v, want) + } +} + +func TestRecordCorrectedValue(t *testing.T) { + h := hdrhistogram.New(1, 100000, 3) + + if err := h.RecordCorrectedValue(10, 100); err != nil { + t.Fatal(err) + } + + if v, want := h.ValueAtQuantile(75), int64(10); v != want { + t.Errorf("Corrected value was %v, but expected %v", v, want) + } +} + +func TestRecordCorrectedValueStall(t *testing.T) { + h := hdrhistogram.New(1, 100000, 3) + + if err := h.RecordCorrectedValue(1000, 100); err != nil { + t.Fatal(err) + } + + if v, want := h.ValueAtQuantile(75), int64(800); v != want { + t.Errorf("Corrected value was %v, but expected %v", v, want) + } +} + +func TestCumulativeDistribution(t *testing.T) { + h := hdrhistogram.New(1, 100000000, 3) + + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + actual := h.CumulativeDistribution() + expected := []hdrhistogram.Bracket{ + hdrhistogram.Bracket{Quantile: 0, Count: 1, ValueAt: 0}, + hdrhistogram.Bracket{Quantile: 50, Count: 500224, ValueAt: 500223}, + hdrhistogram.Bracket{Quantile: 75, Count: 750080, ValueAt: 750079}, + hdrhistogram.Bracket{Quantile: 87.5, Count: 875008, ValueAt: 875007}, + hdrhistogram.Bracket{Quantile: 93.75, Count: 937984, ValueAt: 937983}, + hdrhistogram.Bracket{Quantile: 96.875, Count: 969216, ValueAt: 969215}, + hdrhistogram.Bracket{Quantile: 98.4375, Count: 984576, ValueAt: 984575}, + hdrhistogram.Bracket{Quantile: 99.21875, Count: 992256, ValueAt: 992255}, + hdrhistogram.Bracket{Quantile: 99.609375, Count: 996352, ValueAt: 996351}, + hdrhistogram.Bracket{Quantile: 99.8046875, Count: 998400, ValueAt: 998399}, + hdrhistogram.Bracket{Quantile: 99.90234375, Count: 999424, ValueAt: 999423}, + hdrhistogram.Bracket{Quantile: 99.951171875, Count: 999936, ValueAt: 999935}, + hdrhistogram.Bracket{Quantile: 99.9755859375, Count: 999936, ValueAt: 999935}, + hdrhistogram.Bracket{Quantile: 99.98779296875, Count: 999936, ValueAt: 999935}, + hdrhistogram.Bracket{Quantile: 99.993896484375, Count: 1000000, ValueAt: 1000447}, + hdrhistogram.Bracket{Quantile: 100, Count: 1000000, ValueAt: 1000447}, + } + + if !reflect.DeepEqual(actual, expected) { + t.Errorf("CF was %#v, but expected %#v", actual, expected) + } +} + +func TestDistribution(t *testing.T) { + h := hdrhistogram.New(8, 1024, 3) + + for i := 0; i < 1024; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + actual := h.Distribution() + if len(actual) != 128 { + t.Errorf("Number of bars seen was %v, expected was 128", len(actual)) + } + for _, b := range actual { + if b.Count != 8 { + t.Errorf("Count per bar seen was %v, expected was 8", b.Count) + } + } +} + +func TestNaN(t *testing.T) { + h := hdrhistogram.New(1, 100000, 3) + if math.IsNaN(h.Mean()) { + t.Error("mean is NaN") + } + if math.IsNaN(h.StdDev()) { + t.Error("stddev is NaN") + } +} + +func TestSignificantFigures(t *testing.T) { + const sigFigs = 4 + h := hdrhistogram.New(1, 10, sigFigs) + if h.SignificantFigures() != sigFigs { + t.Errorf("Significant figures was %v, expected %d", h.SignificantFigures(), sigFigs) + } +} + +func TestLowestTrackableValue(t *testing.T) { + const minVal = 2 + h := hdrhistogram.New(minVal, 10, 3) + if h.LowestTrackableValue() != minVal { + t.Errorf("LowestTrackableValue figures was %v, expected %d", h.LowestTrackableValue(), minVal) + } +} + +func TestHighestTrackableValue(t *testing.T) { + const maxVal = 11 + h := hdrhistogram.New(1, maxVal, 3) + if h.HighestTrackableValue() != maxVal { + t.Errorf("HighestTrackableValue figures was %v, expected %d", h.HighestTrackableValue(), maxVal) + } +} + +func BenchmarkHistogramRecordValue(b *testing.B) { + h := hdrhistogram.New(1, 10000000, 3) + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + b.Fatal(err) + } + } + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + h.RecordValue(100) + } +} + +func BenchmarkNew(b *testing.B) { + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + hdrhistogram.New(1, 120000, 3) // this could track 1ms-2min + } +} + +func TestUnitMagnitudeOverflow(t *testing.T) { + h := hdrhistogram.New(0, 200, 4) + if err := h.RecordValue(11); err != nil { + t.Fatal(err) + } +} + +func TestSubBucketMaskOverflow(t *testing.T) { + hist := hdrhistogram.New(2e7, 1e8, 5) + for _, sample := range [...]int64{1e8, 2e7, 3e7} { + hist.RecordValue(sample) + } + + for q, want := range map[float64]int64{ + 50: 33554431, + 83.33: 33554431, + 83.34: 100663295, + 99: 100663295, + } { + if got := hist.ValueAtQuantile(q); got != want { + t.Errorf("got %d for %fth percentile. want: %d", got, q, want) + } + } +} + +func TestExportImport(t *testing.T) { + min := int64(1) + max := int64(10000000) + sigfigs := 3 + h := hdrhistogram.New(min, max, sigfigs) + for i := 0; i < 1000000; i++ { + if err := h.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + s := h.Export() + + if v := s.LowestTrackableValue; v != min { + t.Errorf("LowestTrackableValue was %v, but expected %v", v, min) + } + + if v := s.HighestTrackableValue; v != max { + t.Errorf("HighestTrackableValue was %v, but expected %v", v, max) + } + + if v := int(s.SignificantFigures); v != sigfigs { + t.Errorf("SignificantFigures was %v, but expected %v", v, sigfigs) + } + + if imported := hdrhistogram.Import(s); !imported.Equals(h) { + t.Error("Expected Histograms to be equivalent") + } + +} + +func TestEquals(t *testing.T) { + h1 := hdrhistogram.New(1, 10000000, 3) + for i := 0; i < 1000000; i++ { + if err := h1.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + h2 := hdrhistogram.New(1, 10000000, 3) + for i := 0; i < 10000; i++ { + if err := h1.RecordValue(int64(i)); err != nil { + t.Fatal(err) + } + } + + if h1.Equals(h2) { + t.Error("Expected Histograms to not be equivalent") + } + + h1.Reset() + h2.Reset() + + if !h1.Equals(h2) { + t.Error("Expected Histograms to be equivalent") + } +} diff --git a/vendor/github.com/codahale/hdrhistogram/window_test.go b/vendor/github.com/codahale/hdrhistogram/window_test.go new file mode 100644 index 0000000000000..7e787588af90e --- /dev/null +++ b/vendor/github.com/codahale/hdrhistogram/window_test.go @@ -0,0 +1,64 @@ +package hdrhistogram_test + +import ( + "testing" + + "github.com/codahale/hdrhistogram" +) + +func TestWindowedHistogram(t *testing.T) { + w := hdrhistogram.NewWindowed(2, 1, 1000, 3) + + for i := 0; i < 100; i++ { + w.Current.RecordValue(int64(i)) + } + w.Rotate() + + for i := 100; i < 200; i++ { + w.Current.RecordValue(int64(i)) + } + w.Rotate() + + for i := 200; i < 300; i++ { + w.Current.RecordValue(int64(i)) + } + + if v, want := w.Merge().ValueAtQuantile(50), int64(199); v != want { + t.Errorf("Median was %v, but expected %v", v, want) + } +} + +func BenchmarkWindowedHistogramRecordAndRotate(b *testing.B) { + w := hdrhistogram.NewWindowed(3, 1, 10000000, 3) + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + if err := w.Current.RecordValue(100); err != nil { + b.Fatal(err) + } + + if i%100000 == 1 { + w.Rotate() + } + } +} + +func BenchmarkWindowedHistogramMerge(b *testing.B) { + w := hdrhistogram.NewWindowed(3, 1, 10000000, 3) + for i := 0; i < 10000000; i++ { + if err := w.Current.RecordValue(100); err != nil { + b.Fatal(err) + } + + if i%100000 == 1 { + w.Rotate() + } + } + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + w.Merge() + } +} diff --git a/vendor/github.com/coreos/etcd/.dockerignore b/vendor/github.com/coreos/etcd/.dockerignore new file mode 100644 index 0000000000000..6b8710a711f3b --- /dev/null +++ b/vendor/github.com/coreos/etcd/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/vendor/github.com/coreos/etcd/.gitignore b/vendor/github.com/coreos/etcd/.gitignore new file mode 100644 index 0000000000000..1a68387a7db71 --- /dev/null +++ b/vendor/github.com/coreos/etcd/.gitignore @@ -0,0 +1,22 @@ +/agent-* +/coverage +/covdir +/gopath +/gopath.proto +/go-bindata +/release +/machine* +/bin +.Dockerfile-test +.vagrant +*.etcd +*.log +/etcd +*.swp +/hack/insta-discovery/.env +*.test +tools/functional-tester/docker/bin +hack/scripts-dev/docker-dns/.Dockerfile +hack/scripts-dev/docker-dns-srv/.Dockerfile +hack/tls-setup/certs +.idea diff --git a/vendor/github.com/coreos/etcd/.godir b/vendor/github.com/coreos/etcd/.godir new file mode 100644 index 0000000000000..00ff6aa802e28 --- /dev/null +++ b/vendor/github.com/coreos/etcd/.godir @@ -0,0 +1 @@ +github.com/coreos/etcd diff --git a/vendor/github.com/coreos/etcd/.header b/vendor/github.com/coreos/etcd/.header new file mode 100644 index 0000000000000..0446af6d87763 --- /dev/null +++ b/vendor/github.com/coreos/etcd/.header @@ -0,0 +1,13 @@ +// Copyright 2016 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/vendor/github.com/coreos/etcd/.semaphore.sh b/vendor/github.com/coreos/etcd/.semaphore.sh new file mode 100644 index 0000000000000..e7d80eb1b88cb --- /dev/null +++ b/vendor/github.com/coreos/etcd/.semaphore.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +TEST_SUFFIX=$(date +%s | base64 | head -c 15) + +TEST_OPTS="PASSES='build unit release integration_e2e functional' MANUAL_VER=v3.2.17" +if [ "$TEST_ARCH" == "386" ]; then + TEST_OPTS="GOARCH=386 PASSES='build unit integration_e2e'" +fi + +docker run \ + --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd \ + gcr.io/etcd-development/etcd-test:go1.8.7 \ + /bin/bash -c "${TEST_OPTS} ./test 2>&1 | tee test-${TEST_SUFFIX}.log" + +! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-${TEST_SUFFIX}.log diff --git a/vendor/github.com/coreos/etcd/.travis.yml b/vendor/github.com/coreos/etcd/.travis.yml new file mode 100644 index 0000000000000..2c4ff0e0541f7 --- /dev/null +++ b/vendor/github.com/coreos/etcd/.travis.yml @@ -0,0 +1,89 @@ +language: go +go_import_path: github.com/coreos/etcd + +sudo: required + +services: docker + +go: +- "1.8.7" +- tip + +notifications: + on_success: never + on_failure: never + +env: + matrix: + - TARGET=amd64 + - TARGET=amd64-go-tip + - TARGET=darwin-amd64 + - TARGET=windows-amd64 + - TARGET=arm64 + - TARGET=arm + - TARGET=386 + - TARGET=ppc64le + +matrix: + fast_finish: true + allow_failures: + - go: tip + env: TARGET=amd64-go-tip + exclude: + - go: "1.8.7" + env: TARGET=amd64-go-tip + - go: tip + env: TARGET=amd64 + - go: tip + env: TARGET=darwin-amd64 + - go: tip + env: TARGET=windows-amd64 + - go: tip + env: TARGET=arm + - go: tip + env: TARGET=arm64 + - go: tip + env: TARGET=386 + - go: tip + env: TARGET=ppc64le + +before_install: +- if [[ $TRAVIS_GO_VERSION == 1.* ]]; then docker pull gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION}; fi + +install: +- pushd cmd/etcd && go get -t -v ./... && popd + +script: + - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}" + - > + case "${TARGET}" in + amd64) + docker run --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ + /bin/bash -c "GOARCH=amd64 ./test" + ;; + amd64-go-tip) + GOARCH=amd64 ./test + ;; + darwin-amd64) + docker run --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ + /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOOS=darwin GOARCH=amd64 ./build" + ;; + windows-amd64) + docker run --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ + /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOOS=windows GOARCH=amd64 ./build" + ;; + 386) + docker run --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ + /bin/bash -c "GOARCH=386 PASSES='build unit' ./test" + ;; + *) + # test building out of gopath + docker run --rm \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ + /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOARCH='${TARGET}' ./build" + ;; + esac diff --git a/vendor/github.com/coreos/etcd/CONTRIBUTING.md b/vendor/github.com/coreos/etcd/CONTRIBUTING.md new file mode 100644 index 0000000000000..635f73a3056d9 --- /dev/null +++ b/vendor/github.com/coreos/etcd/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# How to contribute + +etcd is Apache 2.0 licensed and accepts contributions via GitHub pull requests. This document outlines some of the conventions on commit message formatting, contact points for developers, and other resources to help get contributions into etcd. + +# Email and chat + +- Email: [etcd-dev](https://groups.google.com/forum/?hl=en#!forum/etcd-dev) +- IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org + +## Getting started + +- Fork the repository on GitHub +- Read the README.md for build instructions + +## Reporting bugs and creating issues + +Reporting bugs is one of the best ways to contribute. However, a good bug report has some very specific qualities, so please read over our short document on [reporting bugs](https://github.com/coreos/etcd/blob/master/Documentation/reporting_bugs.md) before submitting a bug report. This document might contain links to known issues, another good reason to take a look there before reporting a bug. + +## Contribution flow + +This is a rough outline of what a contributor's workflow looks like: + +- Create a topic branch from where to base the contribution. This is usually master. +- Make commits of logical units. +- Make sure commit messages are in the proper format (see below). +- Push changes in a topic branch to a personal fork of the repository. +- Submit a pull request to coreos/etcd. +- The PR must receive a LGTM from two maintainers found in the MAINTAINERS file. + +Thanks for contributing! + +### Code style + +The coding style suggested by the Golang community is used in etcd. See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details. + +Please follow this style to make etcd easy to review, maintain and develop. + +### Format of the commit message + +We follow a rough convention for commit messages that is designed to answer two +questions: what changed and why. The subject line should feature the what and +the body of the commit should describe the why. + +``` +scripts: add the test-cluster command + +this uses tmux to setup a test cluster that can easily be killed and started for debugging. + +Fixes #38 +``` + +The format can be described more formally as follows: + +``` +: + + + +