Giter VIP home page Giter VIP logo

aws-dax-go's Introduction

AWS DAX SDK for Go

aws-dax-go is the official AWS DAX SDK for the Go programming language. https://aws.amazon.com/dynamodb/dax

Checkout our release notes for information about the latest bug fixes, updates, and features added to the SDK.

Getting started

The best way to get started working with the SDK is to use go get to add the SDK to your Go Workspace manually.

go get github.com/aws/aws-dax-go

You could also use Dep to add the SDK to your application's dependencies. Using Dep will simplify your update story and help your application keep pinned to a specific version of the SDK.

dep ensure -add github.com/aws/aws-dax-go

Making API requests

This example shows how you can use the AWS DAX SDK to make an API request.

package main

import (
	"fmt"
	"github.com/aws/aws-dax-go/dax"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/dynamodb"
)

func main() {
	
	cfg := dax.DefaultConfig()
	cfg.HostPorts = []string{"dax://mycluster.frfx8h.clustercfg.dax.usw2.amazonaws.com:8111"}
	cfg.Region = "us-west-2"
	client, err := dax.New(cfg)

	if err != nil {
		panic(fmt.Errorf("unable to initialize client %v", err))
	}
	
	
	//Connecion to a secure cluster
	secureEndpoint := "daxs://mycluster.frfx8h.clustercfg.dax.usw2.amazonaws.com"
	secureCfg := dax.DefaultConfig()
	secureCfg.HostPorts = []string{secureEndpoint}
	secureCfg.Region = "us-west-2"
	
	//WARN: Skip hostname verification of TLS connections. 
	//The default is to perform hostname verification, setting this to True will skip verification. 
	//Be sure you understand the implication of doing so, which is the inability to authenticate
	//the cluster that you are connecting to.
	secureCfg.SkipHostnameVerification = false
	
	// DialContext is an optional field in Config.
	// If DialContext is being set in Config for a secure/ encrypted cluster, then use dax.SecureDialContext to 
	// return DialContext. An example of how DailContext can be set using dax.SecureDialContext is shown below.
	secureCfg.DialContext = func(ctx context.Context, network string, address string) (net.Conn, error) {
		//    fmt.Println("Write your custom logic here")
		dialCon, err := dax.SecureDialContext(secureEndpoint, secureCfg.SkipHostnameVerification)
		if err != nil {
			panic(fmt.Errorf("secure dialcontext creation failed %v", err))
		}
		return dialCon(ctx, network, address)
	}
	secureClient, err := dax.New(secureCfg)
	if err != nil {
		panic(fmt.Errorf("unable to initialize client %v", err))
	}
	fmt.Println("secure client created", secureClient)
	
	

	input := &dynamodb.PutItemInput{
		TableName: aws.String("TryDaxGoTable"),
		Item: map[string]*dynamodb.AttributeValue{
			"pk":    {S: aws.String("mykey")},
			"sk":    {N: aws.String("0")},
			"value": {S: aws.String("myvalue")},
		},
	}

	output, err := client.PutItem(input)
	if err != nil {
		panic(fmt.Errorf("unable to make request %v", err))
	}

	fmt.Println("Output: ", output)
}

Feedback and contributing

GitHub issues: To provide feedback or report bugs, file GitHub Issues on the SDK. This is the preferred mechanism to give feedback so that other users can engage in the conversation, +1 issues, etc. Issues you open will be evaluated, and included in our roadmap.

Contributing: You can open pull requests for fixes or additions to the AWS DAX SDK for Go. All pull requests must be submitted under the Apache 2.0 license and will be reviewed by an SDK team member before being merged in. Accompanying unit tests, where possible, are appreciated.

License

This library is licensed under the Apache 2.0 License.

aws-dax-go's People

Contributors

amsrnjn avatar anandsas avatar fvasily avatar jdhardy avatar jpeddicord avatar kevinchristen avatar kevioke avatar lyaoxion avatar sumitsa-amazon avatar tanshree avatar vasilyfomin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-dax-go's Issues

nil pointer dereference in internal/client

We've been seeing a few occasional panics while our system is under load:

runtime error: invalid memory address or nil pointer dereference: goroutine 9430 [running]:
panic(0x16cbc80, 0xd21fae0)
  /usr/local/go/src/runtime/panic.go:513 +0x1b9
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*tube).setDeadline(0x0, 0xbf08a153284f8695, 0x3f89c397be, 0xd2abd60, 0x1, 0xbd7d6a0)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/tube.go:103 +0x22
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*tubePool).setDeadline(0xc0009a44e0, 0x0, 0xbd7d6a0, 0xc02136dd40, 0xc02136dd40, 0x0)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/tubepool.go:211 +0xe4
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*SingleDaxClient).executeWithContext(0xc000826730, 0x7f34e9724728, 0xc02136dd40, 0x1968d2c, 0x7, 0xc02136dda0, 0xc020733ab0, 0xc009b3bb80, 0x203008)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/single.go:638 +0x17e
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*SingleDaxClient).executeWithRetries(0xc000826730, 0x1968d2c, 0x7, 0x0, 0xbd6cf60, 0xc00000e020, 0x0, 0x0, 0x0, 0x7f34e9724728, ...)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/single.go:612 +0x16d
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*SingleDaxClient).GetItemWithOptions(0xc000826730, 0xc0167bd950, 0xc014b44c10, 0x0, 0xbd6cf60, 0xc00000e020, 0x0, 0x0, 0x0, 0x7f34e9724728, ...)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/single.go:286 +0x1ed
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*ClusterDaxClient).GetItemWithOptions.func1(0xbd8c740, 0xc000826730, 0x0, 0xbd6cf60, 0xc00000e020, 0x0, 0x0, 0x0, 0x7f34e9724728, 0xc02136dd40, ...)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/cluster.go:208 +0xa0
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*ClusterDaxClient).retry(0xc0009a4660, 0x1968d2c, 0x7, 0xc02113c9a0, 0x0, 0xbd6cf60, 0xc00000e020, 0x0, 0x0, 0x0, ...)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/cluster.go:309 +0x430
theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client.(*ClusterDaxClient).GetItemWithOptions(0xc0009a4660, 0xc0167bd950, 0xc014b44c10, 0x0, 0xbd6cf60, 0xc00000e020, 0x0, 0x2, 0x0, 0x7f34e9724728, ...)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/internal/client/cluster.go:211 +0x124
theproject/vendor/github.com/aws/aws-dax-go/dax.(*Dax).GetItemWithContext(0xc0004063f0, 0x0, 0x0, 0xc0167bd950, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/api.go:116 +0x201
theproject/vendor/github.com/aws/aws-dax-go/dax.(*Dax).GetItem(0xc0004063f0, 0xc0167bd950, 0x0, 0x0, 0x0)
  /go/src/theproject/vendor/github.com/aws/aws-dax-go/dax/api.go:105 +0x4b

Sorry I don't have more info at the moment. I'm hoping the error will be apparent to someone familiar with the codebase before I dig deeper.

Cannot create DAX client with session - InvalidParameter: custom handlers not supported

I'm trying to create a DAX client with dax.NewWithSession using the same session I use for creating a dynamo client. I can confirm it works with dynamo.

Sample

sess, err := GetSession()
if err != nil {
	return nil, err
}
if useDAX {
	svc, err = dax.NewWithSession(sess)
} else {
	svc = dynamodb.New(sess)
}

this is the error I have when calling dax.NewWithSession

InvalidParameter: custom handlers not supported

If you read the code from aws-dax-go that error comes from client.ValidateHandlers

What should we do to create a new DAX client using our aws session?

Env

github.com/aws/aws-dax-go v1.1.1
github.com/aws/aws-sdk-go v1.19.48

Projection Expression parsing bug

Hi, I am using Expression Builder to create the Expression for QueryInput. I noticed that Expression Builder Projection delimits with comma and space, eg. "#1, #2".

As a result, when there is more than 1 projection, the output is incorrect.

Below is an example of QueryOutput.Items
[ { " #2": { "B": null, "BOOL": null, "BS": null, "L": null, "M": null, "N": null, "NS": null, "NULL": null, "S": "0f3028a2-ee87-447e-9a7a-ee2d94798934", "SS": null }, "ID": { "B": null, "BOOL": null, "BS": null, "L": null, "M": null, "N": null, "NS": null, "NULL": null, "S": "9bbef19476623ca56c17da75fd57734dbf82530686043a6e491c6d71befe8f6e", "SS": null } } ]

The value of expr.Names() is { "#0": "RepoID", "#1": "ID", "#2": "TokenID" }
The value of expr.Projection() is #1, #2

The same Expression Builder works without DAX.

Edit: A workaround I am currently using is to specify ProjectionExpression without using Expression Builder

Plans for new point release?

Any plans to release a new v1 release w/ #9?

Currently if we try to use newer versions of the aws-go-sdk w/ the dax SDK we get this compilation error:

# github.com/INFURA/inf-reverse-proxy/vendor/github.com/aws/aws-dax-go/dax
vendor/github.com/aws/aws-dax-go/dax/service.go:129:5: cannot use (*Dax)(nil) (type *Dax) as type dynamodbiface.DynamoDBAPI in assignment:
	*Dax does not implement dynamodbiface.DynamoDBAPI (missing DescribeEndpoints method)

Our workaround is either to pin to an old version of aws-sdk-go or to use the aws-dax-sdk version from master, but would prefer to use recent official releases for both packages.

Nil de-reference panic from nil Retryer object passed during dax request construction

We are seeing a nil dereference panic due to a bug in the dax internal client (version v1.1.2) that causes a process to panic when receiving any HTTP errors from usage of the client. In this case, aws-sdk-go attempts to log debug information when errors are present on the request object and it attempts to de-reference a nil field on the Request object constructed in dax client code here:
https://github.com/aws/aws-dax-go/blob/master/dax/internal/client/cluster.go#L255

The nil parameter is the retryer assigned to the embedded Retryer field of Request, which is what provides the method that is being called when the nil dereference panic happens in aws-sdk-go on line https://github.com/aws/aws-sdk-go/blob/master/aws/request/request.go#L557.

Seems like there are two potential solutions:

  1. In aws-dax-go, change this line to pass in awsapi.NoAWSRetry{} instead of nil if consumers do not provide a retryer object of their own (and just use that one if they do):
    https://github.com/aws/aws-dax-go/blob/master/dax/internal/client/cluster.go#L255
  2. In aws-sdk-go, ensure that all accesses of r.MaxRetries() only happen if aws.BoolValue(r.Retryable) is true like they do elsewhere.
    https://github.com/aws/aws-sdk-go/blob/master/aws/request/request.go#L557

A fix in both places would be great so we can upgrade each library independently and flexibly .

aws-dax-go vs aws-sdk-go/service/dax

I looked around for information about the difference between these two libraries that seem to achieve the same thing? Is there any documentation about the difference between the two?

NewConfigWithSession sets Config.ReadRetries to -1

When I initialize dax.Config with using NewConfigWIthSession like below,
Config.ReadRetries becomes -1.

sess := session.Must(session.NewSession())
cfg := dax.NewConfigWithSession(*sess)
db := dax.New(cfg)

In this case, a dax client does not attempt any request without errors when I call GetItem or other methods.

Is this project alive?

I dont see much activity plus my first attempt on a Go project using modules fails on import errors

# github.com/aws/aws-dax-go/dax
vendor/github.com/aws/aws-dax-go/dax/api.go:572:38: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:572:77: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:576:45: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:576:102: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:580:62: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:580:120: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:584:31: undefined: dynamodb.DescribeExportInput
vendor/github.com/aws/aws-dax-go/dax/api.go:584:63: undefined: dynamodb.DescribeExportOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:55: undefined: dynamodb.DescribeExportInput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:106: undefined: dynamodb.DescribeExportOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:106: too many errors

image

Is this the best way to use DAX with Golang?

Reusing aws session with a different endpoint.

With github.com/aws/aws-sdk-go/service/dax you were able to just re-use the existing aws session and override the endpoint as follows,

// Create a DAX client with additional configuration
svc := dax.New(mySession, aws.NewConfig().WithEndpoint("http://localhost:4569"))

But,in aws/aws-dax-go we need to either create a new config or reuse the session completely. There's no way to provide just the session and an additional endpoint.

To be clear, I don't want to initialize the session with an endpoint explicitly as I would like to add the endpoint as an additional configuration while initializing the service clients. Is there a way this can be done?

Implement retries on "unknown errors"

See

func (r DaxRetryer) ShouldRetry(req *request.Request) bool {
daxErr := req.Error.(daxError)
codes := daxErr.CodeSequence()
return len(codes) > 0 && (codes[0] == 1 || codes[0] == 2) || req.IsErrorThrottle() || isAuthCRequiredException(codes)
}

It is not clear to me what code this error has:

return awserr.NewRequestFailure(awserr.New(ErrCodeUnknown, e.Message(), nil), e.StatusCode(), e.RequestID())

But from what i'm seeing in my application, which is calling TransactWriteItemsWithContext, DAX is not retrying on this specific error. I think it should.

Or do you recommend us implementing a retrier?

RequestTimeout is not respected when API is called with context

We have set the RequestTimeout to 75ms in our DAX client. However, when TCP connection is re-establshed, we still see some DAX request in the 6s range (which based on our discussion with AWS team are caused by connection being re-established).

Looking at the Go SDK, it appears that the issue is due to SDK not respecting the request timeout if it is called with context.

See

if ctx == nil && c.RequestTimeout > 0 {

Please note that we use QueryWithContext as per https://pkg.go.dev/github.com/zabawaba99/aws-dax-go/dax#Dax.QueryWithContext.

DAX Interface does not implement new `dynamodbiface.DynamoDBAPI` functions

The following functions have been introduced to the dynamodbiface.DynamoDBAPI interface in version 1.50.0:

UpdateKinesisStreamingDestination(*dynamodb.UpdateKinesisStreamingDestinationInput) (*dynamodb.UpdateKinesisStreamingDestinationOutput, error)
UpdateKinesisStreamingDestinationWithContext(aws.Context, *dynamodb.UpdateKinesisStreamingDestinationInput, ...request.Option) (*dynamodb.UpdateKinesisStreamingDestinationOutput, error)
UpdateKinesisStreamingDestinationRequest(*dynamodb.UpdateKinesisStreamingDestinationInput) (*request.Request, *dynamodb.UpdateKinesisStreamingDestinationOutput)

Without these functions implemented, the DAX client cannot be used as a drop-in replacement for a DynamoDB client.

aws-sdk-go-v2 support

Are there any plans to release a version of this client that support aws-sdk-go-v2 ? At present it requires plain old aws-sdk-go

We had work simultaneously underway to upgrade our go libs to v2 and to support DAX and now we have conflicting PRs. Obviously we'll have to put the v2 upgrade on hold to support DAX for now, I'm just wondering if there's a timeframe, or if it's even on the radar.

Document configuration options

Can you please add comments to each Configuration parameter explaining what it does and what are the recommended values?

type Config struct {
MaxPendingConnectionsPerHost int
ClusterUpdateThreshold time.Duration
ClusterUpdateInterval time.Duration
IdleConnectionReapDelay time.Duration
ClientHealthCheckInterval time.Duration
HostPorts []string
Region string
Credentials *credentials.Credentials
DialContext func(ctx context.Context, network string, address string) (net.Conn, error)
connConfig connConfig
SkipHostnameVerification bool
logger aws.Logger
logLevel aws.LogLevelType
}

For example, MaxPendingConnectionsPerHost is renamed to maxConcurrentConnAttempts here, and the default is 10. What are the consequences if we increase this to 10000? Etc...

DescribeEndpoints* functions are missing

Using the DAX Go client with the latest version of the Go SDK results in:

projects/src/github.com/aws/aws-dax-go/dax/service.go:129:5: cannot use (Dax)(nil) (type Dax) as type dynamodbiface.DynamoDBAPI in assignment:
*Dax does not implement dynamodbiface.DynamoDBAPI (missing DescribeEndpoints method)

The DescribeEndpoints, DescribeEndpointsWithContext, and DescribeEndpointsRequest functions are missing from api.go.

Adding G4 grammar file for parser

I'd like to propose including the ANTLR grammar file (.g4) along with the generated source files in our version control system. This inclusion offers several benefits that can significantly improve the project's clarity, maintainability, and collaborative potential. Here are the key advantages:

Improved Project Understanding: The grammar file serves as a high-level description of the language or data format that our project parses or generates. By including it in the repository, new contributors can quickly grasp the structure and rules of the language without diving deep into the generated code, which might be more complex and less human-readable.

Easier Updates and Maintenance: When the grammar needs to be modified or extended, having the .g4 file readily available in the repository allows contributors to make changes directly and regenerate the source files. This ensures that updates can be made efficiently, and the generated code remains consistent with the grammar definition.

Better Version Control: Tracking changes to the grammar file over time provides a clear history of the language's evolution or the data format within the project. This historical context is invaluable for understanding why certain decisions were made and can help in diagnosing issues or planning future extensions.

Enhanced Collaboration: Including the grammar file facilitates collaboration among team members and contributors who might be working on extending the language or integrating new features. It ensures that everyone has access to the most current version of the grammar, reducing the likelihood of conflicts or inconsistencies.

Quality Assurance: The presence of the grammar file in the repository allows for the application of quality assurance processes, such as peer reviews of grammar changes, before they affect the generated code. This can lead to a more robust and error-free codebase by catching potential issues at the grammar level.

Enable x-ray integration

We want to be able to see exactly where DAX is spending the time, e.g. authenticating, sending data, etc.

Not compatible with AWS EKS IAM roles out of the box

This is mostly a duplicate of aws/aws-sdk-go#3218, but it affects this package in its default configuration and maybe it's easier to fix here than it is there.

I won't duplicate that issue, but essentially right now dax.DefaultConfig() won't use the credentials specified by AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN environment variables. If we used the same credential search path as session.NewSession in the AWS SDK, then it would be ok.

What are your thoughts on where this should be fixed? Right now the workaround is to do:

sess, _ := session.NewSession()
cfg := dax.DefaultConfig()
cfg.Credentials = sess.Config.Credentials

ScanPage/QueryPage support

Are there any plans to support ScanPage/QueryPage or any particular reason that they are not implemented? I'm interested in implementing them but wanted to touch base before opening up a PR.

InvalidParameter: custom handlers not supported

Hi! I met this error when I use NewWithSession(). How can I fix this error? Here is my code:

sess := session.Must(session.NewSession(&aws.Config{Region: aws.String("ap-southeast-1")}))
daxClient, err = dax.NewWithSession(*sess)

Unimplemented Calls Should Not Panic

It came as a surprise to me that unimplemented calls using DAX would panic instead of returning an error. I see in the source that all the wiring is in place to return an error.

Ideally, a typed unimplemented error would be returned so that consumers can handle appropriately.

Incorrect logging level in AWS DAX GO SDK

We wanted to track request retries and errors in our log by setting log level to aws.LogDebugWithRequestRetries and aws.LogDebugWithRequestErrors

aws.NewConfig().WithLogger(logger).WithLogLevel(aws.LogDebugWithRequestRetries | aws.LogDebugWithRequestErrors)

However, this will add noises in our log as it also log things like dax health check passing etc.

The SDK log should have the appropriate level so that logging error cases will not require logging normal operations.

Missing support for transaction cancelation reasons

As far as I can tell, it's not possible to get cancelation reasons for transactions.

DAX does send them to clients, and the library does parse them, but it doesn't appear to use or expose them in any way:

type daxTransactionCanceledFailure struct {

Would it be possible to expose these?

For what it's worth, accessing cancelation reasons is possible in aws-sdk-go, albeit pretty painful: https://github.com/aws/aws-sdk-go/tree/3c8d61f5257e0e0da3e8d901f56c6765878f09e5/example/service/dynamodb/transactWriteItems

So if a proper API is blocked by aws-sdk-go support, maybe it would be reasonable to allow users to override decodeError in a way similar to aws-sdk-go?

How to attach routes to the Dax Cluster

Hi there

I need assistance making a query to a DynamoDB table through the Dax .After reading through the Code i see that the only way to get the Error "Service Unavailable : no routes found" is the endpoint or the port are not found in the confuguration

please correct me on how i can attach me endpoint
client

Error :
2

This is where the error is occurring :
AwsErr

I am currently getting this error when testing code that I implemented to test queries through the Dax Cluster

aws-sdk-go Release v1.35.34 added BatchExecuteStatement which is missing in aws-dax-go leading to build failure

See aws/aws-sdk-go#3650
This causes build to fail.

vendor/github.com/aws/aws-dax-go/dax/service.go:150:5: cannot use (*Dax)(nil) (type *Dax) as type dynamodbiface.DynamoDBAPI in assignment:
	*Dax does not implement dynamodbiface.DynamoDBAPI (missing BatchExecuteStatement method)

May I recommend that you move https://github.com/aws/aws-dax-go/blob/master/dax/service.go#L150 to a test instead?
Our code does not rely on dynamodbiface.DynamoDBAPI. Without that line our code would build properly since we rely on our own interface.

Add ability to configure minimum idle connection

Currently it is not possible to configure the minimum number of connection for the client. Can this ability be added to the SDK so that we can reuse idle connections and avoid the cost of establishing new connections (especially when TLS is enabled and new connections are more expensive to make).

Allow Users to Connect With a Custom Dialer.

The Cluster Config Should expose an optional Custom Dialer.

Why ?

Our DAX cluster for local dev is not exposed to the public internet. We access it via a proxy running on our machines. All traffic is first directed to the local proxy via a custom dialer.

Currently, our integration tests don't work when run locally due to this issue.

The Updated Config would look like:

type Config struct {
	MaxPendingConnectionsPerHost int
	ClusterUpdateThreshold       time.Duration
	ClusterUpdateInterval        time.Duration
        // Connect is an optional function
	Connect                      func(ctx context.Context, network, addr string) (net.Conn, error)

	HostPorts   []string
	Region      string
	Credentials *credentials.Credentials
}

This would mean the Connect Func needs to propagated to where it is used in the tubepool files. 

Note while fixing this it would be great if we passed the context all the way down to the Dial Func.

Compatiblity with 1.16 SDK releases?

Now that #10 is closed and 1.0.2 is released, I tried upgrading both our our dependencies to the latest versions:

aws-dax-go: 1.0.2
aws-sdk-go: 1.16.6

However, when I do so dax fails to compile:

vendor/github.com/aws/aws-dax-go/dax/service.go:129:5: cannot use (*Dax)(nil) (type *Dax) as type dynamodbiface.DynamoDBAPI in assignment:
	*Dax does not implement dynamodbiface.DynamoDBAPI (missing TransactGetItems method)

Which version(s) of the aws-sdk-go is 1.0.2 compatible with?

Dial Connection not being considered by context timeout

We've ran into an issue where we set timeouts, but during high traffic/requests dax seems to not properly timeout.
We setup our dax client as below...

sess := session.Must(session.NewSession())
cfg := dax.DefaultConfig()
cfg.Credentials = sess.Config.Credentials
cfg.Region = region
cfg.HostPorts = []string{endpoint}
cfg.RequestTimeout = 300 * time.Millisecond
cfg.ReadRetries = 1                    // default is 2
cfg.MaxPendingConnectionsPerHost = 100 // default is 10
cfg.DialContext = (&net.Dialer{
  Timeout:   300 * time.Millisecond,
  KeepAlive: 30 * time.Second,
}).DialContext
client := dax.New(cfg)

During peak traffic hours we are seeing dax response take over 3 seconds.
I'm suspecting dial connection to be using context.TODO instead of request context.

https://github.com/aws/aws-dax-go/blob/master/dax/internal/client/tubepool.go#L318

Thank you in advance!

Bump ANTLR version

The current version of ANTLR used in this package is from 2018. Since ANTLR doesn't conform to semver semantics, changes can be incompatible across versions. We use a more recent version in our companies monorepo, which means we are unable to use the DAX client without downgrading the version for all our services to the five year old version used in this package. This is a non-starter for us.

I'm requesting a new release, with a more recent ANTLR version used.

Dax does not implement dynamodbiface.DynamoDBAPI functions

The 1.51.4 release of the aws-go-sdk includes updates to the ddb interface that are not implemented by the DAX client. The following methods have been added:

	DeleteResourcePolicy(*dynamodb.DeleteResourcePolicyInput) (*dynamodb.DeleteResourcePolicyOutput, error)
	DeleteResourcePolicyWithContext(aws.Context, *dynamodb.DeleteResourcePolicyInput, ...request.Option) (*dynamodb.DeleteResourcePolicyOutput, error)
	DeleteResourcePolicyRequest(*dynamodb.DeleteResourcePolicyInput) (*request.Request, *dynamodb.DeleteResourcePolicyOutput)

	GetResourcePolicy(*dynamodb.GetResourcePolicyInput) (*dynamodb.GetResourcePolicyOutput, error)
	GetResourcePolicyWithContext(aws.Context, *dynamodb.GetResourcePolicyInput, ...request.Option) (*dynamodb.GetResourcePolicyOutput, error)
	GetResourcePolicyRequest(*dynamodb.GetResourcePolicyInput) (*request.Request, *dynamodb.GetResourcePolicyOutput)

	PutResourcePolicy(*dynamodb.PutResourcePolicyInput) (*dynamodb.PutResourcePolicyOutput, error)
	PutResourcePolicyWithContext(aws.Context, *dynamodb.PutResourcePolicyInput, ...request.Option) (*dynamodb.PutResourcePolicyOutput, error)
	PutResourcePolicyRequest(*dynamodb.PutResourcePolicyInput) (*request.Request, *dynamodb.PutResourcePolicyOutput)

This is preventing using the DAX client as a DDb client.

DescribeEndpoints

Hi I am getting an issue where Dax does not implement dynamodbiface.DynamoDBAPI
ie.

vendor/github.com/aws/aws-dax-go/dax/service.go:129:5: cannot use (*Dax)(nil) (type *Dax) as type dynamodbiface.DynamoDBAPI in assignment:
*Dax does not implement dynamodbiface.DynamoDBAPI (missing DescribeEndpoints method)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.