Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WithVersion to support int 64bit instead of 32 #548

Open
ani12321 opened this issue Nov 11, 2022 · 2 comments
Open

WithVersion to support int 64bit instead of 32 #548

ani12321 opened this issue Nov 11, 2022 · 2 comments

Comments

@ani12321
Copy link

ani12321 commented Nov 11, 2022

Hey!
WithVersion - used to explicitly set version number for concurrency control needs to support 64 bit integers instead of 32bit as currently is.

Index.WithVersion seems to get a 32bit int as input

func (f Index) WithVersion(v int) func(*IndexRequest) {
	return func(r *IndexRequest) {
		r.Version = &v
	}
}

On the other hand the bulk api seems to support 64 bit version:

type BulkIndexerItem struct {
	Index           string
	Action          string
	DocumentID      string
	Routing         string
	Version         *int64
	VersionType     string
	Body            io.ReadSeeker
	RetryOnConflict *int

	OnSuccess func(context.Context, BulkIndexerItem, BulkIndexerResponseItem)        // Per item
	OnFailure func(context.Context, BulkIndexerItem, BulkIndexerResponseItem, error) // Per item
}
@rockdaboot
Copy link
Contributor

Hi @ani12321
"The int, uint, and uintptr types are usually 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems." (See https://go.dev/tour/basics/11). So maybe this is not a big deal to most users.

But you are right in terms of clearness and consistency that int64 is preferable over int here. The only reason not to change it is backwards compatibility to existing code !?

@hashmeetchadha
Copy link

as per the ES doc: Elasticsearch will work with any numerical versioning system (in the 1:2^63-1 range)
Which might not be an issue in 64-bit systems, but it is an issue in 32-bit systems as we are enforcing the version to be 32-but while ES clearly can support int64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants