Skip to content

Conversation

@Charles-Gagnon
Copy link
Contributor

Closes #283
Closes #303

// Either there's a bug or we're in a bad state so not much we can do here. We'll try clearing
// our state and retry getting the changes from the top again in case something broke while
// fetching the changes.
// It doesn't make sense to retry processing the changes immediately since this isn't a connection based issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: connection-based

README.md Outdated
e.g. `Leases_7d12c06c6ddff24c_1845581613`
This table is used to ensure that all changes are processed and that no change is processed more than once. This table consists of two groups of columns :
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra space before column

README.md Outdated
In addition a schema named `az_func` will be created that the tables will belong to.
The login the trigger is configured to use must be given permissions to create these tables and schema. If not then an error will be thrown and the trigger will fail to be ran.
Copy link
Contributor

Choose a reason for hiding this comment

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

will fail to run

README.md Outdated
The login the trigger is configured to use must be given permissions to create these tables and schema. If not then an error will be thrown and the trigger will fail to be ran.
If the tables are deleted or modified then unexpected behavior may occur. To reset the state of the triggers first stop all currently running functions with trigger bindings and then either truncate or delete the tables - the next time a function with a trigger binding is started it will recreate the tables as necessary.
Copy link
Contributor

Choose a reason for hiding this comment

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

modified,

README.md Outdated
The trigger functionality creates a number of tables to use for tracking the current state of the trigger. This allows state to be persisted across sessions and for multiple instances of a trigger binding to execute in parallel (for scaling purposes).
In addition a schema named `az_func` will be created that the tables will belong to.
Copy link
Contributor

Choose a reason for hiding this comment

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

addition,

README.md Outdated
##### azfunc.Leases_*
A `Leases_*` table is created for every unique instance of a function and table. The full name will be in the format `Leases_<FunctionId>_<TableId>` where `<FunctionId>` is a hash of the Host ID assigned by the function runtime and `<TableId>` is the SQL Object ID of the table being tracked.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do leases tables ever get cleaned up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - after every function invocation we clean up old rows from previous sync versions.

DELETE FROM {this._leasesTableName} WITH (TABLOCKX) WHERE {SqlTriggerConstants.LeasesTableChangeVersionColumnName} <= {newLastSyncVersion};

README.md Outdated
The login the trigger is configured to use must be given permissions to create these tables and schema. If not then an error will be thrown and the trigger will fail to run.
If the tables are deleted or modified, then unexpected behavior may occur. To reset the state of the triggers first stop all currently running functions with trigger bindings and then either truncate or delete the tables - the next time a function with a trigger binding is started it will recreate the tables as necessary.
Copy link
Contributor

Choose a reason for hiding this comment

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

Put commas in:

  • If not, then an error will be thrown or use 'Otherwise'.
  • To reset the state of the triggers, first stop all currently running functions
  • the next time a function with a trigger binding is started, it will recreate the tables as necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (sorta - I basically copied everything into word and just took the suggestions there to add commas where it suggested)

README.md Outdated
##### azfunc.Leases_*
A `Leases_*` table is created for every unique instance of a function and table. The full name will be in the format `Leases_<FunctionId>_<TableId>` where `<FunctionId>` is a hash of the Host ID assigned by the function runtime and `<TableId>` is the SQL Object ID of the table being tracked.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if the implementation details will benefit the users reading the Readme file. We can instead mention that the leases table's names are based on the user function and the table's object ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

README.md Outdated
A `Leases_*` table is created for every unique instance of a function and table. The full name will be in the format `Leases_<FunctionId>_<TableId>` where `<FunctionId>` is a hash of the Host ID assigned by the function runtime and `<TableId>` is the SQL Object ID of the table being tracked.
e.g. `Leases_7d12c06c6ddff24c_1845581613`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not have a separate paragraph for the example and just merge it with the paragraph above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Charles-Gagnon Charles-Gagnon merged commit 72751fe into triggerbindings Oct 12, 2022
@Charles-Gagnon Charles-Gagnon deleted the chgagnon/triggerDocs branch October 12, 2022 17:21
PBBlox pushed a commit to PBBlox/azure-functions-sql-extension that referenced this pull request Apr 6, 2025
* Update README and code comments

* more

* PR comments

* Add cleanup docs

* Fix spelling

* pr comments
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

Successfully merging this pull request may close these issues.

4 participants