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

How to delete all tickets in OM #152

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions site/content/en/docs/FAQ/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "FAQ"
linkTitle: "FAQ"
weight: 6
description: >
This guide walks through the frequently asked questions about Open Match.
---
9 changes: 9 additions & 0 deletions site/content/en/docs/FAQ/backfill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "How to do backfill"
linkTitle: "How to do backfill"
weight: 3
description: >
This guide provides guidance about how to How to do backfill in Open Match.
---

WIP
52 changes: 52 additions & 0 deletions site/content/en/docs/FAQ/delete_all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: "How to delete all tickets"
linkTitle: "How to delete all tickets"
weight: 3
description: >
This guide provides guidance about how to delete all tickets in Open Match.
---

Open Match does not provides a `DeleteAll` API for users who want to delete all tickets in Open Match. However, starting from Open Match v0.10.0, we recommend using the `QueryTicketIds` API to query and delete all tickets. Here is a code snippet for the recommended usage.

```go
// Connect to QueryService.
qc, err := grpc.Dial(queryServiceAddr, grpc.WithInsecure())
if err != nil {
log.Fatalf("Failed to connect to Open Match, got %s", err.Error())
}
defer qc.Close()

q := pb.NewQueryServiceClient(conn)

fc, err := grpc.Dial(queryServiceAddr, grpc.WithInsecure())
if err != nil {
log.Fatalf("Failed to connect to Open Match, got %s", err.Error())
}
defer fc.Close()

f := pb.NewQueryServiceClient(conn)


// an empty pool returns all ticket ids in Open Match
stream, err := qc.QueryTicketIds(context.Background(), &pb.QueryTicketIdsRequest{})

ids := []string{}
for {
yfei1 marked this conversation as resolved.
Show resolved Hide resolved
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// process the error
}

ids = append(ids, resp.GetIds()...)
}

for _, id := range ids {
_, err = f.DeleteTicket(context.Background(), &pb.DeleteTicketRequest{TicketId: id})
if err != nil {
// process the error
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this handle pending tickets or tickets that are already assigned?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is the agreement on #1136? I thought this doc was intended to document how to delete all tickets in OM?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More than the documentation itself, I am concerned about the implementation for:
googleforgames/open-match#1151

Looks like that goes through query service - so I assume you will only get Active IDs? So is this statement on that API proto accurate:
If the Pool contains no Filters, QueryTicketIds will return all TicketIDs in the state storage. ?

The primary user scenario here was to have an ability to cleanup Open Match state storage - and if there is a simpler way to do that, we should consider that. Providing a state specific API may be cleaner (get all pending / get all assigned / get all in all states) but thats a lower priority.

Also, we dont expect this to be called at scale - so going through query cache for this is not a requirement.